ATLAS Offline Software
sTGCDigitVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 
9 namespace MuonPRDTest {
10  sTgcDigitVariables::sTgcDigitVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
11  PrdTesterModule(tree, "Digits_sTGC", true, msglvl), m_key{container_name} {}
12 
14  bool sTgcDigitVariables::fill(const EventContext& ctx) {
15  ATH_MSG_DEBUG("do fillsTGCDigitHitVariables()");
16  const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
17  if (!MuonDetMgr) { return false; }
19  if (!sTgcDigitContainer.isValid()) {
20  ATH_MSG_FATAL("Failed to retrieve digit container " << m_key.fullKey());
21  return false;
22  }
23 
24  ATH_MSG_DEBUG("retrieved sTGC Digit Container with size " << sTgcDigitContainer->digit_size());
25 
26  if (sTgcDigitContainer->size() == 0) ATH_MSG_DEBUG(" sTGC Digit Container empty ");
27  unsigned int n_digits{0};
28  for (const sTgcDigitCollection* coll : *sTgcDigitContainer) {
29  ATH_MSG_DEBUG("processing collection with size " << coll->size());
30  for (unsigned int digitNum = 0; digitNum < coll->size(); digitNum++) {
31  const sTgcDigit* digit = coll->at(digitNum);
32  Identifier Id = digit->identify();
33 
34  const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcReadoutElement(Id);
35  if (!rdoEl) {
36  ATH_MSG_ERROR("sTGCDigitVariables::fillVariables() - Failed to retrieve sTGCReadoutElement for "<<idHelperSvc()->toString(Id));
37  return false;
38  }
42 
43  rdoEl->stripPosition(Id, lpos);
44  rdoEl->surface(Id).localToGlobal(lpos, gpos, gpos);
45 
49 
51  if(idHelperSvc()->stgcIdHelper().channelType(Id) == sTgcIdHelper::Pad ) {
52 
53  std::array<Amg::Vector2D, 4> local_pad_corners{make_array<Amg::Vector2D, 4>(Amg::Vector2D::Zero())};
54  rdoEl->padCorners(Id,local_pad_corners);
55 
56  for(const Amg::Vector2D& local_corner : local_pad_corners) {
57  Amg::Vector3D global_corner{Amg::Vector3D::Zero()};
58  rdoEl->surface(Id).localToGlobal(local_corner, global_corner, global_corner);
60  }
61  }
62 
65 
71 
72  ++n_digits;
73  }
74  }
75  m_NSWsTGC_nDigits = n_digits;
76  ATH_MSG_DEBUG(" finished fillsTgcDigitVariables()");
77  return true;
78  }
79 }
MuonGM::sTgcReadoutElement::padCorners
bool padCorners(const Identifier &id, std::array< Amg::Vector2D, 4 > &corners) const
pad corners
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:360
sTgcDigitContainer
Use IdentifiableContainer with sTgcDigitCollection.
Definition: sTgcDigitContainer.h:50
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_id
sTgcIdentifierBranch m_NSWsTGC_dig_id
Definition: sTGCDigitVariables.h:37
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonPRDTest::sTgcDigitVariables::declare_keys
bool declare_keys() override final
Definition: sTGCDigitVariables.cxx:13
sTgcReadoutElement.h
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::sTgcDigitVariables::m_NSWsTGC_dig_isPileup
VectorBranch< bool > & m_NSWsTGC_dig_isPileup
Definition: sTGCDigitVariables.h:31
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::sTgcIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:79
MuonPRDTest::sTgcDigitVariables::sTgcDigitVariables
sTgcDigitVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition: sTGCDigitVariables.cxx:10
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_bctag
VectorBranch< int > & m_NSWsTGC_dig_bctag
Definition: sTGCDigitVariables.h:28
MuonPRDTest::sTgcDigitVariables::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: sTGCDigitVariables.cxx:14
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_globalPos
ThreeVectorBranch m_NSWsTGC_dig_globalPos
Definition: sTGCDigitVariables.h:33
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
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::sTgcDigitVariables::m_NSWsTGC_dig_charge
VectorBranch< double > & m_NSWsTGC_dig_charge
Definition: sTGCDigitVariables.h:29
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_channelNumber
VectorBranch< int > & m_NSWsTGC_dig_channelNumber
Definition: sTGCDigitVariables.h:32
MuonGM::sTgcReadoutElement::stripPosition
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position - should be renamed to channel position If the strip number is outside the range of va...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:323
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
sTgcDigit
Definition: sTgcDigit.h:20
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
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
sTgcDigitCollection
Definition: sTgcDigitCollection.h:18
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_nDigits
ScalarBranch< unsigned int > & m_NSWsTGC_nDigits
Definition: sTGCDigitVariables.h:24
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonGM::sTgcReadoutElement
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:28
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_time
VectorBranch< double > & m_NSWsTGC_dig_time
Definition: sTGCDigitVariables.h:27
sTgcDigitContainer::digit_size
size_type digit_size() const
Definition: sTgcDigitContainer.cxx:55
sTGCDigitVariables.h
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_PadglobalCornerPos
ThreeVectorBranch m_NSWsTGC_dig_PadglobalCornerPos
Definition: sTGCDigitVariables.h:34
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_localPosX
VectorBranch< float > & m_NSWsTGC_dig_localPosX
Definition: sTGCDigitVariables.h:25
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonGM::sTgcReadoutElement::stripNumber
virtual int stripNumber(const Amg::Vector2D &pos, const Identifier &id) const override final
strip number corresponding to local position.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:311
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:49
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_channelPosX
VectorBranch< float > & m_NSWsTGC_dig_channelPosX
Definition: sTGCDigitVariables.h:35
sTgcIdHelper::Pad
@ Pad
Definition: sTgcIdHelper.h:190
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_channelPosY
VectorBranch< float > & m_NSWsTGC_dig_channelPosY
Definition: sTGCDigitVariables.h:36
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:14
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_localPosY
VectorBranch< float > & m_NSWsTGC_dig_localPosY
Definition: sTGCDigitVariables.h:26
MuonGM::MuonDetectorManager::getsTgcReadoutElement
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:259
Trk::PlaneSurface::localToGlobal
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for PlaneSurface: LocalToGlobal method without dynamic memory allocation.
Definition: PlaneSurface.cxx:204
MuonPRDTest::sTgcDigitVariables::m_key
SG::ReadHandleKey< sTgcDigitContainer > m_key
Definition: sTGCDigitVariables.h:23
MuonPRDTest::sTgcDigitVariables::m_NSWsTGC_dig_isDead
VectorBranch< bool > & m_NSWsTGC_dig_isDead
Definition: sTGCDigitVariables.h:30
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32