SISCone  2.0.5
siscone/split_merge.h
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 // For more details, see http://projects.hepforge.org/siscone                //
00007 //                                                                           //
00008 // Copyright (c) 2006 Gavin Salam and Gregory Soyez                          //
00009 //                                                                           //
00010 // This program is free software; you can redistribute it and/or modify      //
00011 // it under the terms of the GNU General Public License as published by      //
00012 // the Free Software Foundation; either version 2 of the License, or         //
00013 // (at your option) any later version.                                       //
00014 //                                                                           //
00015 // This program is distributed in the hope that it will be useful,           //
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of            //
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             //
00018 // GNU General Public License for more details.                              //
00019 //                                                                           //
00020 // You should have received a copy of the GNU General Public License         //
00021 // along with this program; if not, write to the Free Software               //
00022 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
00023 //                                                                           //
00024 // $Revision:: 268                                                          $//
00025 // $Date:: 2009-03-12 21:24:16 +0100 (Thu, 12 Mar 2009)                     $//
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 
00111 class Csplit_merge_ptcomparison{
00112 public:
00114   Csplit_merge_ptcomparison() : 
00115     particles(0), split_merge_scale(SM_pttilde){};
00116 
00118   std::string SM_scale_name() const {
00119     return split_merge_scale_name(split_merge_scale);}
00120 
00121   std::vector<Cmomentum> * particles; 
00122   std::vector<double> * pt;           
00123 
00125   bool operator()(const Cjet &jet1, const Cjet &jet2) const;
00126 
00138   void get_difference(const Cjet &j1, const Cjet &j2, Cmomentum *v, double *pt_tilde) const;
00139 
00158   Esplit_merge_scale split_merge_scale;
00159 };
00160 
00161 
00162 // iterator types
00164 typedef std::multiset<siscone::Cjet,Csplit_merge_ptcomparison>::iterator cjet_iterator;
00165 
00167 typedef std::vector<siscone::Cjet>::iterator jet_iterator;
00168 
00169 
00170 
00175 class Csplit_merge{
00176  public:
00178   Csplit_merge();
00179 
00181   ~Csplit_merge();
00182 
00183 
00185   // initialisation functions //
00187 
00196   int init(std::vector<Cmomentum> &_particles, std::vector<Cmomentum> *protocones, double R2, double ptmin=0.0);
00197 
00203   int init_particles(std::vector<Cmomentum> &_particles);
00204 
00208   int init_pleft();
00209 
00221   inline int set_pt_weighted_splitting(bool _use_pt_weighted_splitting){
00222     use_pt_weighted_splitting = _use_pt_weighted_splitting;
00223     return 0;
00224   }
00225 
00227   // cleaning functions //
00229 
00231   int partial_clear();
00232 
00234   int full_clear();
00235 
00236 
00238   // main parts of the algorithm //
00240  
00248   int merge_collinear_and_remove_soft();
00249 
00257   int add_protocones(std::vector<Cmomentum> *protocones, double R2, double ptmin=0.0);
00258 
00268   int perform(double overlap_tshold, double ptmin=0.0);
00269 
00270 
00272   // save and debug functions //
00274 
00277   int save_contents(FILE *flux);
00278 
00280   int show();
00281 
00282   // particle information
00283   int n;                               
00284   std::vector<Cmomentum> particles;    
00285   std::vector<double> pt;              
00286   int n_left;                          
00287   std::vector<Cmomentum> p_remain;     
00288   std::vector<Cmomentum> p_uncol_hard; 
00289   int n_pass;                          
00290 
00294   double most_ambiguous_split; 
00295 
00296   // jets information
00297   std::vector<Cjet> jets;            
00298 
00299   // working entries
00300   int *indices;                      
00301   int idx_size;                      
00302 
00311   bool merge_identical_protocones;
00312 
00314   Csplit_merge_ptcomparison ptcomparison;
00315 
00321   double SM_var2_hardest_cut_off;
00322 
00326   double stable_cone_soft_pt2_cutoff;
00327 
00328  private:
00336   bool get_overlap(const Cjet &j1, const Cjet &j2, double *v);
00337 
00338 
00350   bool split(cjet_iterator &it_j1, cjet_iterator &it_j2);
00351 
00360   bool merge(cjet_iterator &it_j1, cjet_iterator &it_j2);
00361 
00368   bool insert(Cjet &jet);
00369 
00376   double get_sm_var2(Cmomentum &v, double &pt_tilde);
00377 
00378   // jet information
00380   std::auto_ptr<std::multiset<Cjet,Csplit_merge_ptcomparison> > candidates;
00381 
00383   double pt_min2;
00384 
00390   bool use_pt_weighted_splitting;
00391 
00392 #ifdef ALLOW_MERGE_IDENTICAL_PROTOCONES
00393 
00394   std::set<Creference> cand_refs;
00395 #endif
00396 };
00397 
00398 }
00399 
00400 
00401 #endif
The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Mon Jun 4 2012 18:23:38 for SISCone by  Doxygen 1.7.6.1