ATLAS Offline Software
Loading...
Searching...
No Matches
RPCSDOVariables.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8namespace MuonPRDTest {
9 RpcSDOVariables::RpcSDOVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
10 PrdTesterModule(tree, "SDO_RPC", msglvl), m_key{container_name} {}
11
13
14 bool RpcSDOVariables::fill(const EventContext& ctx) {
15 ATH_MSG_DEBUG("do fill RpcSDOVariable()");
16 SG::ReadHandle<MuonSimDataCollection> rpcSdoContainer{m_key, ctx};
17
18 const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
19 if (!MuonDetMgr) { return false; }
20
21 if (!rpcSdoContainer.isValid()) {
22 ATH_MSG_FATAL("Failed to retrieve digit container " << m_key.fullKey());
23 return false;
24 }
25 unsigned int n_sdo{0};
26 for (const auto& coll : *rpcSdoContainer) {
27 const Identifier& id = coll.first;
28 const MuonSimData& rpc_sdo = coll.second;
29 m_rpc_sdo_id.push_back(id);
30 m_rpc_sdo_globaltime.push_back(rpc_sdo.getTime());
31 m_rpc_sdo_word.push_back(rpc_sdo.word());
32
33 ATH_MSG_DEBUG("RPC SDO: " << idHelperSvc()->toString(id));
34
35 ATH_MSG_DEBUG("Get the truth deposits from the SDO.");
36 std::vector<MuonSimData::Deposit> deposits;
37 rpc_sdo.deposits(deposits);
38 m_RPC_dig_globalPos.push_back(rpc_sdo.globalPosition());
39
40 Amg::Vector2D locPos{Amg::Vector2D::Zero()};
41 const Trk::Surface& surf{MuonDetMgr->getRpcReadoutElement(id)->surface(id)};
42 surf.globalToLocal(rpc_sdo.globalPosition(), Amg::Vector3D::Zero(), locPos);
43 m_RPC_dig_localPos.push_back(locPos);
44
45 // use the information of the first deposit
46 int barcode = deposits[0].first.barcode();
47
48 ATH_MSG_DEBUG("RPC SDO barcode=" << barcode);
49
50 m_rpc_sdo_barcode.push_back(barcode);
51 ++n_sdo;
52 }
53 m_rpc_nsdo = n_sdo;
54
55 ATH_MSG_DEBUG("Processed " << n_sdo << " RPC SDOs");
56 return true;
57 }
58} // namespace MuonPRDTest
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
const Muon::IMuonIdHelperSvc * idHelperSvc() const
PrdTesterModule(MuonTesterTree &tree, const std::string &grp_name, MSG::Level msglvl)
ScalarBranch< unsigned int > & m_rpc_nsdo
RpcIdentifierBranch m_rpc_sdo_id
VectorBranch< float > & m_rpc_sdo_globaltime
VectorBranch< int > & m_rpc_sdo_word
VectorBranch< int > & m_rpc_sdo_barcode
bool declare_keys() override final
ThreeVectorBranch m_RPC_dig_globalPos
bool fill(const EventContext &ctx) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
RpcSDOVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
SG::ReadHandleKey< MuonSimDataCollection > m_key
int word() const
Definition MuonSimData.h:89
void deposits(std::vector< Deposit > &deposits) const
Definition MuonSimData.h:99
const Amg::Vector3D globalPosition() const
float getTime() const
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
TTree * tree() override final
Returns the underlying TTree object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Abstract Base Class for tracking surfaces.
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const =0
Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean chec...
Eigen::Matrix< double, 2, 1 > Vector2D