siscone is hosted by Hepforge, IPPP Durham

The SISCone Jet Algorithm

Version 3.0.6



SISCone 3.0.6
split_merge.h
1// -*- C++ -*-
3// File: split_merge.h //
4// Description: header file for splitting/merging (contains the CJet class) //
5// This file is part of the SISCone project. //
6// WARNING: this is not the main SISCone trunk but //
7// an adaptation to spherical coordinates //
8// For more details, see http://projects.hepforge.org/siscone //
9// //
10// Copyright (c) 2006-2008 Gavin Salam and Gregory Soyez //
11// //
12// This program is free software; you can redistribute it and/or modify //
13// it under the terms of the GNU General Public License as published by //
14// the Free Software Foundation; either version 2 of the License, or //
15// (at your option) any later version. //
16// //
17// This program is distributed in the hope that it will be useful, //
18// but WITHOUT ANY WARRANTY; without even the implied warranty of //
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
20// GNU General Public License for more details. //
21// //
22// You should have received a copy of the GNU General Public License //
23// along with this program; if not, write to the Free Software //
24// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
25// //
26// $Revision:: $//
27// $Date:: $//
29
30#ifndef __SPH_SPLIT_MERGE_H__
31#define __SPH_SPLIT_MERGE_H__
32
33#include <siscone/defines.h>
34#include <siscone/config.h>
35#include "geom_2d.h"
36#include "momentum.h"
37#include <stdio.h>
38#include <vector>
39#include <set>
40#include <memory>
41#include <string>
42
43namespace siscone_spherical{
44
45const int CJET_INEXISTENT_PASS = -2;
46
56class CSphjet{
57 public:
59 CSphjet();
60
62 ~CSphjet();
63
65 double E_tilde;
66 int n;
67 std::vector<int> contents;
68
80 double sm_var2;
81
84
89 int pass;
90};
91
94
96bool jets_E_less(const CSphjet &j1, const CSphjet &j2);
97
98
106enum Esplit_merge_scale {
107 SM_E,
108 SM_Etilde
109};
110
112std::string split_merge_scale_name(Esplit_merge_scale sms);
113
120public:
123 particles(0), split_merge_scale(SM_Etilde){};
124
126 std::string SM_scale_name() const {
127 return split_merge_scale_name(split_merge_scale);}
128
129 std::vector<CSphmomentum> * particles;
130 std::vector<double> * particles_norm2;
131
133 bool operator()(const CSphjet &jet1, const CSphjet &jet2) const;
134
146 void get_difference(const CSphjet &j1, const CSphjet &j2, CSphmomentum *v, double *E_tilde) const;
147
158 Esplit_merge_scale split_merge_scale;
159};
160
161
162// iterator types
164typedef std::multiset<siscone_spherical::CSphjet,CSphsplit_merge_ptcomparison>::iterator cjet_iterator;
165
167typedef std::vector<siscone_spherical::CSphjet>::iterator jet_iterator;
168
169
170
176 public:
179
182
183
185 // initialisation functions //
187
196 int init(std::vector<CSphmomentum> &_particles, std::vector<CSphmomentum> *protocones, double R2, double Emin=0.0);
197
203 int init_particles(std::vector<CSphmomentum> &_particles);
204
208 int init_pleft();
209
221 inline int set_E_weighted_splitting(bool _use_E_weighted_splitting){
222 use_E_weighted_splitting = _use_E_weighted_splitting;
223 return 0;
224 }
225
227 // cleaning functions //
229
231 int partial_clear();
232
234 int full_clear();
235
237 // user-defined stable-cone ordering //
239
246 public:
249
254 virtual double operator()(const CSphjet & jet) const = 0;
255
266 virtual bool is_larger(const CSphjet & a, const CSphjet & b) const{
267 return (a.sm_var2 > b.sm_var2);
268 }
269 };
270
275 void set_user_scale(const Cuser_scale_base * user_scale_in){
276 _user_scale = user_scale_in;
277 }
278
280 const Cuser_scale_base * user_scale() const { return _user_scale; }
281
282
284 // main parts of the algorithm //
286
297
305 int add_protocones(std::vector<CSphmomentum> *protocones, double R2, double Emin=0.0);
306
317 int add_hardest_protocone_to_jets(std::vector<CSphmomentum> *protocones, double R2, double Emin=0.0);
318
328 int perform(double overlap_tshold, double Emin=0.0);
329
330
332 // save and debug functions //
334
337 int save_contents(FILE *flux);
338
340 int show();
341
342 // particle information
343 int n;
344 std::vector<CSphmomentum> particles;
345 std::vector<double> particles_norm2;
346 int n_left;
347 std::vector<CSphmomentum> p_remain;
348 std::vector<CSphmomentum> p_uncol_hard;
349 int n_pass;
350
355
356 // jets information
357 std::vector<CSphjet> jets;
358
359 // working entries
360 int *indices;
362
372
375
383
392
393 private:
401 bool get_overlap(const CSphjet &j1, const CSphjet &j2, double *v);
402
403
415 bool split(cjet_iterator &it_j1, cjet_iterator &it_j2);
416
425 bool merge(cjet_iterator &it_j1, cjet_iterator &it_j2);
426
433 bool insert(CSphjet &jet);
434
441 double get_sm_var2(CSphmomentum &v, double &E_tilde);
442
444 void compute_Etilde(CSphjet &j);
445
446 // jet information
448#ifdef SISCONE_USES_UNIQUE_PTR_AS_AUTO_PTR
449 std::unique_ptr<std::multiset<CSphjet,CSphsplit_merge_ptcomparison> > candidates;
450#else
451 std::auto_ptr<std::multiset<CSphjet,CSphsplit_merge_ptcomparison> > candidates;
452#endif
453
455 double E_min;
456
462 bool use_E_weighted_splitting;
463
466 const Cuser_scale_base *_user_scale;
467
468#ifdef ALLOW_MERGE_IDENTICAL_PROTOCONES
470 std::set<siscone::Creference> cand_refs;
471#endif
472};
473
474}
475
476
477#endif
real Jet information.
Definition: split_merge.h:56
int pass
pass at which the jet has been found It starts at 0 (first pass), -1 means infinite rapidity (it will...
Definition: split_merge.h:89
double sm_var2
ordering variable used for ordering and overlap in the split–merge.
Definition: split_merge.h:80
double E_tilde
sum of E_i [ 1 +|p_i x p_J|^2/(|p_i|^2 E_J^2)]
Definition: split_merge.h:65
CSphmomentum v
jet momentum
Definition: split_merge.h:64
std::vector< int > contents
particle contents (list of indices)
Definition: split_merge.h:67
CSphtheta_phi_range range
covered range in eta-phi
Definition: split_merge.h:83
int n
number of particles inside
Definition: split_merge.h:66
base class for dynamic coordinates management
Definition: momentum.h:158
base class for user-defined ordering of stable cones
Definition: split_merge.h:245
virtual bool is_larger(const CSphjet &a, const CSphjet &b) const
returns true when the scale associated with jet a is larger than the scale associated with jet b
Definition: split_merge.h:266
virtual double operator()(const CSphjet &jet) const =0
the scale associated with a given jet
a class that allows us to carry out comparisons of pt of jets, using information from exact particle ...
Definition: split_merge.h:119
std::vector< CSphmomentum > * particles
pointer to the list of particles
Definition: split_merge.h:129
bool operator()(const CSphjet &jet1, const CSphjet &jet2) const
comparison of 2 CSphjet
Definition: split_merge.cpp:96
Esplit_merge_scale split_merge_scale
the following parameter controls the variable we're using for the split-merge process i....
Definition: split_merge.h:158
std::vector< double > * particles_norm2
pointer to the particles's norm^2
Definition: split_merge.h:130
void get_difference(const CSphjet &j1, const CSphjet &j2, CSphmomentum *v, double *E_tilde) const
get the difference between 2 jets, calculated such that rounding errors will not affect the result ev...
std::string SM_scale_name() const
return the name corresponding to the SM scale variable
Definition: split_merge.h:126
Class used to split and merge jets.
Definition: split_merge.h:175
double stable_cone_soft_E2_cutoff
Energy cutoff for the particles to put in p_uncol_hard this is meant to allow removing soft particles...
Definition: split_merge.h:391
int show()
show jets/candidates status
int idx_size
number of elements in indices1
Definition: split_merge.h:361
int perform(double overlap_tshold, double Emin=0.0)
really do the splitting and merging At the end, the vector jets is filled with the jets found.
int partial_clear()
partial clearance
double most_ambiguous_split
minimal difference in squared distance between a particle and two overlapping protojets when doing a ...
Definition: split_merge.h:354
int n
number of particles
Definition: split_merge.h:343
double SM_var2_hardest_cut_off
stop split–merge or progressive-removal when the squared SM_var of the hardest protojet is below this...
Definition: split_merge.h:382
int add_hardest_protocone_to_jets(std::vector< CSphmomentum > *protocones, double R2, double Emin=0.0)
remove the hardest protocone and declare it a a jet
std::vector< double > particles_norm2
norm^2 of the particle (3-vect part)
Definition: split_merge.h:345
int init_pleft()
build initial list of left particles
int init(std::vector< CSphmomentum > &_particles, std::vector< CSphmomentum > *protocones, double R2, double Emin=0.0)
initialisation function
std::vector< CSphmomentum > p_remain
list of particles remaining to deal with
Definition: split_merge.h:347
const Cuser_scale_base * user_scale() const
return the user-defined scale (NULL if none)
Definition: split_merge.h:280
void set_user_scale(const Cuser_scale_base *user_scale_in)
associate a user-defined scale to order the stable cones
Definition: split_merge.h:275
int save_contents(FILE *flux)
save final jets
int merge_collinear_and_remove_soft()
build the list 'p_uncol_hard' from p_remain by clustering collinear particles note that thins in only...
std::vector< CSphmomentum > p_uncol_hard
list of particles remaining with collinear clustering
Definition: split_merge.h:348
int init_particles(std::vector< CSphmomentum > &_particles)
initialisation function for particle list
bool merge_identical_protocones
The following flag indicates that identical protocones are to be merged automatically each time aroun...
Definition: split_merge.h:371
int n_left
numer of particles that does not belong to any jet
Definition: split_merge.h:346
int set_E_weighted_splitting(bool _use_E_weighted_splitting)
use an energy-dependent boundary for splitting When called with true, the criterium for splitting two...
Definition: split_merge.h:221
int * indices
maximal size array for indices works
Definition: split_merge.h:360
std::vector< CSphmomentum > particles
list of particles
Definition: split_merge.h:344
std::vector< CSphjet > jets
list of jets
Definition: split_merge.h:357
CSphsplit_merge_ptcomparison ptcomparison
member used for detailed comparisons of pt's
Definition: split_merge.h:374
int add_protocones(std::vector< CSphmomentum > *protocones, double R2, double Emin=0.0)
add a list of protocones
class for holding a covering range in eta-phi
Definition: geom_2d.h:52

The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Tue Jun 20 2023 18:08:37 for SISCone by  Doxygen 1.9.4