00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __FASTJET_CLUSTERSEQUENCEACTIVEAREA_HH__
00032 #define __FASTJET_CLUSTERSEQUENCEACTIVEAREA_HH__
00033
00034
00035 #include "fastjet/PseudoJet.hh"
00036 #include "fastjet/ClusterSequenceAreaBase.hh"
00037 #include "fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh"
00038 #include<iostream>
00039 #include<vector>
00040
00041
00042
00043 #include "fastjet/ActiveAreaSpec.hh"
00044 #include "fastjet/ClusterSequenceWithArea.hh"
00045
00046
00047
00048 FASTJET_BEGIN_NAMESPACE
00049
00050 using namespace std;
00051
00056 class ClusterSequenceActiveArea : public ClusterSequenceAreaBase {
00057 public:
00058
00060 ClusterSequenceActiveArea() {}
00061
00063 template<class L> ClusterSequenceActiveArea
00064 (const std::vector<L> & pseudojets,
00065 const JetDefinition & jet_def,
00066 const GhostedAreaSpec & area_spec,
00067 const bool & writeout_combinations = false) ;
00068
00069 virtual double area (const PseudoJet & jet) const {
00070 return _average_area[jet.cluster_hist_index()];};
00071 virtual double area_error (const PseudoJet & jet) const {
00072 return _average_area2[jet.cluster_hist_index()];};
00073
00074 virtual PseudoJet area_4vector (const PseudoJet & jet) const {
00075 return _average_area_4vector[jet.cluster_hist_index()];};
00076
00080 enum mean_pt_strategies{median=0, non_ghost_median, pttot_over_areatot,
00081 pttot_over_areatot_cut, mean_ratio_cut, play,
00082 median_4vector};
00083
00089 double pt_per_unit_area(mean_pt_strategies strat=median,
00090 double range=2.0 ) const;
00091
00095 void parabolic_pt_per_unit_area(double & a,double & b, double raprange=-1.0,
00096 double exclude_above=-1.0,
00097 bool use_area_4vector=false ) const;
00098
00103 virtual double empty_area(const RangeDefinition & range) const;
00104
00107 virtual double n_empty_jets(const RangeDefinition & range) const;
00108
00109 protected:
00110 void _resize_and_zero_AA ();
00111 void _initialise_AA(const JetDefinition & jet_def,
00112 const GhostedAreaSpec & area_spec,
00113 const bool & writeout_combinations,
00114 bool & continue_running);
00115
00116 void _run_AA(const GhostedAreaSpec & area_spec);
00117
00118 void _postprocess_AA(const GhostedAreaSpec & area_spec);
00119
00122 void _initialise_and_run_AA (const JetDefinition & jet_def,
00123 const GhostedAreaSpec & area_spec,
00124 const bool & writeout_combinations = false);
00125
00128 void _transfer_ghost_free_history(
00129 const ClusterSequenceActiveAreaExplicitGhosts & clust_seq);
00130
00131
00134 void _transfer_areas(const vector<int> & unique_hist_order,
00135 const ClusterSequenceActiveAreaExplicitGhosts & );
00136
00138 valarray<double> _average_area, _average_area2;
00139 valarray<PseudoJet> _average_area_4vector;
00140
00144 bool has_dangerous_particles() const {return _has_dangerous_particles;}
00145
00146 private:
00147
00148
00149 double _non_jet_area, _non_jet_area2, _non_jet_number;
00150
00151 double _maxrap_for_area;
00152 double _safe_rap_for_area;
00153
00154 bool _has_dangerous_particles;
00155
00156
00160 void _extract_tree(vector<int> &) const;
00163 void _extract_tree_children(int pos, valarray<bool> &, const valarray<int> &, vector<int> &) const;
00165 void _extract_tree_parents (int pos, valarray<bool> &, const valarray<int> &, vector<int> &) const;
00166
00170 void _throw_unless_jets_have_same_perp_or_E(const PseudoJet & jet,
00171 const PseudoJet & refjet,
00172 double tolerance,
00173 const ClusterSequenceActiveAreaExplicitGhosts & jets_ghosted_seq
00174 ) const;
00175
00178
00179
00180
00181
00182 int _area_spec_repeat;
00183
00185 class GhostJet : public PseudoJet {
00186 public:
00187 GhostJet(const PseudoJet & j, double a) : PseudoJet(j), area(a){}
00188 double area;
00189 };
00190
00191 std::vector<GhostJet> _ghost_jets;
00192 std::vector<GhostJet> _unclustered_ghosts;
00193 };
00194
00195
00196
00197
00198 template<class L> ClusterSequenceActiveArea::ClusterSequenceActiveArea
00199 (const std::vector<L> & pseudojets,
00200 const JetDefinition & jet_def,
00201 const GhostedAreaSpec & area_spec,
00202 const bool & writeout_combinations) {
00203
00204
00205 _transfer_input_jets(pseudojets);
00206
00207
00208 _initialise_and_run_AA(jet_def, area_spec, writeout_combinations);
00209
00210 }
00211
00212
00213
00214 FASTJET_END_NAMESPACE
00215
00216 #endif // __FASTJET_CLUSTERSEQUENCEACTIVEAREA_HH__