1 #ifndef __FASTJET_BACKGROUND_ESTIMATOR_HH__
2 #define __FASTJET_BACKGROUND_ESTIMATOR_HH__
34 #include <fastjet/ClusterSequenceAreaBase.hh>
35 #include <fastjet/AreaDefinition.hh>
36 #include <fastjet/FunctionOfPseudoJet.hh>
37 #include <fastjet/Selector.hh>
38 #include <fastjet/tools/BackgroundEstimatorBase.hh>
41 FASTJET_BEGIN_NAMESPACE
126 _enable_rho_m(true){ reset(); }
141 virtual void set_particles(
const std::vector<PseudoJet> & particles);
165 void set_jets(
const std::vector<PseudoJet> &jets);
169 _rho_range = rho_range_selector;
188 double sigma()
const;
215 virtual double rho_m()
const;
221 virtual double sigma_m()
const;
224 virtual double rho_m(
const PseudoJet & );
227 virtual double sigma_m(
const PseudoJet & );
237 virtual bool has_rho_m()
const {
return _enable_rho_m && (_jet_density_class == 0);}
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.");
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.");
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.");
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]);
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.");
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.");
313 return _n_empty_jets;
339 _use_area_4vector = use_it;
351 _provide_fj2_sigma = provide_fj2_sigma;
366 return _jet_density_class;
378 BackgroundEstimatorBase::set_rescaling_class(rescaling_class_in);
389 std::string description()
const;
397 void _compute()
const;
401 void _recompute_if_needed()
const {
402 if (!_uptodate) _compute();
413 void _recompute_if_needed(
const PseudoJet &jet);
417 void _check_csa_alive()
const;
422 void _check_jet_alg_good_for_median()
const;
426 JetDefinition _jet_def;
427 AreaDefinition _area_def;
428 std::vector<PseudoJet> _included_jets;
431 bool _use_area_4vector;
432 bool _provide_fj2_sigma;
433 const FunctionOfPseudoJet<double> * _jet_density_class;
439 mutable double _sigma;
440 mutable double _rho_m;
441 mutable double _sigma_m;
442 mutable double _mean_area;
443 mutable unsigned int _n_jets_used;
444 mutable double _n_empty_jets;
445 mutable double _empty_area;
448 SharedPtr<PseudoJetStructureBase> _csi;
449 PseudoJet _current_reference;
450 mutable bool _uptodate;
453 static LimitedWarning _warnings;
454 static LimitedWarning _warnings_zero_area;
455 static LimitedWarning _warnings_preliminary;
471 virtual std::string
description()
const {
return "BackgroundJetPtDensity";}
492 virtual double result(
const PseudoJet & jet)
const;
494 virtual std::string description()
const;
513 std::vector<PseudoJet> constituents = jet.
constituents();
514 double scalar_ptm = 0;
515 for (
unsigned i = 0; i < constituents.size(); i++) {
516 scalar_ptm += constituents[i].mperp() - constituents[i].perp();
518 return scalar_ptm / jet.
area();
521 virtual std::string
description()
const {
return "BackgroundPtMDensity";}
526 FASTJET_END_NAMESPACE
528 #endif // __BACKGROUND_ESTIMATOR_HH__