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 // For more details, see http://projects.hepforge.org/siscone //
7 // //
8 // Copyright (c) 2006 Gavin Salam and Gregory Soyez //
9 // //
10 // This program is free software; you can redistribute it and/or modify //
11 // it under the terms of the GNU General Public License as published by //
12 // the Free Software Foundation; either version 2 of the License, or //
13 // (at your option) any later version. //
14 // //
15 // This program is distributed in the hope that it will be useful, //
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
18 // GNU General Public License for more details. //
19 // //
20 // You should have received a copy of the GNU General Public License //
21 // along with this program; if not, write to the Free Software //
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
23 // //
24 // $Revision:: 268 $//
25 // $Date:: 2009-03-12 21:24:16 +0100 (Thu, 12 Mar 2009) $//
27 
28 #ifndef __SPLIT_MERGE_H__
29 #define __SPLIT_MERGE_H__
30 
31 #include "defines.h"
32 #include "geom_2d.h"
33 #include "momentum.h"
34 #include <stdio.h>
35 #include <vector>
36 #include <set>
37 #include <memory>
38 #include <string>
39 
40 namespace siscone{
41 
51 class Cjet{
52  public:
54  Cjet();
55 
57  ~Cjet();
58 
60  double pt_tilde;
61  int n;
62  std::vector<int> contents;
63 
70  double sm_var2;
71 
74 
77  int pass;
78 };
79 
81 bool jets_pt_less(const Cjet &j1, const Cjet &j2);
82 
83 
91 enum Esplit_merge_scale {
92  SM_pt,
93  SM_Et,
94  SM_mt,
96  SM_pttilde
98 };
100 
102 std::string split_merge_scale_name(Esplit_merge_scale sms);
103 
112 public:
115  particles(0), split_merge_scale(SM_pttilde){};
116 
118  std::string SM_scale_name() const {
119  return split_merge_scale_name(split_merge_scale);}
120 
121  std::vector<Cmomentum> * particles;
122  std::vector<double> * pt;
123 
125  bool operator()(const Cjet &jet1, const Cjet &jet2) const;
126 
138  void get_difference(const Cjet &j1, const Cjet &j2, Cmomentum *v, double *pt_tilde) const;
139 
158  Esplit_merge_scale split_merge_scale;
159 };
160 
161 
162 // iterator types
164 typedef std::multiset<siscone::Cjet,Csplit_merge_ptcomparison>::iterator cjet_iterator;
165 
167 typedef std::vector<siscone::Cjet>::iterator jet_iterator;
168 
169 
170 
176  public:
178  Csplit_merge();
179 
181  ~Csplit_merge();
182 
183 
185  // initialisation functions //
187 
196  int init(std::vector<Cmomentum> &_particles, std::vector<Cmomentum> *protocones, double R2, double ptmin=0.0);
197 
203  int init_particles(std::vector<Cmomentum> &_particles);
204 
208  int init_pleft();
209 
221  inline int set_pt_weighted_splitting(bool _use_pt_weighted_splitting){
222  use_pt_weighted_splitting = _use_pt_weighted_splitting;
223  return 0;
224  }
225 
227  // cleaning functions //
229 
231  int partial_clear();
232 
234  int full_clear();
235 
236 
238  // main parts of the algorithm //
240 
249 
257  int add_protocones(std::vector<Cmomentum> *protocones, double R2, double ptmin=0.0);
258 
268  int perform(double overlap_tshold, double ptmin=0.0);
269 
270 
272  // save and debug functions //
274 
277  int save_contents(FILE *flux);
278 
280  int show();
281 
282  // particle information
283  int n;
284  std::vector<Cmomentum> particles;
285  std::vector<double> pt;
286  int n_left;
287  std::vector<Cmomentum> p_remain;
288  std::vector<Cmomentum> p_uncol_hard;
289  int n_pass;
290 
295 
296  // jets information
297  std::vector<Cjet> jets;
298 
299  // working entries
300  int *indices;
301  int idx_size;
302 
312 
315 
322 
327 
328  private:
336  bool get_overlap(const Cjet &j1, const Cjet &j2, double *v);
337 
338 
350  bool split(cjet_iterator &it_j1, cjet_iterator &it_j2);
351 
360  bool merge(cjet_iterator &it_j1, cjet_iterator &it_j2);
361 
368  bool insert(Cjet &jet);
369 
376  double get_sm_var2(Cmomentum &v, double &pt_tilde);
377 
378  // jet information
380  std::auto_ptr<std::multiset<Cjet,Csplit_merge_ptcomparison> > candidates;
381 
383  double pt_min2;
384 
390  bool use_pt_weighted_splitting;
391 
392 #ifdef ALLOW_MERGE_IDENTICAL_PROTOCONES
393  std::set<Creference> cand_refs;
395 #endif
396 };
397 
398 }
399 
400 
401 #endif
int n_left
numer of particles that does not belong to any jet
Definition: split_merge.h:286
std::vector< Cmomentum > particles
list of particles
Definition: split_merge.h:284
comparison of jets for split–merge ordering
Definition: split_merge.h:111
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:321
std::vector< Cjet > jets
list of jets
Definition: split_merge.h:297
bool merge_identical_protocones
The following flag indicates that identical protocones are to be merged automatically each time aroun...
Definition: split_merge.h:311
~Cjet()
default dtor
Definition: split_merge.cpp:60
real Jet information.
Definition: split_merge.h:51
double stable_cone_soft_pt2_cutoff
pt cutoff for the particles to put in p_uncol_hard this is meant to allow removing soft particles in ...
Definition: split_merge.h:326
int * indices
maximal size array for indices works
Definition: split_merge.h:300
base class for dynamic coordinates management
Definition: momentum.h:49
int perform(double overlap_tshold, double ptmin=0.0)
really do the splitting and merging At the end, the vector jets is filled with the jets found...
int merge_collinear_and_remove_soft()
build the list 'p_uncol_hard' from p_remain by clustering collinear particles and removing particles ...
std::vector< Cmomentum > p_remain
list of particles remaining to deal with
Definition: split_merge.h:287
int pass
pass at which the jet has been found It starts at 0 (first pass), -1 means infinite rapidity ...
Definition: split_merge.h:77
int init_particles(std::vector< Cmomentum > &_particles)
initialisation function for particle list
int save_contents(FILE *flux)
save final jets
int init_pleft()
build initial list of left particles
std::vector< double > pt
list of particles' pt
Definition: split_merge.h:285
Csplit_merge_ptcomparison()
default ctor
Definition: split_merge.h:114
int add_protocones(std::vector< Cmomentum > *protocones, double R2, double ptmin=0.0)
add a list of protocones
Cmomentum v
jet momentum
Definition: split_merge.h:59
Csplit_merge_ptcomparison ptcomparison
member used for detailed comparisons of pt's
Definition: split_merge.h:314
std::vector< Cmomentum > p_uncol_hard
list of particles remaining with collinear clustering
Definition: split_merge.h:288
double sm_var2
ordering variable used for ordering and overlap in the split–merge.
Definition: split_merge.h:70
int idx_size
number of elements in indices1
Definition: split_merge.h:301
Definition: area.cpp:33
class for holding a covering range in eta-phi
Definition: geom_2d.h:120
int full_clear()
full clearance
int set_pt_weighted_splitting(bool _use_pt_weighted_splitting)
use a pt-dependent boundary for splitting When called with true, the criterium for splitting two prot...
Definition: split_merge.h:221
Cjet()
default ctor
Definition: split_merge.cpp:51
int partial_clear()
partial clearance
std::vector< Cmomentum > * particles
pointer to the list of particles
Definition: split_merge.h:121
int n
number of particles
Definition: split_merge.h:283
bool operator()(const Cjet &jet1, const Cjet &jet2) const
comparison between 2 jets
Definition: split_merge.cpp:92
Class used to split and merge jets.
Definition: split_merge.h:175
double pt_tilde
p-scheme pt
Definition: split_merge.h:60
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
int show()
show jets/candidates status
int init(std::vector< Cmomentum > &_particles, std::vector< Cmomentum > *protocones, double R2, double ptmin=0.0)
initialisation function
void get_difference(const Cjet &j1, const Cjet &j2, Cmomentum *v, double *pt_tilde) const
get the difference between 2 jets, calculated such that rounding errors will not affect the result ev...
Csplit_merge()
default ctor
~Csplit_merge()
default dtor
std::string SM_scale_name() const
return the name corresponding to the SM scale variable
Definition: split_merge.h:118
int n_pass
index of the run
Definition: split_merge.h:289
Ceta_phi_range range
covered range in eta-phi
Definition: split_merge.h:73
double most_ambiguous_split
minimal difference in squared distance between a particle and two overlapping protojets when doing a ...
Definition: split_merge.h:294
std::vector< double > * pt
pointer to the pt of the particles
Definition: split_merge.h:122
std::vector< int > contents
particle contents (list of indices)
Definition: split_merge.h:62
int n
number of particles inside
Definition: split_merge.h:61
The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Mon Oct 19 2015 20:25:39 for SISCone by  Doxygen 1.8.9.1