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
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...
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
int n
number of particles inside
Definition: split_merge.h:63
std::vector< double > particles_norm2
norm^2 of the particle (3-vect part)
Definition: split_merge.h:282
std::string SM_scale_name() const
return the name corresponding to the SM scale variable
Definition: split_merge.h:121
std::vector< CSphmomentum > particles
list of particles
Definition: split_merge.h:281
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
a class that allows us to carry out comparisons of pt of jets, using information from exact particle ...
Definition: split_merge.h:114
bool operator()(const CSphjet &jet1, const CSphjet &jet2) const
comparison of 2 CSphjet
Definition: split_merge.cpp:94
double sm_var2
ordering variable used for ordering and overlap in the split–merge.
Definition: split_merge.h:77
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 > * particles
pointer to the list of particles
Definition: split_merge.h:124
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
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
std::vector< CSphjet > jets
list of jets
Definition: split_merge.h:294
bool merge_identical_protocones
The following flag indicates that identical protocones are to be merged automatically each time aroun...
Definition: split_merge.h:308
int * indices
maximal size array for indices works
Definition: split_merge.h:297
Class used to split and merge jets.
Definition: split_merge.h:170
int init_particles(std::vector< CSphmomentum > &_particles)
initialisation function for particle list
int save_contents(FILE *flux)
save final jets
int n
number of particles
Definition: split_merge.h:280
CSphtheta_phi_range range
covered range in eta-phi
Definition: split_merge.h:80
double most_ambiguous_split
minimal difference in squared distance between a particle and two overlapping protojets when doing a ...
Definition: split_merge.h:291
CSphsplit_merge_ptcomparison ptcomparison
member used for detailed comparisons of pt's
Definition: split_merge.h:311
int add_protocones(std::vector< CSphmomentum > *protocones, double R2, double Emin=0.0)
add a list of protocones
CSphmomentum v
jet momentum
Definition: split_merge.h:61
class for holding a covering range in eta-phi
Definition: geom_2d.h:52
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
std::vector< CSphmomentum > p_uncol_hard
list of particles remaining with collinear clustering
Definition: split_merge.h:285
int init(std::vector< CSphmomentum > &_particles, std::vector< CSphmomentum > *protocones, double R2, double Emin=0.0)
initialisation function
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
std::vector< CSphmomentum > p_remain
list of particles remaining to deal with
Definition: split_merge.h:284
std::vector< int > contents
particle contents (list of indices)
Definition: split_merge.h:64
int show()
show jets/candidates status
int partial_clear()
partial clearance
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 idx_size
number of elements in indices1
Definition: split_merge.h:298
int init_pleft()
build initial list of left particles
base class for dynamic coordinates management
Definition: momentum.h:158
real Jet information.
Definition: split_merge.h:53
std::vector< double > * particles_norm2
pointer to the particles's norm^2
Definition: split_merge.h:125
int n_left
numer of particles that does not belong to any jet
Definition: split_merge.h:283
The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Sun Sep 20 2015 01:33:14 for SISCone by  Doxygen 1.8.9.1