ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonValidation
MuonPRDTest
Root
MMSDOVariables.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/MMSDOVariables.h
"
6
7
namespace
MuonPRDTest
{
8
MMSDOVariables::MMSDOVariables
(
MuonTesterTree
&
tree
,
const
std::string& container_name, MSG::Level msglvl) :
9
PrdTesterModule
(
tree
,
"SDO_MM"
, msglvl),
m_key
{container_name} {}
10
11
bool
MMSDOVariables::declare_keys
() {
return
declare_dependency
(
m_key
); }
12
13
bool
MMSDOVariables::fill
(
const
EventContext& ctx) {
14
ATH_MSG_DEBUG
(
"do fill MMSDOVariables()"
);
15
SG::ReadHandle<MuonSimDataCollection>
mmSdoContainer{
m_key
, ctx};
16
if
(!mmSdoContainer.
isValid
()) {
17
ATH_MSG_FATAL
(
"Failed to retrieve digit container "
<<
m_key
.fullKey());
18
return
false
;
19
}
20
unsigned
int
n_sdo{0};
21
for
(
const
auto
& coll : *mmSdoContainer) {
22
const
Identifier
&
id
= coll.first;
23
const
MuonSimData
& mm_sdo = coll.second;
24
25
m_NSWMM_sdo_globaltime
.push_back(mm_sdo.
getTime
());
26
m_NSWMM_sdo_word
.push_back(mm_sdo.
word
());
27
28
ATH_MSG_DEBUG
(
"Get the truth deposits from the SDO."
);
29
std::vector<MuonSimData::Deposit> deposits;
30
mm_sdo.
deposits
(deposits);
31
32
m_NSWMM_sdo_id
.push_back(
id
);
33
const
Amg::Vector3D
hit_gpos = mm_sdo.
globalPosition
();
34
m_NSWMM_dig_globalPos
.push_back(hit_gpos);
35
36
// use the information of the first deposit
37
int
barcode = deposits[0].first.barcode();
38
double
MuonMCdata_firstentry = deposits[0].second.firstEntry();
39
double
MuonMCdata_secondentry = deposits[0].second.secondEntry();
40
41
ATH_MSG_DEBUG
(
"MM SDO barcode="
<< barcode);
42
ATH_MSG_DEBUG
(
"MM SDO local position X="
<< std::setw(9) << std::setprecision(2) << MuonMCdata_firstentry
43
<<
", local position Y="
<< std::setw(9) << std::setprecision(2) << MuonMCdata_secondentry);
44
45
m_NSWMM_sdo_barcode
.push_back(barcode);
46
47
m_NSWMM_sdo_localPosX
.push_back(MuonMCdata_firstentry);
48
m_NSWMM_sdo_localPosY
.push_back(MuonMCdata_secondentry);
49
50
++n_sdo;
51
}
52
m_NSWMM_nsdo
= n_sdo;
53
54
ATH_MSG_DEBUG
(
"Processed "
<< n_sdo <<
"MM SDOs"
);
55
return
true
;
56
}
57
}
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
MMSDOVariables.h
MuonPRDTest::MMSDOVariables::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
MMSDOVariables.cxx:13
MuonPRDTest::MMSDOVariables::m_NSWMM_nsdo
ScalarBranch< unsigned int > & m_NSWMM_nsdo
Definition
MMSDOVariables.h:25
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_localPosX
VectorBranch< float > & m_NSWMM_sdo_localPosX
Definition
MMSDOVariables.h:32
MuonPRDTest::MMSDOVariables::m_NSWMM_dig_globalPos
ThreeVectorBranch m_NSWMM_dig_globalPos
Definition
MMSDOVariables.h:31
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_id
MmIdentifierBranch m_NSWMM_sdo_id
Definition
MMSDOVariables.h:26
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_barcode
VectorBranch< int > & m_NSWMM_sdo_barcode
Definition
MMSDOVariables.h:28
MuonPRDTest::MMSDOVariables::MMSDOVariables
MMSDOVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition
MMSDOVariables.cxx:8
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_globaltime
VectorBranch< float > & m_NSWMM_sdo_globaltime
Definition
MMSDOVariables.h:29
MuonPRDTest::MMSDOVariables::declare_keys
bool declare_keys() override final
Definition
MMSDOVariables.cxx:11
MuonPRDTest::MMSDOVariables::m_key
SG::ReadHandleKey< MuonSimDataCollection > m_key
Definition
MMSDOVariables.h:23
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_word
VectorBranch< int > & m_NSWMM_sdo_word
Definition
MMSDOVariables.h:27
MuonPRDTest::MMSDOVariables::m_NSWMM_sdo_localPosY
VectorBranch< float > & m_NSWMM_sdo_localPosY
Definition
MMSDOVariables.h:33
MuonPRDTest::PrdTesterModule::PrdTesterModule
PrdTesterModule(MuonTesterTree &tree, const std::string &grp_name, MSG::Level msglvl)
Definition
PrdTesterModule.cxx:8
MuonSimData
Definition
MuonSimData.h:62
MuonSimData::word
int word() const
Definition
MuonSimData.h:89
MuonSimData::deposits
void deposits(std::vector< Deposit > &deposits) const
Definition
MuonSimData.h:99
MuonSimData::globalPosition
const Amg::Vector3D globalPosition() const
Definition
MuonSimData.h:113
MuonSimData::getTime
float getTime() const
Definition
MuonSimData.h:124
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::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Identifier
Definition
IdentifierFieldParser.cxx:14
MuonPRDTest
Definition
MuonHitTesterAlg.h:15
Generated on
for ATLAS Offline Software by
1.17.0