ATLAS Offline Software
Reconstruction
Jet
JetRec
Root
MuonSegmentExtractor.cxx
Go to the documentation of this file.
1
// this file is -*- C++ -*-
2
3
/*
4
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
#include "
JetRec/MuonSegmentExtractor.h
"
8
#include "
xAODMuon/MuonSegment.h
"
9
#include <vector>
10
11
MuonSegmentExtractor::MuonSegmentExtractor
(
const
xAOD::MuonSegmentContainer
*
ms
,
12
const
std::string &
label
) :
13
m_originalParticles(
ms
), m_label(
label
){
14
}
15
16
MuonSegmentExtractor::~MuonSegmentExtractor
()=
default
;
17
18
MuonSegmentExtractor
*
MuonSegmentExtractor::clone
()
const
{
19
// who is going to delete this?
20
return
new
MuonSegmentExtractor
(*
this
);
21
}
22
23
MuonSegmentExtractor
*
MuonSegmentExtractor::ghostClone
()
const
{
24
// who is going to delete this?
25
return
new
MuonSegmentExtractor
(*
this
);
26
}
27
28
void
MuonSegmentExtractor::addToJet
(
xAOD::Jet
&
jet
,
29
const
std::vector<int>&
indices
)
const
{
30
31
std::vector<const xAOD::MuonSegment*> constituents;
32
constituents.reserve(
indices
.size());
33
for
(
auto
i
:
indices
){constituents.push_back((*
m_originalParticles
)[
i
]);}
34
35
// MuonSegments are always ghosts
36
37
jet
.setAssociatedObjects(
m_label
, constituents);
38
jet
.setAttribute<
int
>(
m_label
+
"Count"
, constituents.size());
39
}
40
41
42
std::string
MuonSegmentExtractor::toString
(
int
level
)
const
{
43
std::ostringstream oss{
""
, std::ios::ate};
44
oss <<
"MuonSegmentExtractor dump level("
<<
level
<<
")"
45
<<
" label "
<<
m_label
46
<<
" isGhost "
<< std::boolalpha <<
true
// muon segments ar always ghost
47
<<
" No of MuonSegments: "
<<
m_originalParticles
->
size
();
48
49
if
(
level
> 0){
50
oss <<
"\n MuonSegment momenta\n"
;
51
std::for_each(
m_originalParticles
->
begin
(),
52
m_originalParticles
->
end
(),
53
[&oss](
const
xAOD::MuonSegment
*
p
){
54
oss << p->px() <<
" "
<< p->py() <<
" "
<< p->pz() <<
'\n'
;});
55
}
56
57
return
oss.str();
58
}
59
60
61
62
bool
MuonSegmentExtractor::checkIntegrity
()
const
{
63
for
(
const
auto
*
const
ip
: *
m_originalParticles
){
64
try
{
65
ip
->pz();
66
}
catch
(...) {
67
return
false
;
68
}
69
}
70
return
true
;
71
}
MuonSegmentExtractor::toString
virtual std::string toString(int level) const override
Definition:
MuonSegmentExtractor.cxx:42
PlotCalibFromCool.label
label
Definition:
PlotCalibFromCool.py:78
Trk::indices
std::pair< long int, long int > indices
Definition:
AlSymMatBase.h:24
MuonSegment.h
xAOD::MuonSegment_v1
Class describing a MuonSegment.
Definition:
MuonSegment_v1.h:33
MuonSegmentExtractor.h
MuonSegmentExtractor::checkIntegrity
virtual bool checkIntegrity() const override
Definition:
MuonSegmentExtractor.cxx:62
python.SystemOfUnits.ms
int ms
Definition:
SystemOfUnits.py:132
python.iconfTool.models.loaders.level
level
Definition:
loaders.py:20
MuonSegmentExtractor::m_originalParticles
const xAOD::MuonSegmentContainer * m_originalParticles
Definition:
MuonSegmentExtractor.h:34
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
jet
Definition:
JetCalibTools_PlotJESFactors.cxx:23
MuonSegmentExtractor::clone
virtual MuonSegmentExtractor * clone() const override
Definition:
MuonSegmentExtractor.cxx:18
lumiFormat.i
int i
Definition:
lumiFormat.py:85
find_tgc_unfilled_channelids.ip
ip
Definition:
find_tgc_unfilled_channelids.py:3
MuonSegmentExtractor::MuonSegmentExtractor
MuonSegmentExtractor(const xAOD::MuonSegmentContainer *, const std::string &label="")
Definition:
MuonSegmentExtractor.cxx:11
DataVector
Derived DataVector<T>.
Definition:
DataVector.h:581
MuonSegmentExtractor::m_label
std::string m_label
Definition:
MuonSegmentExtractor.h:35
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
xAOD::Jet_v1
Class describing a jet.
Definition:
Jet_v1.h:57
MuonSegmentExtractor::~MuonSegmentExtractor
virtual ~MuonSegmentExtractor()
MuonSegmentExtractor
Definition:
MuonSegmentExtractor.h:17
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
MuonSegmentExtractor::ghostClone
virtual MuonSegmentExtractor * ghostClone() const override
Definition:
MuonSegmentExtractor.cxx:23
MuonSegmentExtractor::addToJet
virtual void addToJet(xAOD::Jet &, const std::vector< int > &indices) const override
Definition:
MuonSegmentExtractor.cxx:28
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Generated on Thu Nov 7 2024 21:22:18 for ATLAS Offline Software by
1.8.18