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 
95  SM_mt,
96 
97  SM_pttilde
98 
99 };
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 
394  std::set<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