ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetRec
JetRec
PseudoJetContainer.h
Go to the documentation of this file.
1
// this file is -*- C++ -*-
2
3
4
5
#ifndef PseudoJetContainer_H
6
#define PseudoJetContainer_H
7
8
/*
9
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
10
*/
11
12
13
// PseudoJetContainer - maintains a list of Pseudovctors, and the the
14
// EDM objects used to create them. It is used to supply Pseudojets
15
// for clustering, and to identify the EDM objects with the Pseudojets
16
// in a Pseudojet cluster.
17
18
// - maintains a list of pseudojets to be used for clustering by fastjet
19
// fastjet returns a clustered set of pseudojets in the form of a single
20
// pseudojet with components. The components are the pseudojets in the cluster
21
// Note: fastjet may also add its own pseudojets to the cluster.
22
//
23
// - has association objects (Extractors) which allow the
24
// identification of the EDM object for a given pseudojet.
25
// When PseudoJetContainer::extractConstituents() is passed a jet and a
26
// Pseudojet, it finds the components of the pseudojet (which are
27
// also held in the PseudoJetContainer pseudojet list), sorts them by
28
// type. For each type, it asks the appropriate Extractor to add
29
// the EDM objects to the jet.
30
//
31
// PseudoJetContainers can coelesce with other PseudoJetContainers via the
32
// append() method.
33
34
// Johannes Elmsheuser, April 2016
35
// P Sherwood, December 2107
36
37
#include "fastjet/PseudoJet.hh"
38
#include "
xAODJet/Jet.h
"
39
#include "
JetRec/IConstituentExtractor.h
"
40
#include "
xAODTracking/VertexContainer.h
"
41
#include <vector>
42
#include <string>
43
#include <set>
44
#include <memory>
45
46
typedef
std::vector<fastjet::PseudoJet>
PseudoJetVector
;
47
48
class
PseudoJetContainer
{
49
public
:
50
typedef
fastjet::PseudoJet
PseudoJet
;
51
52
PseudoJetContainer
();
53
54
// Constructor from a ConstituentExtractor and vector<PseudoJet>
55
// PseudoJet OWNS their ConstituentExtractors
56
PseudoJetContainer
(std::unique_ptr<const IConstituentExtractor> c,
57
const
std::vector<PseudoJet> & vecPJ,
58
bool
debug
=
false
);
59
60
// fill xAOD jet with constit&ghosts extracted from final PSeudoJet
61
bool
extractConstituents
(
xAOD::Jet
&,
const
std::vector<PseudoJet>&)
const
;
62
bool
extractConstituents
(
xAOD::Jet
&
jet
,
const
PseudoJet
&finalPJ)
const
;
63
// fill xAOD jet with correct by-vertex consituents and ghosts
64
bool
extractByVertexConstituents
(
xAOD::Jet
&
jet
,
const
PseudoJet
& finalPJ,
const
xAOD::Vertex
* vertex)
const
;
65
// returns the list of input constituents
66
// typically to give to a fastjet::ClusterSequence
67
const
std::vector<PseudoJet>*
casVectorPseudoJet
()
const
;
68
std::vector<PseudoJet>*
casVectorPseudoJet
();
69
70
// combine the contents of a PseudoJetContainer with the current container.
71
void
append
(
const
PseudoJetContainer
*);
72
73
// dump function with levels of detail. the second arg gives the
74
// level of detail for the contained extractors
75
std::string
toString
(
int
level,
int
extLevel=0)
const
;
76
std::size_t
size
()
const
;
77
std::string
dumpPseudoJets
()
const
;
78
79
bool
debug
()
const
;
80
void
debug
(
bool
b);
81
friend
std::ostream&
operator<<
(std::ostream&,
const
PseudoJetContainer
&);
82
83
private
:
84
85
86
bool
checkInvariants
(
const
std::string&)
const
;
87
bool
bad_invariants_exit
(
const
std::ostringstream&)
const
;
88
89
bool
checkPseudoJetVector
(
const
std::vector<PseudoJet>&,
90
const
std::string&)
const
;
91
92
bool
checkInConstituents
(
const
std::vector<PseudoJet>&,
93
const
std::string&)
const
;
94
95
// all pseudojets, used by fastjet
96
std::vector<PseudoJet>
m_allConstituents
;
97
98
99
// List of associated Extractors,
100
// which contains the EDM objects whose momentum
101
// is used to a pseudojet. Note that only some of the EDM objects
102
// give rise to pseudojets, an the pseudojet index range the are valid for.
103
// Mapping of pseudojet indices to Extractor
104
105
struct
ExtractorRange
{
106
ExtractorRange
(
unsigned
int
lo,
107
unsigned
int
hi,
108
std::unique_ptr<const IConstituentExtractor> e):
109
m_lo
(lo),
m_hi
(hi),
m_e
(
std
::move(e)){
110
}
111
112
ExtractorRange
(
const
ExtractorRange
& other)
113
:
m_lo
(other.
m_lo
),
114
m_hi
(other.
m_hi
),
115
m_e
(other.
m_e
->clone()){
116
}
117
118
friend
void
swap
(
ExtractorRange
& first,
ExtractorRange
& second){
119
using
std::swap
;
120
121
swap
(first.m_lo, second.m_lo);
122
swap
(first.m_hi, second.m_hi);
123
swap
(first.m_e, second.m_e);
124
}
125
126
ExtractorRange
&
operator=
(
ExtractorRange
other){
127
swap
(*
this
, other);
128
return
*
this
;
129
}
130
131
ExtractorRange
bump
(
int
step)
const
{
132
return
ExtractorRange
(
m_lo
+ step,
m_hi
+ step, std::unique_ptr<const IConstituentExtractor>(
m_e
->clone()));
133
}
134
135
int
m_lo
;
136
int
m_hi
;
137
std::unique_ptr<const IConstituentExtractor>
m_e
{};
138
};
139
140
std::vector<ExtractorRange>
m_extractorRanges
;
141
142
//Empty extractors are those with EDM objects for which no Pseudojet was
143
// created by the creating PseudoJetGetter. We need to keep track
144
// of the empty extractors to fill zero information (such as 0 counts)
145
// into the jets.
146
std::set<std::unique_ptr<const IConstituentExtractor>>
m_emptyExtractors
;
147
148
bool
m_debug
{
false
};
149
};
150
151
std::ostream&
operator <<
(std::ostream&,
const
PseudoJetContainer
&);
152
153
#include "
xAODCore/CLASS_DEF.h
"
154
CLASS_DEF
(
PseudoJetContainer
, 147270789 , 1 )
155
156
#endif
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition
Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:67
CLASS_DEF.h
File providing the different SG_BASE macros.
Jet.h
IConstituentExtractor.h
PseudoJetVector
std::vector< fastjet::PseudoJet > PseudoJetVector
Definition
JetConstituentFiller.cxx:17
operator<<
std::ostream & operator<<(std::ostream &, const PseudoJetContainer &)
Definition
PseudoJetContainer.cxx:446
VertexContainer.h
PseudoJetContainer
Definition
PseudoJetContainer.h:48
PseudoJetContainer::m_emptyExtractors
std::set< std::unique_ptr< const IConstituentExtractor > > m_emptyExtractors
Definition
PseudoJetContainer.h:146
PseudoJetContainer::m_debug
bool m_debug
Definition
PseudoJetContainer.h:148
PseudoJetContainer::extractByVertexConstituents
bool extractByVertexConstituents(xAOD::Jet &jet, const PseudoJet &finalPJ, const xAOD::Vertex *vertex) const
Definition
PseudoJetContainer.cxx:114
PseudoJetContainer::m_allConstituents
std::vector< PseudoJet > m_allConstituents
Definition
PseudoJetContainer.h:96
PseudoJetContainer::checkInConstituents
bool checkInConstituents(const std::vector< PseudoJet > &, const std::string &) const
Definition
PseudoJetContainer.cxx:360
PseudoJetContainer::checkInvariants
bool checkInvariants(const std::string &) const
Definition
PseudoJetContainer.cxx:211
PseudoJetContainer::operator<<
friend std::ostream & operator<<(std::ostream &, const PseudoJetContainer &)
Definition
PseudoJetContainer.cxx:446
PseudoJetContainer::casVectorPseudoJet
const std::vector< PseudoJet > * casVectorPseudoJet() const
Definition
PseudoJetContainer.cxx:135
PseudoJetContainer::m_extractorRanges
std::vector< ExtractorRange > m_extractorRanges
Definition
PseudoJetContainer.h:140
PseudoJetContainer::size
std::size_t size() const
Definition
PseudoJetContainer.cxx:440
PseudoJetContainer::PseudoJetContainer
PseudoJetContainer()
Definition
PseudoJetContainer.cxx:21
PseudoJetContainer::append
void append(const PseudoJetContainer *)
Definition
PseudoJetContainer.cxx:145
PseudoJetContainer::PseudoJet
fastjet::PseudoJet PseudoJet
Definition
PseudoJetContainer.h:50
PseudoJetContainer::bad_invariants_exit
bool bad_invariants_exit(const std::ostringstream &) const
Definition
PseudoJetContainer.cxx:428
PseudoJetContainer::debug
bool debug() const
Definition
PseudoJetContainer.cxx:444
PseudoJetContainer::dumpPseudoJets
std::string dumpPseudoJets() const
Definition
PseudoJetContainer.cxx:199
PseudoJetContainer::toString
std::string toString(int level, int extLevel=0) const
Definition
PseudoJetContainer.cxx:172
PseudoJetContainer::checkPseudoJetVector
bool checkPseudoJetVector(const std::vector< PseudoJet > &, const std::string &) const
Definition
PseudoJetContainer.cxx:305
PseudoJetContainer::extractConstituents
bool extractConstituents(xAOD::Jet &, const std::vector< PseudoJet > &) const
Definition
PseudoJetContainer.cxx:48
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
std
STL namespace.
std::swap
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
Definition
AthLinks/ElementLinkVector.h:484
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
PseudoJetContainer::ExtractorRange::swap
friend void swap(ExtractorRange &first, ExtractorRange &second)
Definition
PseudoJetContainer.h:118
PseudoJetContainer::ExtractorRange::m_hi
int m_hi
Definition
PseudoJetContainer.h:136
PseudoJetContainer::ExtractorRange::bump
ExtractorRange bump(int step) const
Definition
PseudoJetContainer.h:131
PseudoJetContainer::ExtractorRange::ExtractorRange
ExtractorRange(const ExtractorRange &other)
Definition
PseudoJetContainer.h:112
PseudoJetContainer::ExtractorRange::ExtractorRange
ExtractorRange(unsigned int lo, unsigned int hi, std::unique_ptr< const IConstituentExtractor > e)
Definition
PseudoJetContainer.h:106
PseudoJetContainer::ExtractorRange::m_lo
int m_lo
Definition
PseudoJetContainer.h:135
PseudoJetContainer::ExtractorRange::operator=
ExtractorRange & operator=(ExtractorRange other)
Definition
PseudoJetContainer.h:126
PseudoJetContainer::ExtractorRange::m_e
std::unique_ptr< const IConstituentExtractor > m_e
Definition
PseudoJetContainer.h:137
Generated on
for ATLAS Offline Software by
1.17.0