ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonValidation
MuonPRDTest
Root
MuEntryVariables.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/MuEntryVariables.h
"
6
7
8
#include "
TrackRecord/TrackRecordCollection.h
"
9
#include "CLHEP/Vector/ThreeVector.h"
10
#include "
GeoPrimitives/CLHEPtoEigenConverter.h
"
11
12
namespace
MuonPRDTest
{
13
MuEntryVariables::MuEntryVariables
(
MuonTesterTree
&
tree
,
const
std::string& container_name, MSG::Level msglvl):
14
PrdTesterModule
(
tree
,
"MuEntryVariables"
, msglvl),
m_key
{container_name} {}
15
bool
MuEntryVariables::declare_keys
() {
return
declare_dependency
(
m_key
); }
16
17
bool
MuEntryVariables::fill
(
const
EventContext& ctx) {
18
ATH_MSG_DEBUG
(
"do fillNSWMuEntryVariables()"
);
19
const
MuonGM::MuonDetectorManager
* MuonDetMgr =
getDetMgr
(ctx);
20
if
(!MuonDetMgr) {
return
false
; }
21
SG::ReadHandle<TrackRecordCollection>
trackRecordCollection{
m_key
, ctx};
22
if
(!trackRecordCollection.
isValid
()) {
23
ATH_MSG_FATAL
(
"Failed to retrieve track collection container "
<<
m_key
.fullKey());
24
return
false
;
25
}
26
m_MuEntry_nParticles
= trackRecordCollection->size();
27
for
(
const
auto
& it : *trackRecordCollection ) {
28
m_MuEntry_particlePdg_id
.push_back(it.GetPDGCode());
29
m_MuEntry_particleBarcode
.push_back(it.barcode());
// FIXME barcode-based
30
const
Amg::Vector3D
threeMom =
Amg::Hep3VectorToEigen
(it.GetMomentum());
31
m_MuEntry_mom
.push_back(threeMom.perp(), threeMom.eta(), threeMom.phi(), it.GetEnergy());
32
m_MuEntry_pos
.push_back(
Amg::Hep3VectorToEigen
(it.GetPosition()));
33
}
34
return
true
;
35
}
36
}
37
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CLHEPtoEigenConverter.h
MuEntryVariables.h
TrackRecordCollection.h
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:51
MuonPRDTest::MuEntryVariables::m_MuEntry_nParticles
ScalarBranch< unsigned int > & m_MuEntry_nParticles
Definition
MuEntryVariables.h:24
MuonPRDTest::MuEntryVariables::m_key
SG::ReadHandleKey< TrackRecordCollection > m_key
Definition
MuEntryVariables.h:23
MuonPRDTest::MuEntryVariables::m_MuEntry_pos
ThreeVectorBranch m_MuEntry_pos
Definition
MuEntryVariables.h:26
MuonPRDTest::MuEntryVariables::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
MuEntryVariables.cxx:17
MuonPRDTest::MuEntryVariables::MuEntryVariables
MuEntryVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition
MuEntryVariables.cxx:13
MuonPRDTest::MuEntryVariables::m_MuEntry_particlePdg_id
VectorBranch< int > & m_MuEntry_particlePdg_id
Definition
MuEntryVariables.h:27
MuonPRDTest::MuEntryVariables::m_MuEntry_particleBarcode
VectorBranch< int > & m_MuEntry_particleBarcode
Definition
MuEntryVariables.h:28
MuonPRDTest::MuEntryVariables::declare_keys
bool declare_keys() override final
Definition
MuEntryVariables.cxx:15
MuonPRDTest::MuEntryVariables::m_MuEntry_mom
PtEtaPhiEBranch m_MuEntry_mom
Definition
MuEntryVariables.h:25
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition
PrdTesterModule.cxx:16
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::Hep3VectorToEigen
Amg::Vector3D Hep3VectorToEigen(const CLHEP::Hep3Vector &CLHEPvector)
Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.
Definition
CLHEPtoEigenConverter.h:137
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
MuonPRDTest
Definition
MuonHitTesterAlg.h:15
Generated on
for ATLAS Offline Software by
1.17.0