ATLAS Offline Software
MuonROIRetriever.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  MuonROIRetriever::MuonROIRetriever(const std::string& type, const std::string& name, const IInterface* 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 ==""){ thisThrName = "empty"; };
63  thrName.push_back(DataType( thisThrName ));
64 
65  thrValue.push_back(DataType( itMU->getThrValue()));
66  energy.push_back(DataType( itMU->getThrValue()/CLHEP::GeV));
67  }
68 
69  DataMap myDataMap;
70  myDataMap["phi"] = phi;
71  myDataMap["eta"] = eta;
72  myDataMap["roiWord"] = roiWord;
73  myDataMap["thrNumber"] = thrNumber;
74  myDataMap["thrName"] = thrName;
75  myDataMap["thrValue"] = thrValue;
76  myDataMap["energy"] = energy;
77 
78  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< phi.size() << endmsg;
79 
80  //forward data to formating tool
81  return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap);
82  }
83 }
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
JiveXML::MuonROIRetriever::m_sgKey
std::string m_sgKey
The storegate key for the MuonROIs.
Definition: MuonROIRetriever.h:36
JiveXML::MuonROIRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: MuonROIRetriever.h:28
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
JiveXML::MuonROIRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: MuonROIRetriever.cxx:30
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
JiveXML::DataMap
std::map< std::string, DataVect > DataMap
Definition: DataType.h:59
MuonROIRetriever.h
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
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
LVL1_ROI.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
JiveXML::MuonROIRetriever::MuonROIRetriever
MuonROIRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: MuonROIRetriever.cxx:17
LVL1_ROI
Top level AOD object storing LVL1 RoIs.
Definition: LVL1_ROI.h:43
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:221
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
xAOD::thrValue
thrValue
Definition: MuonRoI_v1.cxx:53