ATLAS Offline Software
RPCDigitVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 namespace MuonPRDTest {
9  RpcDigitVariables::RpcDigitVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
10  PrdTesterModule(tree, "Digits_RPC", true, msglvl), m_key{container_name} {}
11 
13  bool RpcDigitVariables::fill(const EventContext& ctx) {
14  ATH_MSG_DEBUG("do fillMDTSimHitVariables()");
15  const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
16  if (!MuonDetMgr) { return false; }
18  if (!RpcDigitContainer.isValid()) {
19  ATH_MSG_FATAL("Failed to retrieve digit container " << m_key.fullKey());
20  return false;
21  }
22 
23  ATH_MSG_DEBUG("retrieved RPC Digit Container with size " << RpcDigitContainer->digit_size());
24 
25  if (RpcDigitContainer->size() == 0) ATH_MSG_DEBUG(" RPC Digit Container empty ");
26  unsigned int n_digits{0};
27  for (const RpcDigitCollection* coll : *RpcDigitContainer) {
28  ATH_MSG_DEBUG("processing collection with size " << coll->size());
29  for (const RpcDigit* digit: *coll) {
30  Identifier Id = digit->identify();
31 
32  ATH_MSG_DEBUG("RPC Digit Offline id: " << idHelperSvc()->toString(Id));
33 
34  const MuonGM::RpcReadoutElement* rdoEl = MuonDetMgr->getRpcReadoutElement(Id);
35  if (!rdoEl) {
36  ATH_MSG_ERROR("RPCDigitVariables::fillVariables() - Failed to retrieve PRCReadoutElement for "<<idHelperSvc()->rpcIdHelper().print_to_string(Id).c_str());
37  return false;
38  }
39 
40  const Amg::Vector3D gpos{rdoEl->stripPos(Id)};
42 
43  rdoEl->surface(Id).globalToLocal(gpos, Amg::Vector3D::Zero(), lpos);
47  m_RPC_tot.push_back(digit->ToT());
49  ++n_digits;
50  }
51  }
52  m_RPC_nDigits = n_digits;
53  ATH_MSG_DEBUG(" finished fillRpcDigitVariables()");
54  return true;
55  }
56 } // 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
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
RPCDigitVariables.h
RpcDigit
Definition: RpcDigit.h:16
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
RpcDigitContainer
Use IdentifiableContainer with RpcDigitCollection.
Definition: RpcDigitContainer.h:53
RpcDigitCollection
Definition: RpcDigitCollection.h:17
tree
TChain * tree
Definition: tile_monitor.h:30
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition: IdentifiableContainerMT.h:209
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition: PrdTesterModule.cxx:15
MuonVal::RpcIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:36
MuonGM::RpcReadoutElement
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h:54
MuonPRDTest::RpcDigitVariables::m_RPC_dig_globalPos
ThreeVectorBranch m_RPC_dig_globalPos
Definition: RPCDigitVariables.h:27
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
MuonPRDTest::RpcDigitVariables::declare_keys
bool declare_keys() override final
Definition: RPCDigitVariables.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
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::RpcDigitVariables::m_RPC_dig_id
RpcIdentifierBranch m_RPC_dig_id
Definition: RPCDigitVariables.h:29
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
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
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.
MuonGM::RpcReadoutElement::stripPos
Amg::Vector3D stripPos(const Identifier &id) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx:177
MuonPRDTest::RpcDigitVariables::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: RPCDigitVariables.cxx:13
MuonPRDTest::RpcDigitVariables::m_RPC_nDigits
ScalarBranch< unsigned int > & m_RPC_nDigits
Definition: RPCDigitVariables.h:24
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonPRDTest::RpcDigitVariables::m_key
SG::ReadHandleKey< RpcDigitContainer > m_key
Definition: RPCDigitVariables.h:23
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:49
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:14
MuonPRDTest::RpcDigitVariables::RpcDigitVariables
RpcDigitVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition: RPCDigitVariables.cxx:9
MuonPRDTest::RpcDigitVariables::m_RPC_dig_localPos
TwoVectorBranch m_RPC_dig_localPos
Definition: RPCDigitVariables.h:28
RpcDigitContainer::digit_size
size_type digit_size() const
Definition: RpcDigitContainer.cxx:52
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
MuonPRDTest::RpcDigitVariables::m_RPC_dig_time
VectorBranch< float > & m_RPC_dig_time
Definition: RPCDigitVariables.h:25
RpcReadoutElement.h
MuonPRDTest::RpcDigitVariables::m_RPC_tot
VectorBranch< float > & m_RPC_tot
Definition: RPCDigitVariables.h:26