ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonValidation
MuonPRDTest
Root
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
5
#include "
MuonPRDTest/TGCPRDVariables.h
"
6
7
#include "
MuonReadoutGeometry/TgcReadoutElement.h
"
8
#include "
EventPrimitives/EventPrimitivesHelpers.h
"
9
namespace
MuonPRDTest
{
10
TGCPRDVariables::TGCPRDVariables
(
MuonTesterTree
&
tree
,
const
std::string& container_name, MSG::Level msglvl) :
11
PrdTesterModule
(
tree
,
"PRD_TGC"
, msglvl),
m_key
{container_name} {}
12
bool
TGCPRDVariables::declare_keys
() {
return
declare_dependency
(
m_key
); }
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
; }
18
SG::ReadHandle<Muon::TgcPrepDataContainer>
tgcprdContainer{
m_key
, ctx};
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
unsigned
int
n_PRD{0};
27
for
(
const
Muon::TgcPrepDataCollection
* coll : *tgcprdContainer ) {
28
for
(
const
Muon::TgcPrepData
* prd: *coll) {
29
Identifier
Id = prd->identify();
30
const
MuonGM::TgcReadoutElement
* det = MuonDetMgr->
getTgcReadoutElement
(Id);
31
if
(!det) {
32
ATH_MSG_ERROR
(
"The TGC hit "
<<
idHelperSvc
()->toString(Id)<<
" does not have a detector element attached. That should actually never happen"
);
33
return
false
;
34
}
35
36
m_TGC_PRD_id
.push_back(Id);
37
Amg::Vector3D
pos = prd->globalPosition();
38
Amg::Vector2D
loc_pos{Amg::Vector2D::Zero()};
39
det->surface(Id).globalToLocal(pos, Amg::Vector3D::Zero(), loc_pos);
40
m_TGC_PRD_globalPos
.push_back(pos);
41
m_TGC_PRD_localPos
.push_back(loc_pos);
42
m_TGC_PRD_bcId
.push_back(prd->getBcBitMap());
43
m_TGC_PRD_error
.push_back(
Amg::error
(prd->localCovariance(),
Trk::locX
));
44
++n_PRD;
45
}
46
}
47
m_TGC_nPRD
= n_PRD;
48
ATH_MSG_DEBUG
(
" finished fillTGCPRDVariables()"
);
49
return
true
;
50
}
51
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
EventPrimitivesHelpers.h
TgcReadoutElement.h
TGCPRDVariables.h
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:51
MuonGM::MuonDetectorManager::getTgcReadoutElement
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition
MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:259
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::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition
PrdTesterModule.cxx:16
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition
PrdTesterModule.cxx:15
MuonPRDTest::PrdTesterModule::PrdTesterModule
PrdTesterModule(MuonTesterTree &tree, const std::string &grp_name, MSG::Level msglvl)
Definition
PrdTesterModule.cxx:8
MuonPRDTest::TGCPRDVariables::m_TGC_PRD_globalPos
ThreeVectorBranch m_TGC_PRD_globalPos
Definition
TGCPRDVariables.h:27
MuonPRDTest::TGCPRDVariables::m_TGC_PRD_localPos
TwoVectorBranch m_TGC_PRD_localPos
Definition
TGCPRDVariables.h:28
MuonPRDTest::TGCPRDVariables::m_TGC_PRD_error
VectorBranch< float > & m_TGC_PRD_error
Definition
TGCPRDVariables.h:31
MuonPRDTest::TGCPRDVariables::declare_keys
bool declare_keys() override final
Definition
TGCPRDVariables.cxx:12
MuonPRDTest::TGCPRDVariables::m_TGC_nPRD
ScalarBranch< unsigned int > & m_TGC_nPRD
Definition
TGCPRDVariables.h:25
MuonPRDTest::TGCPRDVariables::TGCPRDVariables
TGCPRDVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition
TGCPRDVariables.cxx:10
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
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_TGC_PRD_bcId
VectorBranch< uint8_t > & m_TGC_PRD_bcId
Definition
TGCPRDVariables.h:30
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonVal::MuonTesterBranch::tree
TTree * tree() override final
Returns the underlying TTree object.
Definition
MuonTesterBranch.cxx:53
MuonVal::MuonTesterTree
Definition
MuonTesterTree.h:38
Muon::TgcPrepData
Class to represent TGC measurements.
Definition
TgcPrepData.h:32
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition
GeoPrimitives.h:48
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Identifier
Definition
IdentifierFieldParser.cxx:14
MuonPRDTest
Definition
MuonHitTesterAlg.h:15
Muon::TgcPrepDataCollection
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
Definition
MuonPrepDataCollection.h:108
Trk::locX
@ locX
Definition
ParamDefs.h:37
Generated on
for ATLAS Offline Software by
1.17.0