00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027
00028 #ifndef __SPLIT_MERGE_H__
00029 #define __SPLIT_MERGE_H__
00030
00031 #include "defines.h"
00032 #include "geom_2d.h"
00033 #include "momentum.h"
00034 #include <stdio.h>
00035 #include <vector>
00036 #include <set>
00037 #include <memory>
00038 #include <string>
00039
00040 namespace siscone{
00041
00051 class Cjet{
00052 public:
00054 Cjet();
00055
00057 ~Cjet();
00058
00059 Cmomentum v;
00060 double pt_tilde;
00061 int n;
00062 std::vector<int> contents;
00063
00070 double sm_var2;
00071
00073 Ceta_phi_range range;
00074
00077 int pass;
00078 };
00079
00081 bool jets_pt_less(const Cjet &j1, const Cjet &j2);
00082
00083
00091 enum Esplit_merge_scale {
00092 SM_pt,
00093 SM_Et,
00094
00095 SM_mt,
00096
00097 SM_pttilde
00098
00099 };
00100
00102 std::string split_merge_scale_name(Esplit_merge_scale sms);
00103
00110 class Csplit_merge_ptcomparison{
00111 public:
00112 Csplit_merge_ptcomparison() :
00113 particles(0), split_merge_scale(SM_pttilde){};
00114
00115
00116 std::string SM_scale_name() const {
00117 return split_merge_scale_name(split_merge_scale);}
00118
00119 std::vector<Cmomentum> * particles;
00120 std::vector<double> * pt;
00121 bool operator()(const Cjet &jet1, const Cjet &jet2) const;
00122
00134 void get_difference(const Cjet &j1, const Cjet &j2, Cmomentum *v, double *pt_tilde) const;
00135
00154 Esplit_merge_scale split_merge_scale;
00155 };
00156
00157
00158
00160 typedef std::multiset<siscone::Cjet,Csplit_merge_ptcomparison>::iterator cjet_iterator;
00161
00163 typedef std::vector<siscone::Cjet>::iterator jet_iterator;
00164
00165
00166
00171 class Csplit_merge{
00172 public:
00174 Csplit_merge();
00175
00177 ~Csplit_merge();
00178
00179
00181
00183
00192 int init(std::vector<Cmomentum> &_particles, std::vector<Cmomentum> *protocones, double R2, double ptmin=0.0);
00193
00199 int init_particles(std::vector<Cmomentum> &_particles);
00200
00204 int init_pleft();
00205
00206
00208
00210
00212 int partial_clear();
00213
00215 int full_clear();
00216
00217
00219
00221
00229 int merge_collinear_and_remove_soft();
00230
00238 int add_protocones(std::vector<Cmomentum> *protocones, double R2, double ptmin=0.0);
00239
00249 int perform(double overlap_tshold, double ptmin=0.0);
00250
00251
00253
00255
00258 int save_contents(FILE *flux);
00259
00261 int show();
00262
00263
00264 int n;
00265 std::vector<Cmomentum> particles;
00266 std::vector<double> pt;
00267 int n_left;
00268 std::vector<Cmomentum> p_remain;
00269 std::vector<Cmomentum> p_uncol_hard;
00270 int n_pass;
00271
00275 double most_ambiguous_split;
00276
00277
00278 std::vector<Cjet> jets;
00279
00280
00281 int *indices;
00282 int idx_size;
00283
00292 bool merge_identical_protocones;
00293
00295 Csplit_merge_ptcomparison ptcomparison;
00296
00302 double SM_var2_hardest_cut_off;
00303
00307 double stable_cone_soft_pt2_cutoff;
00308
00309 private:
00317 bool get_overlap(const Cjet &j1, const Cjet &j2, double *v);
00318
00319
00331 bool split(cjet_iterator &it_j1, cjet_iterator &it_j2);
00332
00341 bool merge(cjet_iterator &it_j1, cjet_iterator &it_j2);
00342
00349 bool insert(Cjet &jet);
00350
00357 double get_sm_var2(Cmomentum &v, double &pt_tilde);
00358
00359
00361 std::auto_ptr<std::multiset<Cjet,Csplit_merge_ptcomparison> > candidates;
00362
00364 double pt_min2;
00365
00366 #ifdef ALLOW_MERGE_IDENTICAL_PROTOCONES
00368 std::set<Creference> cand_refs;
00369 #endif
00370 };
00371
00372 }
00373
00374
00375 #endif