ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonValidation
MuonPRDTest
Root
MDTSDOVariables.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/MDTSDOVariables.h
>
6
#include <
StoreGate/ReadHandle.h
>
7
namespace
MuonPRDTest
{
8
MdtSDOVariables::MdtSDOVariables
(
MuonTesterTree
&
tree
,
const
std::string& container_name, MSG::Level msglvl) :
9
PrdTesterModule
(
tree
,
"SDO_MDT"
, msglvl),
m_sdo_key
{container_name} {}
10
11
bool
MdtSDOVariables::fill
(
const
EventContext& ctx) {
12
const
MuonGM::MuonDetectorManager
* MuonDetMgr =
getDetMgr
(ctx);
13
if
(!MuonDetMgr) {
return
false
; }
14
ATH_MSG_DEBUG
(
" do fillMdtSDOVariables()"
);
15
ATH_MSG_VERBOSE
(
"MuonDetectorManager from Conditions Store accessed"
<< MuonDetMgr);
16
17
ATH_MSG_DEBUG
(
"Retrieve MDT SDO container with name = "
<<
m_sdo_key
.fullKey());
18
19
SG::ReadHandle<MuonSimDataCollection>
mdtSdoContainer{
m_sdo_key
, ctx};
20
if
(!mdtSdoContainer.
isValid
()) {
21
ATH_MSG_FATAL
(
"Failed to retrieve SDO container "
<<
m_sdo_key
.fullKey());
22
return
false
;
23
}
24
25
for
(
const
auto
& coll : *mdtSdoContainer) {
26
const
Identifier
id
= coll.first;
27
const
MuonSimData
& mdt_sdo = coll.second;
28
m_mdt_sdo_id
.push_back(
id
);
29
// Get information on the SDO
30
ATH_MSG_DEBUG
(
"MDT SDO: "
<<
idHelperSvc
()->toString(
id
));
31
ATH_MSG_DEBUG
(
"Get the truth deposits from the SDO."
);
32
std::vector<MuonSimData::Deposit> deposits;
33
mdt_sdo.
deposits
(deposits);
34
35
m_mdt_sdo_globalPos
.push_back(mdt_sdo.
globalPosition
());
36
m_mdt_sdo_globalTime
.push_back(mdt_sdo.
getTime
());
37
m_mdt_sdo_word
.push_back(mdt_sdo.
word
());
38
39
// use the information of the first deposit
40
int
barcode = deposits[0].first.barcode();
41
double
MuonMCdata_firstentry = deposits[0].second.firstEntry();
42
double
MuonMCdata_secondentry = deposits[0].second.secondEntry();
43
44
ATH_MSG_DEBUG
(
"MDT SDO barcode="
<< barcode);
45
ATH_MSG_DEBUG
(
"MDT SDO localPosX="
<< std::setw(9) << std::setprecision(2) << MuonMCdata_firstentry
46
<<
", localPosY="
<< std::setw(9) << std::setprecision(2) << MuonMCdata_secondentry);
47
48
m_mdt_sdo_barcode
.push_back(barcode);
49
m_mdt_sdo_localPosX
.push_back(MuonMCdata_firstentry);
50
m_mdt_sdo_localPosY
.push_back(MuonMCdata_secondentry);
51
}
52
m_mdt_nsdo
= mdtSdoContainer.
cptr
()->size();
53
ATH_MSG_DEBUG
(
"Processed "
<<
m_mdt_nsdo
<<
" MDT SDOs"
);
54
return
true
;
55
}
56
57
bool
MdtSDOVariables::declare_keys
() {
return
declare_dependency
(
m_sdo_key
); }
58
}
// namespace MuonPRDTest
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
MDTSDOVariables.h
ReadHandle.h
Handle class for reading from StoreGate.
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:51
MuonPRDTest::MdtSDOVariables::m_mdt_sdo_word
VectorBranch< int > & m_mdt_sdo_word
Definition
MDTSDOVariables.h:25
MuonPRDTest::MdtSDOVariables::m_sdo_key
SG::ReadHandleKey< MuonSimDataCollection > m_sdo_key
Definition
MDTSDOVariables.h:22
MuonPRDTest::MdtSDOVariables::m_mdt_sdo_id
MdtIdentifierBranch m_mdt_sdo_id
Definition
MDTSDOVariables.h:24
MuonPRDTest::MdtSDOVariables::m_mdt_sdo_barcode
VectorBranch< int > & m_mdt_sdo_barcode
Definition
MDTSDOVariables.h:26
MuonPRDTest::MdtSDOVariables::m_mdt_sdo_globalPos
ThreeVectorBranch m_mdt_sdo_globalPos
Definition
MDTSDOVariables.h:27
MuonPRDTest::MdtSDOVariables::declare_keys
bool declare_keys() override final
Definition
MDTSDOVariables.cxx:57
MuonPRDTest::MdtSDOVariables::MdtSDOVariables
MdtSDOVariables(MuonTesterTree &tree, const std::string &grp_name, MSG::Level msglvl)
Definition
MDTSDOVariables.cxx:8
MuonPRDTest::MdtSDOVariables::m_mdt_sdo_localPosY
VectorBranch< float > & m_mdt_sdo_localPosY
Definition
MDTSDOVariables.h:30
MuonPRDTest::MdtSDOVariables::m_mdt_nsdo
ScalarBranch< unsigned int > & m_mdt_nsdo
Definition
MDTSDOVariables.h:23
MuonPRDTest::MdtSDOVariables::m_mdt_sdo_localPosX
VectorBranch< float > & m_mdt_sdo_localPosX
Definition
MDTSDOVariables.h:29
MuonPRDTest::MdtSDOVariables::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
MDTSDOVariables.cxx:11
MuonPRDTest::MdtSDOVariables::m_mdt_sdo_globalTime
VectorBranch< float > & m_mdt_sdo_globalTime
Definition
MDTSDOVariables.h:28
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
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?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
Identifier
Definition
IdentifierFieldParser.cxx:14
MuonPRDTest
Definition
MuonHitTesterAlg.h:15
Generated on
for ATLAS Offline Software by
1.17.0