ATLAS Offline Software
xAODMuonROIRetriever.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 
11 //#include "AnalysisTriggerEvent/LVL1_ROI.h"
12 
13 //#include "TrigT1CaloEvent/CPMRoI.h"
14 //#include "TrigT1Interfaces/CPRoIDecoder.h"
15 
17 
18 namespace JiveXML {
19 
20  //--------------------------------------------------------------------------
21 
22  xAODMuonROIRetriever::xAODMuonROIRetriever(const std::string& type, const std::string& name, const IInterface* parent):
23  AthAlgTool(type, name, parent), m_typeName("MuonROI")
24  {
25 
26  declareInterface<IDataRetriever>(this);
27  }
28 
29  //--------------------------------------------------------------------------
30 
31  StatusCode xAODMuonROIRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
32 
34 
35  const xAOD::MuonRoIContainer* muonROIs = 0;
36 
37  //xAOD::MuonROIContainer* muonROIs = 0;
38 
39  // L1JetObject -not- available
40  m_sgKey = "LVL1MuonRoIs";
41  if ( evtStore()->retrieve(muonROIs,m_sgKey).isFailure() ) {
42  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No LVL1MuonROIs found in SG " << endmsg;
43  return StatusCode::SUCCESS;
44  }
45  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found LVL1MuonROIs in SG ! " << endmsg;
46 
47  int noRois = muonROIs->size();
48 
49  DataVect phi; phi.reserve(noRois);
50  DataVect eta; eta.reserve(noRois);
51  DataVect roiWord; roiWord.reserve(noRois);
52  DataVect thrNumber; thrNumber.reserve(noRois);
53  DataVect thrName; thrName.reserve(noRois);
54  DataVect thrValue; thrValue.reserve(noRois);
55  DataVect energy; energy.reserve(noRois);
56 
58  xAOD::MuonRoIContainer::const_iterator itMUe = muonROIs->end();
59 
60  //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "xAOD MuonROIs retrieved from StoreGate with size: " << (MuonROIs->size()) <<endmsg;
61 
62  int counter = 0;
63  for (; itMU != itMUe; ++itMU)
64  {
65  phi.push_back(DataType( (*itMU)->phi()) );
66  eta.push_back(DataType( (*itMU)->eta()) );
67 // roiWord.push_back(DataType( (*itMU)->getRoIWord()) );
68  roiWord.push_back(DataType( (*itMU)->getRoI()) );
69  thrNumber.push_back(DataType( (*itMU)->getThrNumber()));
70 
71 // std::string m_thrName = (*itMU)->getThrName();
72 // if (m_thrName ==""){ m_thrName = "empty"; };
73 // thrName.push_back(DataType( m_thrName ));
74 //
75 // thrValue.push_back(DataType( (*itMU)->getThrValue()));
76 // energy.push_back(DataType( (*itMU)->getThrValue()/CLHEP::GeV));
77 
78  thrName.push_back(DataType( "n_a" )); // placeholders
79  thrValue.push_back(DataType( 1. ));
80  energy.push_back(DataType( 1. ));
81 
82  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "xAOD MuonROI #" << counter++
83  << ", eta: " << (*itMU)->eta() << ", phi: " << (*itMU)->phi() << endmsg;
84 
85 /* from old MuonRoI object: 'getThrNumber', 'getThrName' and 'getROIWord' have gone !
86  for (; itMU != itMUe; ++itMU){
87  roiWord.push_back(DataType( itMU->getROIWord()));
88  thrNumber.push_back(DataType( itMU->getThrNumber()));
89 
90  std::string m_thrName = itMU->getThrName();
91  if (m_thrName ==""){ m_thrName = "empty"; };
92  thrName.push_back(DataType( m_thrName ));
93 
94  thrValue.push_back(DataType( itMU->getThrValue()));
95  energy.push_back(DataType( itMU->getThrValue()/CLHEP::GeV));
96  }
97 */
98 
99  }
100 
101  DataMap myDataMap;
102  myDataMap["phi"] = phi;
103  myDataMap["eta"] = eta;
104  myDataMap["energy"] = energy;
105  myDataMap["roiWord"] = roiWord;
106  myDataMap["thrNumber"] = thrNumber;
107  myDataMap["thrName"] = thrName;
108  myDataMap["thrValue"] = thrValue;
109  myDataMap["energy"] = energy;
110 
111  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< phi.size()
112  << " from: " << m_sgKey << endmsg;
113 
114  //forward data to formating tool
115  return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap);
116  }
117 }
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
MuonRoIContainer.h
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
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
JiveXML::xAODMuonROIRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: xAODMuonROIRetriever.cxx:31
JiveXML::DataMap
std::map< std::string, DataVect > DataMap
Definition: DataType.h:59
JiveXML::xAODMuonROIRetriever::xAODMuonROIRetriever
xAODMuonROIRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: xAODMuonROIRetriever.cxx:22
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
JiveXML::xAODMuonROIRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: xAODMuonROIRetriever.h:43
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
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
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
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
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
xAODMuonROIRetriever.h
AthAlgTool
Definition: AthAlgTool.h:26
test_pyathena.counter
counter
Definition: test_pyathena.py:15
xAOD::thrValue
thrValue
Definition: MuonRoI_v1.cxx:54
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
JiveXML::xAODMuonROIRetriever::m_sgKey
std::string m_sgKey
Definition: xAODMuonROIRetriever.h:50
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.