Fork me on GitHub

Ignore:
Timestamp:
Dec 9, 2014, 1:27:13 PM (10 years ago)
Author:
Michele <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
37deb3b, 9e991f8
Parents:
f6b6ee7 (diff), e7e90df (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'TestFastJet310b1'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/tools/JetMedianBackgroundEstimator.hh

    rf6b6ee7 r49234af  
    22#define __FASTJET_BACKGROUND_ESTIMATOR_HH__
    33
    4 //STARTHEADER
    5 // $Id: JetMedianBackgroundEstimator.hh 2689 2011-11-14 14:51:06Z soyez $
     4//FJSTARTHEADER
     5// $Id: JetMedianBackgroundEstimator.hh 3517 2014-08-01 14:23:13Z soyez $
    66//
    7 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
     7// Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
    88//
    99//----------------------------------------------------------------------
     
    1616//
    1717//  The algorithms that underlie FastJet have required considerable
    18 //  development and are described in hep-ph/0512210. If you use
     18//  development. They are described in the original FastJet paper,
     19//  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
    1920//  FastJet as part of work towards a scientific publication, please
    20 //  include a citation to the FastJet paper.
     21//  quote the version you use and include a citation to the manual and
     22//  optionally also to hep-ph/0512210.
    2123//
    2224//  FastJet is distributed in the hope that it will be useful,
     
    2830//  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
    2931//----------------------------------------------------------------------
    30 //ENDHEADER
     32//FJENDHEADER
    3133
    3234#include <fastjet/ClusterSequenceAreaBase.hh>
     
    121123  ///
    122124  JetMedianBackgroundEstimator(const Selector &rho_range = SelectorIdentity())
    123     : _rho_range(rho_range), _jet_def(JetDefinition()) { reset(); }
     125    : _rho_range(rho_range), _jet_def(JetDefinition()),
     126      _enable_rho_m(true){ reset(); }
    124127 
    125128
     
    168171  }
    169172
     173  /// determine whether the automatic calculation of rho_m and sigma_m
     174  /// is enabled (by default true)
     175  void set_compute_rho_m(bool enable){ _enable_rho_m = enable;}
     176
    170177  //\}
    171178
     
    201208  virtual bool has_sigma() {return true;}
    202209
     210  //----------------------------------------------------------------
     211  // now do the same thing for rho_m and sigma_m
     212
     213  /// returns rho_m, the purely longitudinal, particle-mass-induced
     214  /// component of the background density per unit area
     215  virtual double rho_m() const;
     216
     217  /// returns sigma_m, a measure of the fluctuations in the purely
     218  /// longitudinal, particle-mass-induced component of the background
     219  /// density per unit area; must be multipled by sqrt(area) to get
     220  /// fluctuations for a region of a given area.
     221  virtual double sigma_m() const;
     222
     223  /// Returns rho_m locally at the jet position. As for rho(jet), it is non-const.
     224  virtual double rho_m(const PseudoJet & /*jet*/);
     225
     226  /// Returns sigma_m locally at the jet position. As for rho(jet), it is non-const.
     227  virtual double sigma_m(const PseudoJet & /*jet*/);
     228
     229  /// Returns true if this background estimator has support for
     230  /// determination of rho_m.
     231  ///
     232  /// In te presence of a density class, support for rho_m is
     233  /// automatically disabled
     234  ///
     235  /// Note that support for sigma_m is automatic is one has sigma and
     236  /// rho_m support.
     237  virtual bool has_rho_m() const {return _enable_rho_m && (_jet_density_class == 0);}
    203238  //\}
    204239 
     
    208243  /// Returns the mean area of the jets used to actually compute the
    209244  /// background properties in the last call of rho() or sigma()
     245  /// If the configuration has changed in the meantime, throw an error.
    210246  double mean_area() const{
    211     _recompute_if_needed();
     247    if (!_uptodate)
     248      throw Error("JetMedianBackgroundEstimator::mean_area(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime.");
     249    //_recompute_if_needed();
    212250    return _mean_area;
    213251  }
     
    215253  /// returns the number of jets used to actually compute the
    216254  /// background properties in the last call of rho() or sigma()
     255  /// If the configuration has changed in the meantime, throw an error.
    217256  unsigned int n_jets_used() const{
    218     _recompute_if_needed();
     257    if (!_uptodate)
     258      throw Error("JetMedianBackgroundEstimator::n_jets_used(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime.");
     259    //_recompute_if_needed();
    219260    return _n_jets_used;
     261  }
     262
     263  /// returns the jets used to actually compute the background
     264  /// properties
     265  std::vector<PseudoJet> jets_used() const{
     266    if (!_uptodate) throw Error("JetMedianBackgroundEstimator::n_jets_used(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime.");
     267    _check_csa_alive();
     268    std::vector<PseudoJet> tmp_jets = _rho_range(_included_jets);
     269    std::vector<PseudoJet> used_jets;
     270    for (unsigned int i=0; i<tmp_jets.size(); i++){
     271      if (tmp_jets[i].area()>0) used_jets.push_back(tmp_jets[i]);
     272    }
     273    return used_jets;
    220274  }
    221275
     
    223277  /// the selector) that is not occupied by jets. The value is that
    224278  /// for the last call of rho() or sigma()
     279  /// If the configuration has changed in the meantime, throw an error.
    225280  ///
    226281  /// The answer is defined to be zero if the area calculation
     
    234289  /// call to the ClusterSequenceAreaBase function.
    235290  double empty_area() const{
    236     _recompute_if_needed();
     291    if (!_uptodate)
     292      throw Error("JetMedianBackgroundEstimator::empty_area(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime.");
     293    //_recompute_if_needed();
    237294    return _empty_area;
    238295  }
     
    241298  /// background properties. The value is that for the last call of
    242299  /// rho() or sigma().
     300  /// If the configuration has changed in the meantime, throw an error.
    243301  ///
    244302  /// If the area has explicit ghosts the result is zero; for active
     
    250308  /// call to the ClusterSequenceAreaBase function.
    251309  double n_empty_jets() const{
    252     _recompute_if_needed();
     310    if (!_uptodate)
     311      throw Error("JetMedianBackgroundEstimator::n_empty_jets(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime.");
     312    //_recompute_if_needed();
    253313    return _n_empty_jets;
    254314  }
     
    361421  /// Issue a warning otherwise
    362422  void _check_jet_alg_good_for_median() const;
    363  
     423
    364424  // the basic parameters of this class (passed through the variou ctors)
    365425  Selector _rho_range;                   ///< range to compute the background in
     
    368428  std::vector<PseudoJet> _included_jets; ///< jets to be used
    369429 
    370   // the tunable aprameters of the class
     430  // the tunable parameters of the class
    371431  bool _use_area_4vector;
    372432  bool _provide_fj2_sigma;
    373433  const FunctionOfPseudoJet<double> * _jet_density_class;
    374434  //SharedPtr<BackgroundRescalingBase> _rescaling_class_sharedptr;
     435  bool _enable_rho_m;
    375436 
    376437  // the actual results of the computation
    377438  mutable double _rho;               ///< background estimated density per unit area
    378439  mutable double _sigma;             ///< background estimated fluctuations
     440  mutable double _rho_m;             ///< "mass" background estimated density per unit area
     441  mutable double _sigma_m;           ///< "mass" background estimated fluctuations
    379442  mutable double _mean_area;         ///< mean area of the jets used to estimate the background
    380443  mutable unsigned int _n_jets_used; ///< number of jets used to estimate the background
     
    429492  virtual double result(const PseudoJet & jet) const;
    430493
    431   virtual std::string description() const {return "BackgroundScalarJetPtDensity";}
     494  virtual std::string description() const;
    432495
    433496private:
Note: See TracChangeset for help on using the changeset viewer.