ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7#include "MuonFullIDHelper.h"
9
10namespace JiveXML {
11
12 //--------------------------------------------------------------------------
13
14 RpcPrepDataRetriever::RpcPrepDataRetriever(const std::string& type, const std::string& name, const IInterface* parent):
15 AthAlgTool(type, name, 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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
#define y
#define x
#define z
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
bool msgLvl(const MSG::Level lvl) const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
const_iterator begin() const noexcept
const std::string m_typeName
The data type that is generated by this retriever.
RpcPrepDataRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
StatusCode initialize()
Default AthAlgTool methods.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
virtual std::string dataTypeName() const
Return the name of the data type.
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_sgKey
The storegate key for the RPC collection.
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
double StripLength(bool measphi) const
returns the strip length for the phi or eta plane
double StripWidth(bool measphi) const
returns the strip width for the phi or eta plane
Class to represent RPC measurements.
Definition RpcPrepData.h:35
Eigen::Matrix< double, 3, 1 > Vector3D
std::string getFullID(Identifier id, const MdtIdHelper &mdtHelper)
Get the identifier string for an MDT ID with the sequence: Detector/StationName/StationEta/StationPhi...
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
std::map< std::string, DataVect > DataMap
Definition DataType.h:59
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition DataType.h:58
MuonPrepDataCollection< RpcPrepData > RpcPrepDataCollection