SISCone  2.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:: 309 $//
27 // $Date:: 2011-08-09 12:33:15 +0200 (Tue, 09 Aug 2011) $//
29 
30 #ifndef __SPH_SPLIT_MERGE_H__
31 #define __SPH_SPLIT_MERGE_H__
32 
33 #include <siscone/defines.h>
34 #include "geom_2d.h"
35 #include "momentum.h"
36 #include <stdio.h>
37 #include <vector>
38 #include <set>
39 #include <memory>
40 #include <string>
41 
42 namespace siscone_spherical{
43 
53 class CSphjet{
54  public:
56  CSphjet();
57 
59  ~CSphjet();
60 
62  double E_tilde;
63  int n;
64  std::vector<int> contents;
65 
77  double sm_var2;
78 
81 
84  int pass;
85 };
86 
89 
91 bool jets_E_less(const CSphjet &j1, const CSphjet &j2);
92 
93 
101 enum Esplit_merge_scale {
102  SM_E,
103  SM_Etilde
104 };
105 
107 std::string split_merge_scale_name(Esplit_merge_scale sms);
108 
115 public:
118  particles(0), split_merge_scale(SM_Etilde){};
119 
121  std::string SM_scale_name() const {
122  return split_merge_scale_name(split_merge_scale);}
123 
124  std::vector<CSphmomentum> * particles;
125  std::vector<double> * particles_norm2;
126 
128  bool operator()(const CSphjet &jet1, const CSphjet &jet2) const;
129 
141  void get_difference(const CSphjet &j1, const CSphjet &j2, CSphmomentum *v, double *E_tilde) const;
142 
153  Esplit_merge_scale split_merge_scale;
154 };
155 
156 
157 // iterator types
159 typedef std::multiset<siscone_spherical::CSphjet,CSphsplit_merge_ptcomparison>::iterator cjet_iterator;
160 
162 typedef std::vector<siscone_spherical::CSphjet>::iterator jet_iterator;
163 
164 
165 
171  public:
173  CSphsplit_merge();
174 
177 
178 
180  // initialisation functions //
182 
191  int init(std::vector<CSphmomentum> &_particles, std::vector<CSphmomentum> *protocones, double R2, double Emin=0.0);
192 
198  int init_particles(std::vector<CSphmomentum> &_particles);
199 
203  int init_pleft();
204 
216  inline int set_E_weighted_splitting(bool _use_E_weighted_splitting){
217  use_E_weighted_splitting = _use_E_weighted_splitting;
218  return 0;
219  }
220 
222  // cleaning functions //
224 
226  int partial_clear();
227 
229  int full_clear();
230 
231 
233  // main parts of the algorithm //
235 
246 
254  int add_protocones(std::vector<CSphmomentum> *protocones, double R2, double Emin=0.0);
255 
265  int perform(double overlap_tshold, double Emin=0.0);
266 
267 
269  // save and debug functions //
271 
274  int save_contents(FILE *flux);
275 
277  int show();
278 
279  // particle information
280  int n;
281  std::vector<CSphmomentum> particles;
282  std::vector<double> particles_norm2;
283  int n_left;
284  std::vector<CSphmomentum> p_remain;
285  std::vector<CSphmomentum> p_uncol_hard;
286  int n_pass;
287 
292 
293  // jets information
294  std::vector<CSphjet> jets;
295 
296  // working entries
297  int *indices;
298  int idx_size;
299 
309 
312 
319 
324 
325  private:
333  bool get_overlap(const CSphjet &j1, const CSphjet &j2, double *v);
334 
335 
347  bool split(cjet_iterator &it_j1, cjet_iterator &it_j2);
348 
357  bool merge(cjet_iterator &it_j1, cjet_iterator &it_j2);
358 
365  bool insert(CSphjet &jet);
366 
373  double get_sm_var2(CSphmomentum &v, double &E_tilde);
374 
376  void compute_Etilde(CSphjet &j);
377 
378  // jet information
380  std::auto_ptr<std::multiset<CSphjet,CSphsplit_merge_ptcomparison> > candidates;
381 
383  double E_min;
384 
390  bool use_E_weighted_splitting;
391 
392 #ifdef ALLOW_MERGE_IDENTICAL_PROTOCONES
393  std::set<siscone::Creference> cand_refs;
395 #endif
396 };
397 
398 }
399 
400 
401 #endif
siscone_spherical::CSphjet::~CSphjet
~CSphjet()
default dtor
Definition: split_merge.cpp:62
siscone_spherical::CSphsplit_merge::show
int show()
show jets/candidates status
Definition: split_merge.cpp:709
siscone_spherical::CSphsplit_merge::add_protocones
int add_protocones(std::vector< CSphmomentum > *protocones, double R2, double Emin=0.0)
add a list of protocones
Definition: split_merge.cpp:459
siscone_spherical::CSphsplit_merge_ptcomparison::SM_scale_name
std::string SM_scale_name() const
return the name corresponding to the SM scale variable
Definition: split_merge.h:121
siscone_spherical::CSphsplit_merge::ptcomparison
CSphsplit_merge_ptcomparison ptcomparison
member used for detailed comparisons of pt's
Definition: split_merge.h:311
siscone_spherical::CSphsplit_merge::jets
std::vector< CSphjet > jets
list of jets
Definition: split_merge.h:294
siscone_spherical::CSphsplit_merge::most_ambiguous_split
double most_ambiguous_split
minimal difference in squared distance between a particle and two overlapping protojets when doing a ...
Definition: split_merge.h:291
siscone_spherical::CSphsplit_merge::init
int init(std::vector< CSphmomentum > &_particles, std::vector< CSphmomentum > *protocones, double R2, double Emin=0.0)
initialisation function
Definition: split_merge.cpp:268
siscone_spherical::CSphsplit_merge::stable_cone_soft_E2_cutoff
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:323
siscone_spherical::CSphsplit_merge::partial_clear
int partial_clear()
partial clearance
Definition: split_merge.cpp:358
siscone_spherical::CSphsplit_merge::n
int n
number of particles
Definition: split_merge.h:280
siscone_spherical::CSphsplit_merge::merge_collinear_and_remove_soft
int merge_collinear_and_remove_soft()
build the list 'p_uncol_hard' from p_remain by clustering collinear particles note that thins in only...
Definition: split_merge.cpp:400
siscone_spherical::CSphsplit_merge::idx_size
int idx_size
number of elements in indices1
Definition: split_merge.h:298
siscone_spherical::CSphjet::n
int n
number of particles inside
Definition: split_merge.h:63
siscone_spherical::CSphsplit_merge::init_particles
int init_particles(std::vector< CSphmomentum > &_particles)
initialisation function for particle list
Definition: split_merge.cpp:277
siscone_spherical::CSphjet::sm_var2
double sm_var2
ordering variable used for ordering and overlap in the split–merge.
Definition: split_merge.h:77
siscone_spherical::CSphsplit_merge_ptcomparison::particles_norm2
std::vector< double > * particles_norm2
pointer to the particles's norm^2
Definition: split_merge.h:125
siscone_spherical::CSphsplit_merge::init_pleft
int init_pleft()
build initial list of left particles
Definition: split_merge.cpp:307
siscone_spherical::CSphsplit_merge_ptcomparison::CSphsplit_merge_ptcomparison
CSphsplit_merge_ptcomparison()
default ctor
Definition: split_merge.h:117
defines.h
siscone_spherical::CSphjet::pass
int pass
pass at which the jet has been found It starts at 0 (first pass), -1 means infinite rapidity
Definition: split_merge.h:84
siscone_spherical::CSphsplit_merge::indices
int * indices
maximal size array for indices works
Definition: split_merge.h:297
siscone_spherical::CSphsplit_merge_ptcomparison::get_difference
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...
Definition: split_merge.cpp:165
siscone_spherical::CSphsplit_merge::set_E_weighted_splitting
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:216
siscone_spherical::CSphsplit_merge::~CSphsplit_merge
~CSphsplit_merge()
default dtor
Definition: split_merge.cpp:257
siscone_spherical::CSphjet::range
CSphtheta_phi_range range
covered range in eta-phi
Definition: split_merge.h:80
siscone_spherical::CSphsplit_merge_ptcomparison::split_merge_scale
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:153
siscone_spherical::CSphjet
Definition: split_merge.h:53
siscone_spherical::CSphjet::CSphjet
CSphjet()
default ctor
Definition: split_merge.cpp:53
siscone_spherical::CSphsplit_merge_ptcomparison
Definition: split_merge.h:114
siscone_spherical::CSphsplit_merge::perform
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.
Definition: split_merge.cpp:569
siscone_spherical::CSphsplit_merge::save_contents
int save_contents(FILE *flux)
save final jets
Definition: split_merge.cpp:679
siscone_spherical::CSphsplit_merge_ptcomparison::particles
std::vector< CSphmomentum > * particles
pointer to the list of particles
Definition: split_merge.h:124
siscone_spherical::CSphsplit_merge::full_clear
int full_clear()
full clearance
Definition: split_merge.cpp:383
siscone_spherical::CSphsplit_merge::p_remain
std::vector< CSphmomentum > p_remain
list of particles remaining to deal with
Definition: split_merge.h:284
siscone_spherical::CSphjet::E_tilde
double E_tilde
sum of E_i [ 1 +|p_i x p_J|^2/(|p_i|^2 E_J^2)]
Definition: split_merge.h:62
siscone_spherical::CSphsplit_merge::p_uncol_hard
std::vector< CSphmomentum > p_uncol_hard
list of particles remaining with collinear clustering
Definition: split_merge.h:285
siscone_spherical::CSphjet::v
CSphmomentum v
jet momentum
Definition: split_merge.h:61
siscone_spherical::CSphsplit_merge
Definition: split_merge.h:170
siscone_spherical::CSphsplit_merge::merge_identical_protocones
bool merge_identical_protocones
The following flag indicates that identical protocones are to be merged automatically each time aroun...
Definition: split_merge.h:308
siscone_spherical::CSphjet::contents
std::vector< int > contents
particle contents (list of indices)
Definition: split_merge.h:64
siscone_spherical::CSphsplit_merge::n_left
int n_left
numer of particles that does not belong to any jet
Definition: split_merge.h:283
siscone_spherical::CSphmomentum
base class for dynamic coordinates management
Definition: momentum.h:158
siscone_spherical::CSphsplit_merge::n_pass
int n_pass
index of the run
Definition: split_merge.h:286
siscone_spherical::CSphsplit_merge::particles_norm2
std::vector< double > particles_norm2
norm^2 of the particle (3-vect part)
Definition: split_merge.h:282
siscone_spherical::CSphsplit_merge::particles
std::vector< CSphmomentum > particles
list of particles
Definition: split_merge.h:281
siscone_spherical::CSphsplit_merge::CSphsplit_merge
CSphsplit_merge()
default ctor
Definition: split_merge.cpp:230
siscone_spherical::CSphsplit_merge::SM_var2_hardest_cut_off
double SM_var2_hardest_cut_off
stop split–merge when the SM_var of the hardest protojet is below this cut-off.
Definition: split_merge.h:318
siscone_spherical::CSphtheta_phi_range
class for holding a covering range in eta-phi
Definition: geom_2d.h:52
siscone_spherical::CSphsplit_merge_ptcomparison::operator()
bool operator()(const CSphjet &jet1, const CSphjet &jet2) const
comparison of 2 CSphjet
Definition: split_merge.cpp:94
The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated for SISCone by  Doxygen 1.8.17