ATLAS Offline Software
RPCSDOVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 namespace 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 retrive 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;
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);
39 
41  const Trk::Surface& surf{MuonDetMgr->getRpcReadoutElement(id)->surface(id)};
42  surf.globalToLocal(rpc_sdo.globalPosition(), Amg::Vector3D::Zero(), 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 
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
MuonGM::MuonDetectorManager::getRpcReadoutElement
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:168
Trk::PlaneSurface::globalToLocal
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for PlaneSurface: GlobalToLocal method without dynamic memory allocation - boolean checks i...
Definition: PlaneSurface.cxx:213
MuonSimData::word
int word() const
Definition: MuonSimData.h:89
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonPRDTest::RpcSDOVariables::m_key
SG::ReadHandleKey< MuonSimDataCollection > m_key
Definition: RPCSDOVariables.h:26
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
tree
TChain * tree
Definition: tile_monitor.h:30
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition: PrdTesterModule.cxx:16
MuonPRDTest::RpcSDOVariables::m_RPC_dig_globalPos
ThreeVectorBranch m_RPC_dig_globalPos
Definition: RPCSDOVariables.h:34
MuonVal::RpcIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:36
MuonPRDTest::RpcSDOVariables::declare_keys
bool declare_keys() override final
Definition: RPCSDOVariables.cxx:12
MuonGM::MuonClusterReadoutElement::surface
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
Definition: MuonClusterReadoutElement.h:123
MuonPRDTest::RpcSDOVariables::m_rpc_sdo_word
VectorBranch< int > & m_rpc_sdo_word
Definition: RPCSDOVariables.h:30
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
MuonPRDTest::RpcSDOVariables::fill
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...
Definition: RPCSDOVariables.cxx:14
MuonSimData::deposits
void deposits(std::vector< Deposit > &deposits) const
Definition: MuonSimData.h:99
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
MuonVal::TwoVectorBranch::push_back
void push_back(const Amg::Vector2D &vec)
interface using the Amg::Vector3D
Definition: TwoVectorBranch.cxx:21
MuonPRDTest::RpcSDOVariables::m_rpc_sdo_barcode
VectorBranch< int > & m_rpc_sdo_barcode
Definition: RPCSDOVariables.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
RPCSDOVariables.h
MuonPRDTest::RpcSDOVariables::m_rpc_sdo_globaltime
VectorBranch< float > & m_rpc_sdo_globaltime
Definition: RPCSDOVariables.h:32
MuonSimData
Definition: MuonSimData.h:62
MuonPRDTest::RpcSDOVariables::m_RPC_dig_localPos
TwoVectorBranch m_RPC_dig_localPos
Definition: RPCSDOVariables.h:35
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::RpcSDOVariables::RpcSDOVariables
RpcSDOVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition: RPCSDOVariables.cxx:9
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:15
MuonPRDTest::RpcSDOVariables::m_rpc_sdo_id
RpcIdentifierBranch m_rpc_sdo_id
Definition: RPCSDOVariables.h:29
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
MuonPRDTest::RpcSDOVariables::m_rpc_nsdo
ScalarBranch< unsigned int > & m_rpc_nsdo
Definition: RPCSDOVariables.h:28
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
MuonSimData::globalPosition
const Amg::Vector3D globalPosition() const
Definition: MuonSimData.h:113
MuonSimData::getTime
float getTime() const
Definition: MuonSimData.h:124
RpcReadoutElement.h
Identifier
Definition: IdentifierFieldParser.cxx:14