|
SISCone
2.0.5
|
00001 // -*- C++ -*- 00003 // File: split_merge.h // 00004 // Description: header file for splitting/merging (contains the CJet class) // 00005 // This file is part of the SISCone project. // 00006 // WARNING: this is not the main SISCone trunk but // 00007 // an adaptation to spherical coordinates // 00008 // For more details, see http://projects.hepforge.org/siscone // 00009 // // 00010 // Copyright (c) 2006-2008 Gavin Salam and Gregory Soyez // 00011 // // 00012 // This program is free software; you can redistribute it and/or modify // 00013 // it under the terms of the GNU General Public License as published by // 00014 // the Free Software Foundation; either version 2 of the License, or // 00015 // (at your option) any later version. // 00016 // // 00017 // This program is distributed in the hope that it will be useful, // 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 00020 // GNU General Public License for more details. // 00021 // // 00022 // You should have received a copy of the GNU General Public License // 00023 // along with this program; if not, write to the Free Software // 00024 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 00025 // // 00026 // $Revision:: 309 $// 00027 // $Date:: 2011-08-09 12:33:15 +0200 (Tue, 09 Aug 2011) $// 00029 00030 #ifndef __SPH_SPLIT_MERGE_H__ 00031 #define __SPH_SPLIT_MERGE_H__ 00032 00033 #include <siscone/defines.h> 00034 #include "geom_2d.h" 00035 #include "momentum.h" 00036 #include <stdio.h> 00037 #include <vector> 00038 #include <set> 00039 #include <memory> 00040 #include <string> 00041 00042 namespace siscone_spherical{ 00043 00053 class CSphjet{ 00054 public: 00056 CSphjet(); 00057 00059 ~CSphjet(); 00060 00061 CSphmomentum v; 00062 double E_tilde; 00063 int n; 00064 std::vector<int> contents; 00065 00077 double sm_var2; 00078 00080 CSphtheta_phi_range range; 00081 00084 int pass; 00085 }; 00086 00089 00091 bool jets_E_less(const CSphjet &j1, const CSphjet &j2); 00092 00093 00101 enum Esplit_merge_scale { 00102 SM_E, 00103 SM_Etilde 00104 }; 00105 00107 std::string split_merge_scale_name(Esplit_merge_scale sms); 00108 00114 class CSphsplit_merge_ptcomparison{ 00115 public: 00117 CSphsplit_merge_ptcomparison() : 00118 particles(0), split_merge_scale(SM_Etilde){}; 00119 00121 std::string SM_scale_name() const { 00122 return split_merge_scale_name(split_merge_scale);} 00123 00124 std::vector<CSphmomentum> * particles; 00125 std::vector<double> * particles_norm2; 00126 00128 bool operator()(const CSphjet &jet1, const CSphjet &jet2) const; 00129 00141 void get_difference(const CSphjet &j1, const CSphjet &j2, CSphmomentum *v, double *E_tilde) const; 00142 00153 Esplit_merge_scale split_merge_scale; 00154 }; 00155 00156 00157 // iterator types 00159 typedef std::multiset<siscone_spherical::CSphjet,CSphsplit_merge_ptcomparison>::iterator cjet_iterator; 00160 00162 typedef std::vector<siscone_spherical::CSphjet>::iterator jet_iterator; 00163 00164 00165 00170 class CSphsplit_merge{ 00171 public: 00173 CSphsplit_merge(); 00174 00176 ~CSphsplit_merge(); 00177 00178 00180 // initialisation functions // 00182 00191 int init(std::vector<CSphmomentum> &_particles, std::vector<CSphmomentum> *protocones, double R2, double Emin=0.0); 00192 00198 int init_particles(std::vector<CSphmomentum> &_particles); 00199 00203 int init_pleft(); 00204 00216 inline int set_E_weighted_splitting(bool _use_E_weighted_splitting){ 00217 use_E_weighted_splitting = _use_E_weighted_splitting; 00218 return 0; 00219 } 00220 00222 // cleaning functions // 00224 00226 int partial_clear(); 00227 00229 int full_clear(); 00230 00231 00233 // main parts of the algorithm // 00235 00245 int merge_collinear_and_remove_soft(); 00246 00254 int add_protocones(std::vector<CSphmomentum> *protocones, double R2, double Emin=0.0); 00255 00265 int perform(double overlap_tshold, double Emin=0.0); 00266 00267 00269 // save and debug functions // 00271 00274 int save_contents(FILE *flux); 00275 00277 int show(); 00278 00279 // particle information 00280 int n; 00281 std::vector<CSphmomentum> particles; 00282 std::vector<double> particles_norm2; 00283 int n_left; 00284 std::vector<CSphmomentum> p_remain; 00285 std::vector<CSphmomentum> p_uncol_hard; 00286 int n_pass; 00287 00291 double most_ambiguous_split; 00292 00293 // jets information 00294 std::vector<CSphjet> jets; 00295 00296 // working entries 00297 int *indices; 00298 int idx_size; 00299 00308 bool merge_identical_protocones; 00309 00311 CSphsplit_merge_ptcomparison ptcomparison; 00312 00318 double SM_var2_hardest_cut_off; 00319 00323 double stable_cone_soft_E2_cutoff; 00324 00325 private: 00333 bool get_overlap(const CSphjet &j1, const CSphjet &j2, double *v); 00334 00335 00347 bool split(cjet_iterator &it_j1, cjet_iterator &it_j2); 00348 00357 bool merge(cjet_iterator &it_j1, cjet_iterator &it_j2); 00358 00365 bool insert(CSphjet &jet); 00366 00373 double get_sm_var2(CSphmomentum &v, double &E_tilde); 00374 00376 void compute_Etilde(CSphjet &j); 00377 00378 // jet information 00380 std::auto_ptr<std::multiset<CSphjet,CSphsplit_merge_ptcomparison> > candidates; 00381 00383 double E_min; 00384 00390 bool use_E_weighted_splitting; 00391 00392 #ifdef ALLOW_MERGE_IDENTICAL_PROTOCONES 00393 00394 std::set<siscone::Creference> cand_refs; 00395 #endif 00396 }; 00397 00398 } 00399 00400 00401 #endif