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 
394  std::set<siscone::Creference> cand_refs;
395 #endif
396 };
397 
398 }
399 
400 
401 #endif
The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Mon May 6 2013 04:18:17 for SISCone by  Doxygen 1.8.1.2