ATLAS Offline Software
TGCPRDVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 namespace MuonPRDTest {
10  TGCPRDVariables::TGCPRDVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
11  PrdTesterModule(tree, "PRD_TGC", true, msglvl), m_key{container_name} {}
13 
14  bool TGCPRDVariables::fill(const EventContext& ctx) {
15  ATH_MSG_DEBUG("do fillTGCPRDVariables()");
16  const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
17  if (!MuonDetMgr) { return false; }
19  if (!tgcprdContainer.isValid()) {
20  ATH_MSG_FATAL("Failed to retrieve prd container " << m_key.fullKey());
21  return false;
22  }
23 
24  ATH_MSG_DEBUG("retrieved TGC PRD Container with size " << tgcprdContainer->size());
25 
26  if (tgcprdContainer->size() == 0) ATH_MSG_DEBUG(" TGC PRD Container empty ");
27  unsigned int n_PRD{0};
28  for(const Muon::TgcPrepDataCollection* coll : *tgcprdContainer ) {
29  for (const Muon::TgcPrepData* prd: *coll) {
30  Identifier Id = prd->identify();
31  const MuonGM::TgcReadoutElement* det = MuonDetMgr->getTgcReadoutElement(Id);
32  if (!det) {
33  ATH_MSG_ERROR("The TGC hit "<<idHelperSvc()->toString(Id)<<" does not have a detector element attached. That should actually never happen");
34  return false;
35  }
36 
38  Amg::Vector3D pos = prd->globalPosition();
40  det->surface(Id).globalToLocal(pos, Amg::Vector3D::Zero(), loc_pos);
42  m_TGC_PRD_localPos.push_back(loc_pos);
43  m_TGC_PRD_bcId.push_back(prd->getBcBitMap());
44  m_TGC_PRD_cov.push_back(Amg::error(prd->localCovariance(), Trk::locX));
45  ++n_PRD;
46  }
47  }
48  m_TGC_nPRD = n_PRD;
49  ATH_MSG_DEBUG(" finished fillTGCPRDVariables()");
50  return true;
51  }
52 }
MuonPRDTest::TGCPRDVariables::m_TGC_nPRD
ScalarBranch< unsigned int > & m_TGC_nPRD
Definition: TGCPRDVariables.h:25
MuonPRDTest::TGCPRDVariables::m_TGC_PRD_localPos
TwoVectorBranch m_TGC_PRD_localPos
Definition: TGCPRDVariables.h:28
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Trk::locX
@ locX
Definition: ParamDefs.h:43
MuonPRDTest::TGCPRDVariables::TGCPRDVariables
TGCPRDVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition: TGCPRDVariables.cxx:10
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
EventPrimitivesHelpers.h
tree
TChain * tree
Definition: tile_monitor.h:30
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition: PrdTesterModule.cxx:15
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonGM::MuonDetectorManager::getTgcReadoutElement
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:247
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
TGCPRDVariables.h
MuonVal::TgcIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:66
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
MuonPRDTest::TGCPRDVariables::m_TGC_PRD_cov
VectorBranch< float > & m_TGC_PRD_cov
Definition: TGCPRDVariables.h:31
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
MuonPRDTest::TGCPRDVariables::m_TGC_PRD_bcId
VectorBranch< uint8_t > & m_TGC_PRD_bcId
Definition: TGCPRDVariables.h:30
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
WritePulseShapeToCool.det
det
Definition: WritePulseShapeToCool.py:204
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
MuonPRDTest::TGCPRDVariables::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: TGCPRDVariables.cxx:14
MuonPRDTest::TGCPRDVariables::m_key
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_key
Definition: TGCPRDVariables.h:24
MuonPRDTest::TGCPRDVariables::m_TGC_PRD_id
TgcIdentifierBranch m_TGC_PRD_id
Definition: TGCPRDVariables.h:29
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
Amg::error
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Definition: EventPrimitivesHelpers.h:40
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonPRDTest::TGCPRDVariables::declare_keys
bool declare_keys() override final
Definition: TGCPRDVariables.cxx:12
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
Muon::TgcPrepData
Class to represent TGC measurements.
Definition: TgcPrepData.h:32
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:14
TgcReadoutElement.h
MuonPRDTest::TGCPRDVariables::m_TGC_PRD_globalPos
ThreeVectorBranch m_TGC_PRD_globalPos
Definition: TGCPRDVariables.h:27
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32