CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/RecoJets/JetProducers/interface/BackgroundEstimator.h

Go to the documentation of this file.
00001 #ifndef __FASTJET_BACKGROUND_EXTRACTOR_HH__
00002 #define __FASTJET_BACKGROUND_EXTRACTOR_HH__
00003 
00004 #include <fastjet/ClusterSequenceAreaBase.hh>
00005 #include <fastjet/RangeDefinition.hh>
00006 #include <iostream>
00007 
00008 namespace fastjet{
00009 
00010 
00042  class BackgroundEstimator{
00043 public:
00047   BackgroundEstimator(const ClusterSequenceAreaBase &csa, const RangeDefinition &range);
00048   
00050   ~BackgroundEstimator();
00051 
00052   // retrieving information
00053   //-----------------------  
00054 
00056   double median_rho(){ 
00057     _recompute_if_needed();
00058     return _median_rho;
00059   }
00060 
00062   double rho() {return median_rho();}
00063 
00065   double sigma() {
00066     _recompute_if_needed();
00067     return _sigma;
00068   }
00069   
00071   double mean_area(){
00072     _recompute_if_needed();
00073     return _mean_area;
00074   }
00075   
00077   unsigned int n_jets_used(){
00078     _recompute_if_needed();
00079     return _n_jets_used;
00080   }
00081   
00084   unsigned int n_jets_excluded(){
00085     _recompute_if_needed();
00086     return _n_jets_excluded;
00087   }
00088   
00092   double n_empty_jets(){
00093     _recompute_if_needed();
00094     return _n_empty_jets;
00095   }
00096 
00099   double empty_area(){
00100     _recompute_if_needed();
00101     return _empty_area;
00102   }
00103 
00104   // configuring behaviour
00105   //----------------------  
00106 
00109   void reset();
00110 
00113   void set_use_area_4vector(bool use_it = true){
00114     _use_area_4vector = use_it;
00115   }
00116   
00125   void set_included_jets(const std::vector<PseudoJet> &included_jets, bool all_from_inclusive = true){
00126     _included_jets = included_jets;
00127     _all_from_inclusive = all_from_inclusive;
00128     _uptodate = false;
00129   }
00130   
00133   void set_excluded_jets(const std::vector<PseudoJet> &excluded_jets){
00134     _excluded_jets = excluded_jets;
00135     _uptodate = false;  
00136   }
00137   
00138 private:
00140   void _compute();
00141   
00144   void _recompute_if_needed(){
00145     if (!_uptodate)
00146       _compute();
00147     _uptodate = true;
00148   }
00149   
00150   // the information needed to do the computation
00151   const ClusterSequenceAreaBase &_csa;      
00152   const RangeDefinition &_range;            
00153   std::vector<PseudoJet> _included_jets;    
00154   std::vector<PseudoJet> _excluded_jets;    
00155   bool _all_from_inclusive;                 
00156   bool _use_area_4vector;
00157   
00158   // the actual results of the computation
00159   double _median_rho;                       
00160   double _sigma;                            
00161   double _mean_area;                        
00162   unsigned int _n_jets_used;                
00163   unsigned int _n_jets_excluded;            
00164   double _n_empty_jets;                     
00165   double _empty_area;                       
00166 
00167   // internal variables
00168   bool _uptodate;                           
00169 };
00170 
00171 } // namespace
00172 
00173 #endif