fastjet::ClusterSequenceAreaBase Class Reference

base class that sets interface for extensions of ClusterSequence that provide information about the area of each jet; More...

#include <ClusterSequenceAreaBase.hh>

Inheritance diagram for fastjet::ClusterSequenceAreaBase:

Inheritance graph
fastjet::ClusterSequenceActiveAreafastjet::ClusterSequenceActiveAreaExplicitGhostsfastjet::ClusterSequenceAreafastjet::ClusterSequenceVoronoiAreafastjet::ClusterSequencefastjet::ClusterSequence1GhostPassiveAreafastjet::ClusterSequencePassiveArea
[legend]
Collaboration diagram for fastjet::ClusterSequenceAreaBase:

Collaboration graph
fastjet::ClusterSequencefastjet::JetDefinitionfastjet::JetDefinition::DefaultRecombinerfastjet::JetDefinition::Recombinerfastjet::JetDefinition::PluginLimitedWarning
[legend]
List of all members.

Public Member Functions

template<class L>
 ClusterSequenceAreaBase (const std::vector< L > &pseudojets, const JetDefinition &jet_def, const bool &writeout_combinations=false)
 a constructor which just carries out the construction of the parent class
 ClusterSequenceAreaBase ()
 default constructor
virtual ~ClusterSequenceAreaBase ()
 destructor
virtual double area (const PseudoJet &jet) const
 return the area associated with the given jet; this base class returns 0.
virtual double area_error (const PseudoJet &jet) const
 return the error (uncertainty) associated with the determination of the area of this jet; this base class returns 0.
virtual PseudoJet area_4vector (const PseudoJet &jet) const
 return a PseudoJet whose 4-vector is defined by the following integral
virtual bool is_pure_ghost (const PseudoJet &jet) const
 true if a jet is made exclusively of ghosts
virtual double empty_area (const RangeDefinition &range) const
 return the total area, within range, that is free of jets.
virtual double n_empty_jets (const RangeDefinition &range) const
 return something similar to the number of pure ghost jets in the given range in an active area case.
double median_pt_per_unit_area (const RangeDefinition &range) const
 the median of (pt/area) for jets contained within range, making use also of the info on n_empty_jets
double median_pt_per_unit_area_4vector (const RangeDefinition &range) const
 the median of (pt/area_4vector) for jets contained within making use also of the info on n_empty_jets
double median_pt_per_unit_something (const RangeDefinition &range, bool use_area_4vector) const
 the median of (pt/area) for jets contained within range, counting the empty area as if it were made up of a collection of empty jets each of area (0.55 * pi R^2).
virtual void get_median_rho_and_sigma (const RangeDefinition &range, bool use_area_4vector, double &median, double &sigma, double &mean_area) const
 using jets withing range (and with 4-vector areas if use_area_4vector), calculate the median pt/area, as well as an "error" (uncertainty), which is defined as the 1-sigma half-width of the distribution of pt/A, obtained by looking for the point below which we have (1-0.6827)/2 of the jets (including empty jets).
void get_median_rho_and_sigma (const RangeDefinition &range, bool use_area_4vector, double &median, double &sigma) const
 same as the full version of get_median_rho_and_error, but without access to the mean_area
virtual void parabolic_pt_per_unit_area (double &a, double &b, const RangeDefinition &range, double exclude_above=-1.0, bool use_area_4vector=false) const
 fits a form pt_per_unit_area(y) = a + b*y^2 for jets in range.
std::vector< PseudoJetsubtracted_jets (const double rho, const double ptmin=0.0) const
 return a vector of all subtracted jets, using area_4vector, given rho.
std::vector< PseudoJetsubtracted_jets (const RangeDefinition &range, const double ptmin=0.0) const
 return a vector of subtracted jets, using area_4vector.
PseudoJet subtracted_jet (const PseudoJet &jet, const double rho) const
 return a subtracted jet, using area_4vector, given rho
PseudoJet subtracted_jet (const PseudoJet &jet, const RangeDefinition &range) const
 return a subtracted jet, using area_4vector; note that this is potentially inefficient if repeatedly used for many different jets, because rho will be recalculated each time around.
double subtracted_pt (const PseudoJet &jet, const double rho, bool use_area_4vector=false) const
 return the subtracted pt, given rho
double subtracted_pt (const PseudoJet &jet, const RangeDefinition &range, bool use_area_4vector=false) const
 return the subtracted pt; note that this is potentially inefficient if repeatedly used for many different jets, because rho will be recalculated each time around.

Private Member Functions

void _check_jet_alg_good_for_median () const
 check the jet algorithm is suitable (and if not issue a warning)

Static Private Attributes

static LimitedWarning _warnings
 allow for warnings

Detailed Description

base class that sets interface for extensions of ClusterSequence that provide information about the area of each jet;

the virtual functions here all return 0, since no area determination is implemented.

Definition at line 45 of file ClusterSequenceAreaBase.hh.


Constructor & Destructor Documentation

template<class L>
fastjet::ClusterSequenceAreaBase::ClusterSequenceAreaBase ( const std::vector< L > &  pseudojets,
const JetDefinition jet_def,
const bool &  writeout_combinations = false 
) [inline]

a constructor which just carries out the construction of the parent class

Definition at line 51 of file ClusterSequenceAreaBase.hh.

00053                                                       :
00054            ClusterSequence(pseudojets, jet_def, writeout_combinations) {}

fastjet::ClusterSequenceAreaBase::ClusterSequenceAreaBase (  )  [inline]

default constructor

Definition at line 58 of file ClusterSequenceAreaBase.hh.

00058 {}

virtual fastjet::ClusterSequenceAreaBase::~ClusterSequenceAreaBase (  )  [inline, virtual]

destructor

Definition at line 62 of file ClusterSequenceAreaBase.hh.

00062 {}


Member Function Documentation

virtual double fastjet::ClusterSequenceAreaBase::area ( const PseudoJet jet  )  const [inline, virtual]

return the area associated with the given jet; this base class returns 0.

Reimplemented in fastjet::ClusterSequenceActiveArea, fastjet::ClusterSequenceActiveAreaExplicitGhosts, fastjet::ClusterSequenceArea, and fastjet::ClusterSequenceVoronoiArea.

Definition at line 67 of file ClusterSequenceAreaBase.hh.

Referenced by empty_area(), get_median_rho_and_sigma(), parabolic_pt_per_unit_area(), print_jets(), and subtracted_pt().

00067 {return 0.0;}

virtual double fastjet::ClusterSequenceAreaBase::area_error ( const PseudoJet jet  )  const [inline, virtual]

return the error (uncertainty) associated with the determination of the area of this jet; this base class returns 0.

Reimplemented in fastjet::ClusterSequenceActiveArea, fastjet::ClusterSequenceArea, and fastjet::ClusterSequenceVoronoiArea.

Definition at line 71 of file ClusterSequenceAreaBase.hh.

Referenced by print_jets().

00071 {return 0.0;}

virtual PseudoJet fastjet::ClusterSequenceAreaBase::area_4vector ( const PseudoJet jet  )  const [inline, virtual]

return a PseudoJet whose 4-vector is defined by the following integral

drap d PseudoJet("rap,phi,pt=one") * Theta("rap,phi inside jet boundary")

where PseudoJet("rap,phi,pt=one") is a 4-vector with the given rapidity (rap), azimuth (phi) and pt=1, while Theta("rap,phi inside jet boundary") is a function that is 1 when rap,phi define a direction inside the jet boundary and 0 otherwise.

This base class returns a null 4-vector.

Reimplemented in fastjet::ClusterSequenceActiveArea, fastjet::ClusterSequenceActiveAreaExplicitGhosts, fastjet::ClusterSequenceArea, and fastjet::ClusterSequenceVoronoiArea.

Definition at line 84 of file ClusterSequenceAreaBase.hh.

Referenced by get_median_rho_and_sigma(), parabolic_pt_per_unit_area(), and subtracted_jet().

00084                                                               {
00085     return PseudoJet(0.0,0.0,0.0,0.0);}

virtual bool fastjet::ClusterSequenceAreaBase::is_pure_ghost ( const PseudoJet jet  )  const [inline, virtual]

true if a jet is made exclusively of ghosts

NB: most area classes do not give any explicit ghost jets, but some do, and they should replace this function with their own version.

Reimplemented in fastjet::ClusterSequenceActiveAreaExplicitGhosts, and fastjet::ClusterSequenceArea.

Definition at line 92 of file ClusterSequenceAreaBase.hh.

00092                                                           {
00093     return false;
00094   }

double fastjet::ClusterSequenceAreaBase::empty_area ( const RangeDefinition range  )  const [virtual]

return the total area, within range, that is free of jets.

Calculate this as (range area) - {i in range} A_i

Reimplemented in fastjet::ClusterSequenceActiveArea, fastjet::ClusterSequenceActiveAreaExplicitGhosts, fastjet::ClusterSequenceArea, and fastjet::ClusterSequencePassiveArea.

Definition at line 50 of file ClusterSequenceAreaBase.cc.

References area(), fastjet::RangeDefinition::area(), fastjet::ClusterSequence::inclusive_jets(), and fastjet::RangeDefinition::is_in_range().

Referenced by fastjet::ClusterSequencePassiveArea::empty_area(), and get_median_rho_and_sigma().

00050                                                                               {
00051   double empty = range.area();
00052   vector<PseudoJet> incl_jets(inclusive_jets(0.0));
00053   for (unsigned i = 0; i < incl_jets.size(); i++) {
00054     if (range.is_in_range(incl_jets[i])) empty -= area(incl_jets[i]);
00055   }
00056   return empty;
00057 }

virtual double fastjet::ClusterSequenceAreaBase::n_empty_jets ( const RangeDefinition range  )  const [inline, virtual]

return something similar to the number of pure ghost jets in the given range in an active area case.

For the local implementation we return empty_area/(0.55 pi R^2), based on measured properties of ghost jets with kt and cam. Note that the number returned is a double.

Reimplemented in fastjet::ClusterSequence1GhostPassiveArea, fastjet::ClusterSequenceActiveArea, and fastjet::ClusterSequenceArea.

Definition at line 104 of file ClusterSequenceAreaBase.hh.

References fastjet::pi, and fastjet::JetDefinition::R().

Referenced by get_median_rho_and_sigma().

00104                                                                    {
00105     double R = jet_def().R();
00106     return empty_area(range)/(0.55*pi*R*R);
00107   }

double fastjet::ClusterSequenceAreaBase::median_pt_per_unit_area ( const RangeDefinition range  )  const

the median of (pt/area) for jets contained within range, making use also of the info on n_empty_jets

Definition at line 59 of file ClusterSequenceAreaBase.cc.

References median_pt_per_unit_something().

Referenced by subtracted_pt().

00059                                                                                            {
00060   return median_pt_per_unit_something(range,false);
00061 }

double fastjet::ClusterSequenceAreaBase::median_pt_per_unit_area_4vector ( const RangeDefinition range  )  const

the median of (pt/area_4vector) for jets contained within making use also of the info on n_empty_jets

Definition at line 63 of file ClusterSequenceAreaBase.cc.

References median_pt_per_unit_something().

Referenced by subtracted_jet(), and subtracted_jets().

00063                                                                                                    {
00064   return median_pt_per_unit_something(range,true);
00065 }

double fastjet::ClusterSequenceAreaBase::median_pt_per_unit_something ( const RangeDefinition range,
bool  use_area_4vector 
) const

the median of (pt/area) for jets contained within range, counting the empty area as if it were made up of a collection of empty jets each of area (0.55 * pi R^2).

Definition at line 72 of file ClusterSequenceAreaBase.cc.

References get_median_rho_and_sigma().

Referenced by median_pt_per_unit_area(), and median_pt_per_unit_area_4vector().

00073                                                                             {
00074 
00075   double median, sigma, mean_area;
00076   get_median_rho_and_sigma(range, use_area_4vector, median, sigma, mean_area);
00077   return median;
00078 
00079 }

void fastjet::ClusterSequenceAreaBase::get_median_rho_and_sigma ( const RangeDefinition range,
bool  use_area_4vector,
double &  median,
double &  sigma,
double &  mean_area 
) const [virtual]

using jets withing range (and with 4-vector areas if use_area_4vector), calculate the median pt/area, as well as an "error" (uncertainty), which is defined as the 1-sigma half-width of the distribution of pt/A, obtained by looking for the point below which we have (1-0.6827)/2 of the jets (including empty jets).

The subtraction for a jet with uncorrected pt pt^U and area A is

pt^S = pt^U - median*A +- sigma*sqrt(A)

where the error is only that associated with the fluctuations in the noise and not that associated with the noise having caused changes in the hard-particle content of the jet.

(NB: subtraction may also be done with 4-vector area of course)

Reimplemented in fastjet::ClusterSequenceArea.

Definition at line 139 of file ClusterSequenceAreaBase.cc.

References _check_jet_alg_good_for_median(), area(), area_4vector(), empty_area(), fastjet::ClusterSequence::inclusive_jets(), fastjet::RangeDefinition::is_in_range(), n_empty_jets(), and fastjet::PseudoJet::perp().

Referenced by median_pt_per_unit_something().

00141                                                                        {
00142 
00143   _check_jet_alg_good_for_median();
00144 
00145   vector<double> pt_over_areas;
00146   vector<PseudoJet> incl_jets = inclusive_jets();
00147   double total_area  = 0.0;
00148   double total_njets = 0;
00149 
00150   for (unsigned i = 0; i < incl_jets.size(); i++) {
00151     if (range.is_in_range(incl_jets[i])) {
00152       double this_area;
00153       if (use_area_4vector) {
00154           this_area = area_4vector(incl_jets[i]).perp();
00155       } else {
00156           this_area = area(incl_jets[i]);
00157       }
00158       pt_over_areas.push_back(incl_jets[i].perp()/this_area);
00159       total_area  += this_area;
00160       total_njets += 1.0;
00161     }
00162   }
00163 
00164   // there is nothing inside our region, so answer will always be zero
00165   if (pt_over_areas.size() == 0) {
00166     median = 0.0;
00167     sigma  = 0.0;
00168     mean_area = 0.0;
00169     return;
00170   }
00171   
00172   // get median (pt/area) [this is the "old" median definition. It considers
00173   // only the "real" jets in calculating the median, i.e. excluding the
00174   // only-ghost ones]
00175   sort(pt_over_areas.begin(), pt_over_areas.end());
00176 
00177   // now get the median & error, accounting for empty jets
00178   // define the fractions of distribution at median, median-1sigma
00179   double posn[2] = {0.5, (1.0-0.6827)/2.0};
00180   double res[2];
00181   
00182   double n_empty = n_empty_jets(range);
00183   total_njets += n_empty;
00184   total_area  += empty_area(range);
00185 
00186   for (int i = 0; i < 2; i++) {
00187     double nj_median_pos = 
00188       (pt_over_areas.size()-1 + n_empty)*posn[i] - n_empty;
00189     double nj_median_ratio;
00190     if (nj_median_pos >= 0 && pt_over_areas.size() > 1) {
00191       int int_nj_median = int(nj_median_pos);
00192       nj_median_ratio = 
00193         pt_over_areas[int_nj_median] * (int_nj_median+1-nj_median_pos)
00194         + pt_over_areas[int_nj_median+1] * (nj_median_pos - int_nj_median);
00195     } else {
00196       nj_median_ratio = 0.0;
00197     }
00198     res[i] = nj_median_ratio;
00199   }
00200   median = res[0];
00201   double error  = res[0] - res[1];
00202   mean_area = total_area / total_njets;
00203   sigma  = error * sqrt(mean_area);
00204 }

void fastjet::ClusterSequenceAreaBase::get_median_rho_and_sigma ( const RangeDefinition range,
bool  use_area_4vector,
double &  median,
double &  sigma 
) const [inline]

same as the full version of get_median_rho_and_error, but without access to the mean_area

Definition at line 147 of file ClusterSequenceAreaBase.hh.

00149                                                                        {
00150     double mean_area;
00151     get_median_rho_and_sigma(range,  use_area_4vector,
00152                              median,  sigma, mean_area);
00153   }

void fastjet::ClusterSequenceAreaBase::parabolic_pt_per_unit_area ( double &  a,
double &  b,
const RangeDefinition range,
double  exclude_above = -1.0,
bool  use_area_4vector = false 
) const [virtual]

fits a form pt_per_unit_area(y) = a + b*y^2 for jets in range.

exclude_above allows one to exclude large values of pt/area from fit. use_area_4vector = true uses the 4vector areas.

Reimplemented in fastjet::ClusterSequenceArea.

Definition at line 86 of file ClusterSequenceAreaBase.cc.

References area(), area_4vector(), fastjet::ClusterSequence::inclusive_jets(), fastjet::RangeDefinition::is_in_range(), and fastjet::PseudoJet::perp().

00088                                                           {
00089   
00090   int n=0;
00091   int n_excluded = 0;
00092   double mean_f=0, mean_x2=0, mean_x4=0, mean_fx2=0; 
00093 
00094   vector<PseudoJet> incl_jets = inclusive_jets();
00095 
00096   for (unsigned i = 0; i < incl_jets.size(); i++) {
00097     if (range.is_in_range(incl_jets[i])) {
00098       double this_area;
00099       if ( use_area_4vector ) {
00100           this_area = area_4vector(incl_jets[i]).perp();     
00101       } else {
00102           this_area = area(incl_jets[i]);
00103       }
00104       double f = incl_jets[i].perp()/this_area;
00105       if (exclude_above <= 0.0 || f < exclude_above) {
00106         double x = incl_jets[i].rap(); double x2 = x*x;
00107         mean_f   += f;
00108         mean_x2  += x2;
00109         mean_x4  += x2*x2;
00110         mean_fx2 += f*x2;
00111         n++;
00112       } else {
00113         n_excluded++;
00114       }
00115     }
00116   }
00117 
00118   if (n <= 1) {
00119     // meaningful results require at least two jets inside the
00120     // area -- mind you if there are empty jets we should be in 
00121     // any case doing something special...
00122     a = 0.0;
00123     b = 0.0;
00124   } else {
00125     mean_f   /= n;
00126     mean_x2  /= n;
00127     mean_x4  /= n;
00128     mean_fx2 /= n;
00129     
00130     b = (mean_f*mean_x2 - mean_fx2)/(mean_x2*mean_x2 - mean_x4);
00131     a = mean_f - b*mean_x2;
00132   }
00133   //cerr << "n_excluded = "<< n_excluded << endl;
00134 }

vector< PseudoJet > fastjet::ClusterSequenceAreaBase::subtracted_jets ( const double  rho,
const double  ptmin = 0.0 
) const

return a vector of all subtracted jets, using area_4vector, given rho.

Only inclusive_jets above ptmin are subtracted and returned. the ordering is the same as that of sorted_by_pt(cs.inclusive_jets()), i.e. not necessarily ordered in pt once subtracted

Definition at line 211 of file ClusterSequenceAreaBase.cc.

References fastjet::ClusterSequence::inclusive_jets(), fastjet::ClusterSequence::jets(), fastjet::sorted_by_pt(), and subtracted_jet().

Referenced by subtracted_jets().

00213                                                                  {
00214   vector<PseudoJet> sub_jets;
00215   vector<PseudoJet> jets = sorted_by_pt(inclusive_jets(ptmin));
00216   for (unsigned i=0; i<jets.size(); i++) {
00217      PseudoJet sub_jet = subtracted_jet(jets[i],rho);
00218      sub_jets.push_back(sub_jet);
00219   }
00220   return sub_jets;
00221 }

vector< PseudoJet > fastjet::ClusterSequenceAreaBase::subtracted_jets ( const RangeDefinition range,
const double  ptmin = 0.0 
) const

return a vector of subtracted jets, using area_4vector.

Only inclusive_jets above ptmin are subtracted and returned. the ordering is the same as that of sorted_by_pt(cs.inclusive_jets()), i.e. not necessarily ordered in pt once subtracted

Definition at line 227 of file ClusterSequenceAreaBase.cc.

References median_pt_per_unit_area_4vector(), and subtracted_jets().

00230                                                        {
00231   double rho = median_pt_per_unit_area_4vector(range);
00232   return subtracted_jets(rho,ptmin);
00233 }

PseudoJet fastjet::ClusterSequenceAreaBase::subtracted_jet ( const PseudoJet jet,
const double  rho 
) const

return a subtracted jet, using area_4vector, given rho

Definition at line 237 of file ClusterSequenceAreaBase.cc.

References area_4vector(), and fastjet::PseudoJet::perp().

Referenced by subtracted_jet(), subtracted_jets(), and subtracted_pt().

00238                                                                           {
00239   PseudoJet area4vect = area_4vector(jet);
00240   PseudoJet sub_jet;
00241   // sanity check
00242   if (rho*area4vect.perp() < jet.perp() ) { 
00243     sub_jet = jet - rho*area4vect;
00244   } else { sub_jet = PseudoJet(0.0,0.0,0.0,0.0); }
00245   return sub_jet;
00246 }

PseudoJet fastjet::ClusterSequenceAreaBase::subtracted_jet ( const PseudoJet jet,
const RangeDefinition range 
) const

return a subtracted jet, using area_4vector; note that this is potentially inefficient if repeatedly used for many different jets, because rho will be recalculated each time around.

Definition at line 252 of file ClusterSequenceAreaBase.cc.

References median_pt_per_unit_area_4vector(), and subtracted_jet().

00253                                                                             {
00254   double rho = median_pt_per_unit_area_4vector(range);
00255   PseudoJet sub_jet = subtracted_jet(jet, rho);
00256   return sub_jet;
00257 }

double fastjet::ClusterSequenceAreaBase::subtracted_pt ( const PseudoJet jet,
const double  rho,
bool  use_area_4vector = false 
) const

return the subtracted pt, given rho

Definition at line 261 of file ClusterSequenceAreaBase.cc.

References area(), fastjet::PseudoJet::perp(), and subtracted_jet().

Referenced by subtracted_pt().

00263                                                                            {
00264   if ( use_area_4vector ) { 
00265      PseudoJet sub_jet = subtracted_jet(jet,rho);
00266      return sub_jet.perp();
00267   } else {
00268      return jet.perp() - rho*area(jet);
00269   }
00270 }  

double fastjet::ClusterSequenceAreaBase::subtracted_pt ( const PseudoJet jet,
const RangeDefinition range,
bool  use_area_4vector = false 
) const

return the subtracted pt; note that this is potentially inefficient if repeatedly used for many different jets, because rho will be recalculated each time around.

Definition at line 276 of file ClusterSequenceAreaBase.cc.

References median_pt_per_unit_area(), fastjet::PseudoJet::perp(), subtracted_jet(), and subtracted_pt().

00278                                                                            {
00279   if ( use_area_4vector ) { 
00280      PseudoJet sub_jet = subtracted_jet(jet,range);
00281      return sub_jet.perp();
00282   } else {
00283      double rho = median_pt_per_unit_area(range);
00284      return subtracted_pt(jet,rho,false);
00285   }
00286 }  

void fastjet::ClusterSequenceAreaBase::_check_jet_alg_good_for_median (  )  const [private]

check the jet algorithm is suitable (and if not issue a warning)

Definition at line 290 of file ClusterSequenceAreaBase.cc.

References _warnings, fastjet::cambridge_algorithm, fastjet::cambridge_for_passive_algorithm, fastjet::ClusterSequence::jet_def(), fastjet::kt_algorithm, and LimitedWarning::warn().

Referenced by get_median_rho_and_sigma().

00290                                                                    {
00291   if (jet_def().jet_algorithm() != kt_algorithm
00292       && jet_def().jet_algorithm() != cambridge_algorithm
00293       && jet_def().jet_algorithm() !=  cambridge_for_passive_algorithm) {
00294     _warnings.warn("ClusterSequenceAreaBase: jet_def being used may not be suitable for estimating diffuse backgrounds (good options are kt, cam)");
00295   }
00296 }


Member Data Documentation

LimitedWarning fastjet::ClusterSequenceAreaBase::_warnings [static, private]

allow for warnings

Reimplemented in fastjet::ClusterSequenceActiveAreaExplicitGhosts.

Definition at line 205 of file ClusterSequenceAreaBase.hh.

Referenced by _check_jet_alg_good_for_median().


The documentation for this class was generated from the following files:
Generated on Tue Dec 18 17:05:51 2007 for fastjet by  doxygen 1.5.2