ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonValidation
MuonPRDTest
Root
CSCPRDVariables.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/CSCPRDVariables.h
"
6
7
#include "
MuonReadoutGeometry/CscReadoutElement.h
"
8
9
namespace
MuonPRDTest
{
10
CSCPRDVariables::CSCPRDVariables
(
MuonTesterTree
&
tree
,
const
std::string& container_name, MSG::Level msglvl) :
11
PrdTesterModule
(
tree
,
"PRD_CSC"
, msglvl),
m_key
{container_name} {}
12
bool
CSCPRDVariables::declare_keys
() {
return
declare_dependency
(
m_key
); }
13
14
bool
CSCPRDVariables::fill
(
const
EventContext& ctx) {
15
ATH_MSG_DEBUG
(
"do fillCSCPRDVariables()"
);
16
const
MuonGM::MuonDetectorManager
* MuonDetMgr =
getDetMgr
(ctx);
17
if
(!MuonDetMgr) {
return
false
; }
18
SG::ReadHandle<Muon::CscPrepDataContainer>
cscprdContainer{
m_key
, ctx};
19
if
(!cscprdContainer.
isValid
()) {
20
ATH_MSG_FATAL
(
"Failed to retrieve prd container "
<<
m_key
.fullKey());
21
return
false
;
22
}
23
24
ATH_MSG_DEBUG
(
"retrieved CSC PRD Container with size "
<< cscprdContainer->size());
25
26
if
(cscprdContainer->size() == 0)
ATH_MSG_DEBUG
(
" CSC PRD Container empty "
);
27
unsigned
int
n_PRD{0};
28
for
(
auto
it : *cscprdContainer ) {
29
const
Muon::CscPrepDataCollection
*coll = it;
30
for
(
auto
prd: *coll) {
31
Identifier
Id = prd->identify();
32
33
const
MuonGM::CscReadoutElement
* det = MuonDetMgr->
getCscReadoutElement
(Id);
34
if
(!det) {
35
ATH_MSG_ERROR
(
"The CSC hit "
<<
idHelperSvc
()->toString(Id)<<
" does not have a detector element attached. That should actually never happen"
);
36
return
false
;
37
}
38
39
m_CSC_PRD_id
.push_back(Id);
40
m_CSC_PRD_charge
.push_back(prd->charge());
41
m_CSC_PRD_time
.push_back(prd->time());
42
43
Amg::Vector3D
pos = prd->globalPosition();
44
Amg::Vector2D
loc_pos(0., 0.);
45
46
det->surface(Id).globalToLocal(pos,
Amg::Vector3D
(0., 0., 0.), loc_pos);
47
48
m_CSC_PRD_globalPos
.push_back(pos);
49
50
m_CSC_PRD_localPosX
.push_back(loc_pos[0]);
51
m_CSC_PRD_localPosY
.push_back(loc_pos[1]);
52
53
++n_PRD;
54
}
55
}
56
m_CSC_nPRD
= n_PRD;
57
ATH_MSG_DEBUG
(
" finished fillCSCPRDVariables()"
);
58
return
true
;
59
}
60
}
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
CSCPRDVariables.h
CscReadoutElement.h
MuonGM::CscReadoutElement
Definition
CscReadoutElement.h:56
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:51
MuonGM::MuonDetectorManager::getCscReadoutElement
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition
MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:237
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_time
VectorBranch< int > & m_CSC_PRD_time
Definition
CSCPRDVariables.h:28
MuonPRDTest::CSCPRDVariables::m_key
SG::ReadHandleKey< Muon::CscPrepDataContainer > m_key
Definition
CSCPRDVariables.h:23
MuonPRDTest::CSCPRDVariables::CSCPRDVariables
CSCPRDVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition
CSCPRDVariables.cxx:10
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_localPosY
VectorBranch< float > & m_CSC_PRD_localPosY
Definition
CSCPRDVariables.h:26
MuonPRDTest::CSCPRDVariables::m_CSC_nPRD
ScalarBranch< unsigned int > & m_CSC_nPRD
Definition
CSCPRDVariables.h:24
MuonPRDTest::CSCPRDVariables::declare_keys
bool declare_keys() override final
Definition
CSCPRDVariables.cxx:12
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_globalPos
ThreeVectorBranch m_CSC_PRD_globalPos
Definition
CSCPRDVariables.h:27
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_charge
VectorBranch< int > & m_CSC_PRD_charge
Definition
CSCPRDVariables.h:29
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_id
CscIdentifierBranch m_CSC_PRD_id
Definition
CSCPRDVariables.h:30
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_localPosX
VectorBranch< float > & m_CSC_PRD_localPosX
Definition
CSCPRDVariables.h:25
MuonPRDTest::CSCPRDVariables::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
CSCPRDVariables.cxx:14
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
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
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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::CscPrepDataCollection
MuonPrepDataCollection< CscPrepData > CscPrepDataCollection
Definition
MuonPrepDataCollection.h:109
Generated on
for ATLAS Offline Software by
1.17.0