-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathJetFinder.h
More file actions
182 lines (151 loc) · 8.53 KB
/
JetFinder.h
File metadata and controls
182 lines (151 loc) · 8.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
// jet finder task
//
// Authors: Nima Zardoshti, Jochen Klein
#ifndef O2_ANALYSIS_JETFINDER_H
#define O2_ANALYSIS_JETFINDER_H
#include <TDatabasePDG.h>
#include <TPDGCode.h>
#include <TMath.h>
#include "fastjet/PseudoJet.hh"
#include "fastjet/ClusterSequenceArea.hh"
#include "fastjet/AreaDefinition.hh"
#include "fastjet/JetDefinition.hh"
#include "fastjet/tools/JetMedianBackgroundEstimator.hh"
#include "fastjet/tools/Subtractor.hh"
#include "fastjet/contrib/ConstituentSubtractor.hh"
#include <vector>
class JetFinder
{
public:
enum class BkgSubMode { none,
rhoAreaSub,
constSub };
BkgSubMode bkgSubMode;
void setBkgSubMode(BkgSubMode bSM) { bkgSubMode = bSM; }
/// Performs jet finding
/// \note the input particle and jet lists are passed by reference
/// \param inputParticles vector of input particles/tracks
/// \param jets veector of jets to be filled
/// \return ClusterSequenceArea object needed to access constituents
// fastjet::ClusterSequenceArea findJets(std::vector<fastjet::PseudoJet> &inputParticles, std::vector<fastjet::PseudoJet> &jets);
static constexpr float mPion = 0.139; // TDatabasePDG::Instance()->GetParticle(211)->Mass(); //can be removed when pion mass becomes default for unidentified tracks
float phiMin;
float phiMax;
float etaMin;
float etaMax;
float jetR;
float jetPtMin;
float jetPtMax;
float jetPhiMin;
float jetPhiMax;
float jetEtaMin;
float jetEtaMax;
float ghostEtaMin;
float ghostEtaMax;
float ghostArea;
int ghostRepeatN;
double ghostktMean;
float gridScatter;
float ktScatter;
float jetBkgR;
float bkgPhiMin;
float bkgPhiMax;
float bkgEtaMin;
float bkgEtaMax;
float constSubAlpha;
float constSubRMax;
bool isReclustering;
fastjet::JetAlgorithm algorithm;
fastjet::RecombinationScheme recombScheme;
fastjet::Strategy strategy;
fastjet::AreaType areaType;
fastjet::GhostedAreaSpec ghostAreaSpec;
fastjet::JetDefinition jetDef;
fastjet::AreaDefinition areaDef;
fastjet::Selector selJets;
fastjet::Selector selGhosts;
fastjet::JetAlgorithm algorithmBkg;
fastjet::RecombinationScheme recombSchemeBkg;
fastjet::Strategy strategyBkg;
fastjet::AreaType areaTypeBkg;
fastjet::JetDefinition jetDefBkg;
fastjet::AreaDefinition areaDefBkg;
fastjet::Selector selRho;
/// Default constructor
JetFinder(float eta_Min = -0.9, float eta_Max = 0.9, float phi_Min = 0.0, float phi_Max = 2 * M_PI) : phiMin(phi_Min),
phiMax(phi_Max),
etaMin(eta_Min),
etaMax(eta_Max),
jetR(0.4),
jetPtMin(0.0),
jetPtMax(1000.0),
jetPhiMin(phi_Min),
jetPhiMax(phi_Max),
jetEtaMin(eta_Min),
jetEtaMax(eta_Max),
ghostEtaMin(eta_Min),
ghostEtaMax(eta_Max),
ghostArea(0.005),
ghostRepeatN(1),
ghostktMean(1e-100), //is float precise enough?
gridScatter(1.0),
ktScatter(0.1),
jetBkgR(0.2),
bkgPhiMin(phi_Min),
bkgPhiMax(phi_Max),
bkgEtaMin(eta_Min),
bkgEtaMax(eta_Max),
algorithm(fastjet::antikt_algorithm),
recombScheme(fastjet::E_scheme),
strategy(fastjet::Best),
areaType(fastjet::active_area),
algorithmBkg(fastjet::JetAlgorithm(fastjet::kt_algorithm)),
recombSchemeBkg(fastjet::RecombinationScheme(fastjet::E_scheme)),
strategyBkg(fastjet::Best),
areaTypeBkg(fastjet::active_area),
bkgSubMode(BkgSubMode::none),
constSubAlpha(1.0),
constSubRMax(0.6),
isReclustering(false)
{
//default constructor
}
/// Default destructor
~JetFinder() = default;
/// Sets the jet finding parameters
void setParams();
/// Sets the background subtraction estimater pointer
void setBkgE();
/// Sets the background subtraction pointer
void setSub();
/// Performs jet finding
/// \note the input particle and jet lists are passed by reference
/// \param inputParticles vector of input particles/tracks
/// \param jets veector of jets to be filled
/// \return ClusterSequenceArea object needed to access constituents
fastjet::ClusterSequenceArea findJets(std::vector<fastjet::PseudoJet>& inputParticles, std::vector<fastjet::PseudoJet>& jets); //ideally find a way of passing the cluster sequence as a reeference
private:
//void setParams();
//void setBkgSub();
std::unique_ptr<fastjet::BackgroundEstimatorBase> bkgE;
std::unique_ptr<fastjet::Subtractor> sub;
std::unique_ptr<fastjet::contrib::ConstituentSubtractor> constituentSub;
ClassDef(JetFinder, 1);
};
//does this belong here?
template <typename T>
void fillConstituents(const T& constituent, std::vector<fastjet::PseudoJet>& constituents)
{
auto energy = std::sqrt(constituent.p() * constituent.p() + JetFinder::mPion * JetFinder::mPion);
constituents.emplace_back(constituent.px(), constituent.py(), constituent.pz(), energy);
}
#endif