ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetRec
src
MuonSegmentPseudoJetAlgorithm.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
JetRec/MuonSegmentPseudoJetAlgorithm.h
"
6
#include "
JetRec/MuonSegmentExtractor.h
"
7
#include "
AsgDataHandles/ReadHandle.h
"
8
#include "
AsgDataHandles/WriteHandle.h
"
9
10
//**********************************************************************
11
12
StatusCode
MuonSegmentPseudoJetAlgorithm::initialize
() {
13
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
14
15
print
();
16
17
if
(
m_incoll
.key().empty() ||
m_outcoll
.key().empty()) {
18
ATH_MSG_ERROR
(
"Either input or output collection is empty!"
);
19
return
StatusCode::FAILURE;
20
}
21
22
ATH_CHECK
(
m_incoll
.initialize() );
23
ATH_CHECK
(
m_outcoll
.initialize() );
24
25
return
StatusCode::SUCCESS;
26
}
27
28
//**********************************************************************
29
30
StatusCode
MuonSegmentPseudoJetAlgorithm::execute
(
const
EventContext& ctx)
const
{
31
ATH_MSG_VERBOSE
(
"Executing "
<< name() <<
"..."
);
32
33
auto
incoll =
SG::makeHandle<xAOD::MuonSegmentContainer>
(
m_incoll
,ctx);
34
if
( !incoll.isValid() ) {
35
// Return SUCCESS to avoid crashing T0 jobs
36
ATH_MSG_WARNING
(
"Failed to retrieve "
<<
m_incoll
.key() <<
" for PseudoJet creation!"
);
37
return
StatusCode::SUCCESS;
38
}
39
ATH_MSG_DEBUG
(
"Retrieved muon segment container "
<<
m_incoll
.key() );
40
41
std::vector<fastjet::PseudoJet> vpj =
createPseudoJets
(*incoll);
42
43
// create an extractor (MuonSegmentExtractors are always ghost extractors)
44
auto
extractor = std::make_unique<MuonSegmentExtractor>(incoll.cptr(),
m_label
);
45
ATH_MSG_DEBUG
(
"Created extractor: "
<< extractor->toString(0));
46
47
// Put the PseudoJetContainer together
48
auto
pjcont = std::make_unique<PseudoJetContainer>(std::move(extractor), vpj);
49
50
auto
outcoll =
SG::makeHandle<PseudoJetContainer>
(
m_outcoll
,ctx);
51
ATH_MSG_DEBUG
(
"New PseudoJetContainer size "
<< pjcont->size());
52
ATH_CHECK
(outcoll.record(std::move(pjcont)));
53
54
return
StatusCode::SUCCESS;
55
}
56
57
//**********************************************************************
58
59
std::vector<fastjet::PseudoJet>
60
MuonSegmentPseudoJetAlgorithm::createPseudoJets
(
const
xAOD::MuonSegmentContainer
& ms)
const
{
61
62
std::vector<fastjet::PseudoJet> vpj;
63
int
index
=0;
64
for
(
const
xAOD::MuonSegment
* part: ms) {
65
double
pt =
m_pt
;
66
double
x
= part->x();
67
double
y
= part->y();
68
double
z
= part->z();
69
double
xy = sqrt(
x
*
x
+
y
*
y
);
70
double
r
= sqrt(xy*xy +
z
*
z
);
71
double
pfac = pt/xy;
72
double
px = pfac*
x
;
73
double
py = pfac*
y
;
74
double
pz = pfac*
z
;
75
double
e = pfac*
r
;
76
fastjet::PseudoJet psj(px, py, pz, e);
77
ATH_MSG_VERBOSE
(
"Muon segment pseudojet y: "
<< psj.rap());
78
vpj.push_back(psj);
79
vpj.back().set_user_index(
index
);
// Set the index !!
80
index
++;
81
}
82
83
return
vpj;
84
}
85
86
//**********************************************************************
87
88
void
MuonSegmentPseudoJetAlgorithm::print
()
const
{
89
ATH_MSG_DEBUG
(
"Properties for MuonSegmentPseudoJetGetter "
<< name());
90
ATH_MSG_DEBUG
(
" Label: "
<<
m_label
);
91
ATH_MSG_DEBUG
(
" Input container: "
<<
m_incoll
.key());
92
ATH_MSG_DEBUG
(
" Output container: "
<<
m_outcoll
.key());
93
ATH_MSG_DEBUG
(
" Pseudojet pT: "
<<
m_pt
);
94
}
95
96
//**********************************************************************
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
MuonSegmentExtractor.h
MuonSegmentPseudoJetAlgorithm.h
y
#define y
x
#define x
z
#define z
MuonSegmentPseudoJetAlgorithm::initialize
virtual StatusCode initialize() override final
Athena algorithm's Hooks.
Definition
MuonSegmentPseudoJetAlgorithm.cxx:12
MuonSegmentPseudoJetAlgorithm::m_pt
Gaudi::Property< float > m_pt
Definition
MuonSegmentPseudoJetAlgorithm.h:59
MuonSegmentPseudoJetAlgorithm::m_label
Gaudi::Property< std::string > m_label
Label for the collection.
Definition
MuonSegmentPseudoJetAlgorithm.h:57
MuonSegmentPseudoJetAlgorithm::createPseudoJets
std::vector< fastjet::PseudoJet > createPseudoJets(const xAOD::MuonSegmentContainer &ms) const
Definition
MuonSegmentPseudoJetAlgorithm.cxx:60
MuonSegmentPseudoJetAlgorithm::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
MuonSegmentPseudoJetAlgorithm.cxx:30
MuonSegmentPseudoJetAlgorithm::m_incoll
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_incoll
Input collection name.
Definition
MuonSegmentPseudoJetAlgorithm.h:51
MuonSegmentPseudoJetAlgorithm::m_outcoll
SG::WriteHandleKey< PseudoJetContainer > m_outcoll
Output collection name.
Definition
MuonSegmentPseudoJetAlgorithm.h:54
MuonSegmentPseudoJetAlgorithm::print
virtual void print() const
Dump to properties to the log.
Definition
MuonSegmentPseudoJetAlgorithm.cxx:88
r
int r
Definition
globals.cxx:22
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
index
Definition
index.py:1
xAOD::MuonSegmentContainer
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
Definition
MuonSegmentContainer.h:14
xAOD::MuonSegment
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/MuonSegment.h:13
Generated on
for ATLAS Offline Software by
1.17.0