ATLAS Offline Software
RpcPrepDataRetriever.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "RpcPrepDataRetriever.h"
6 
7 #include "MuonFullIDHelper.h"
9 
10 namespace JiveXML {
11 
12  //--------------------------------------------------------------------------
13 
14  RpcPrepDataRetriever::RpcPrepDataRetriever(const std::string& type, const std::string& name, const IInterface* parent):
16  m_typeName("RPC")
17  {
18 
19  declareInterface<IDataRetriever>(this);
20 
21  }
22 
23  //--------------------------------------------------------------------------
24 
26 
27  ATH_MSG_DEBUG("Initializing retriever for " << dataTypeName());
28  ATH_CHECK(m_sgKey.initialize());
29  ATH_CHECK( m_idHelperSvc.retrieve() );
30 
31  return StatusCode::SUCCESS;
32  }
33 
34  //--------------------------------------------------------------------------
35 
36  StatusCode RpcPrepDataRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
37 
38  //be verbose
39  ATH_MSG_DEBUG("Retrieving " << dataTypeName());
40 
42 
43  int ndata = 0;
45  for (containerIt=rpcContainer->begin(); containerIt!=rpcContainer->end(); ++containerIt) {
46  ndata += (*containerIt)->size();
47  }
48 
49  //Make the vectors to contain the information and reserve space accordingly
50  DataVect x; x.reserve(ndata);
51  DataVect y; y.reserve(ndata);
52  DataVect z; z.reserve(ndata);
53  DataVect lengthVec; lengthVec.reserve(ndata);
54  DataVect widthVec; widthVec.reserve(ndata);
55  DataVect idVec; idVec.reserve(ndata);
56  DataVect identifierVec; identifierVec.reserve(ndata);
57  DataVect barcode; barcode.reserve(ndata);
58 
59  for (containerIt=rpcContainer->begin(); containerIt!=rpcContainer->end(); ++containerIt) {
60  const Muon::RpcPrepDataCollection *rpcCollection = *containerIt;
61 
63  for (collectionIt=rpcCollection->begin(); collectionIt!=rpcCollection->end(); ++collectionIt) {
64 
65  const Muon::RpcPrepData *data = *collectionIt;
66  const MuonGM::RpcReadoutElement *element = data->detectorElement();
67  Identifier id = data->identify();
68 
69  if (!element) {
70  if (msgLvl(MSG::WARNING)) ATH_MSG_WARNING("No MuonGM::RpcReadoutElement for hit " << id);
71  continue;
72  }
73 
74  Amg::Vector3D globalPos = element->stripPos(id);
75  int measuresPhi = m_idHelperSvc->rpcIdHelper().measuresPhi(id);
76  double stripLength = element->StripLength(measuresPhi);
77  double stripWidth = element->StripWidth(measuresPhi);
78 
79  x.push_back(DataType(globalPos.x()/CLHEP::cm));
80  y.push_back(DataType(globalPos.y()/CLHEP::cm));
81  z.push_back(DataType(globalPos.z()/CLHEP::cm));
82  lengthVec.push_back(DataType(stripLength/CLHEP::cm));
83  widthVec.push_back(DataType(stripWidth/CLHEP::cm));
84  identifierVec.push_back(DataType(MuonFullIDHelper::getFullID(id, m_idHelperSvc->rpcIdHelper())));
85  idVec.push_back(DataType( id.get_compact() ));
86  barcode.push_back(DataType(0));
87  }
88  }
89 
90  DataMap myDataMap;
91  myDataMap["x"] = x;
92  myDataMap["y"] = y;
93  myDataMap["z"] = z;
94  myDataMap["length"] = lengthVec;
95  myDataMap["width"] = widthVec;
96  myDataMap["identifier"] = identifierVec;
97  myDataMap["id"] = idVec;
98  myDataMap["barcode"] = barcode;
99 
100  //Be verbose
101  ATH_MSG_DEBUG(dataTypeName() << ": "<< x.size());
102 
103  //forward data to formating tool
104  return FormatTool->AddToEvent(dataTypeName(), m_sgKey.key(), &myDataMap);
105  }
106 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
JiveXML::RpcPrepDataRetriever::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: RpcPrepDataRetriever.h:45
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
MuonGM::RpcReadoutElement::StripLength
double StripLength(bool measphi) const
returns the strip length for the phi or eta plane
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
JiveXML::RpcPrepDataRetriever::initialize
StatusCode initialize()
Default AthAlgTool methods.
Definition: RpcPrepDataRetriever.cxx:25
JiveXML::RpcPrepDataRetriever::m_sgKey
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_sgKey
The storegate key for the RPC collection.
Definition: RpcPrepDataRetriever.h:43
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
MuonGM::RpcReadoutElement
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h:54
JiveXML::DataMap
std::map< std::string, DataVect > DataMap
Definition: DataType.h:59
x
#define x
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
JiveXML::RpcPrepDataRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: RpcPrepDataRetriever.h:32
z
#define z
Muon::RpcPrepData
Class to represent RPC measurements.
Definition: RpcPrepData.h:35
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
RpcPrepDataRetriever.h
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
MuonGM::RpcReadoutElement::stripPos
Amg::Vector3D stripPos(const Identifier &id) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx:177
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
JiveXML::MuonFullIDHelper::getFullID
std::string getFullID(Identifier id, const MdtIdHelper &mdtHelper)
Get the identifier string for an MDT ID with the sequence: Detector/StationName/StationEta/StationPhi...
Definition: MuonFullIDHelper.cxx:26
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
MuonGM::RpcReadoutElement::StripWidth
double StripWidth(bool measphi) const
returns the strip width for the phi or eta plane
y
#define y
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
JiveXML::RpcPrepDataRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: RpcPrepDataRetriever.cxx:36
MuonFullIDHelper.h
AthAlgTool
Definition: AthAlgTool.h:26
JiveXML::RpcPrepDataRetriever::RpcPrepDataRetriever
RpcPrepDataRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: RpcPrepDataRetriever.cxx:14
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
RpcReadoutElement.h