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
00051
00063 class ClusterSequenceActiveArea : public ClusterSequenceAreaBase {
00064 public:
00065
00067 ClusterSequenceActiveArea() {}
00068
00070 template<class L> ClusterSequenceActiveArea
00071 (const std::vector<L> & pseudojets,
00072 const JetDefinition & jet_def,
00073 const GhostedAreaSpec & ghost_spec,
00074 const bool & writeout_combinations = false) ;
00075
00076 virtual double area (const PseudoJet & jet) const {
00077 return _average_area[jet.cluster_hist_index()];};
00078 virtual double area_error (const PseudoJet & jet) const {
00079 return _average_area2[jet.cluster_hist_index()];};
00080
00081 virtual PseudoJet area_4vector (const PseudoJet & jet) const {
00082 return _average_area_4vector[jet.cluster_hist_index()];};
00083
00087 enum mean_pt_strategies{median=0, non_ghost_median, pttot_over_areatot,
00088 pttot_over_areatot_cut, mean_ratio_cut, play,
00089 median_4vector};
00090
00098
00099 double pt_per_unit_area(mean_pt_strategies strat=median,
00100 double range=2.0 ) const;
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00115 virtual double empty_area(const RangeDefinition & range) const;
00116
00119 virtual double n_empty_jets(const RangeDefinition & range) const;
00120
00121 protected:
00122 void _resize_and_zero_AA ();
00123 void _initialise_AA(const JetDefinition & jet_def,
00124 const GhostedAreaSpec & ghost_spec,
00125 const bool & writeout_combinations,
00126 bool & continue_running);
00127
00128 void _run_AA(const GhostedAreaSpec & ghost_spec);
00129
00130 void _postprocess_AA(const GhostedAreaSpec & ghost_spec);
00131
00134 void _initialise_and_run_AA (const JetDefinition & jet_def,
00135 const GhostedAreaSpec & ghost_spec,
00136 const bool & writeout_combinations = false);
00137
00140 void _transfer_ghost_free_history(
00141 const ClusterSequenceActiveAreaExplicitGhosts & clust_seq);
00142
00143
00146 void _transfer_areas(const std::vector<int> & unique_hist_order,
00147 const ClusterSequenceActiveAreaExplicitGhosts & );
00148
00150 std::valarray<double> _average_area, _average_area2;
00151 std::valarray<PseudoJet> _average_area_4vector;
00152
00156 bool has_dangerous_particles() const {return _has_dangerous_particles;}
00157
00158 private:
00159
00160
00161 double _non_jet_area, _non_jet_area2, _non_jet_number;
00162
00163 double _maxrap_for_area;
00164 double _safe_rap_for_area;
00165
00166 bool _has_dangerous_particles;
00167
00168
00172 void _extract_tree(std::vector<int> &) const;
00175 void _extract_tree_children(int pos, std::valarray<bool> &, const std::valarray<int> &, std::vector<int> &) const;
00177 void _extract_tree_parents (int pos, std::valarray<bool> &, const std::valarray<int> &, std::vector<int> &) const;
00178
00182 void _throw_unless_jets_have_same_perp_or_E(const PseudoJet & jet,
00183 const PseudoJet & refjet,
00184 double tolerance,
00185 const ClusterSequenceActiveAreaExplicitGhosts & jets_ghosted_seq
00186 ) const;
00187
00190
00191
00192
00193
00194 int _ghost_spec_repeat;
00195
00197 class GhostJet : public PseudoJet {
00198 public:
00199 GhostJet(const PseudoJet & j, double a) : PseudoJet(j), area(a){}
00200 double area;
00201 };
00202
00203 std::vector<GhostJet> _ghost_jets;
00204 std::vector<GhostJet> _unclustered_ghosts;
00205 };
00206
00207
00208
00209
00210 template<class L> ClusterSequenceActiveArea::ClusterSequenceActiveArea
00211 (const std::vector<L> & pseudojets,
00212 const JetDefinition & jet_def,
00213 const GhostedAreaSpec & ghost_spec,
00214 const bool & writeout_combinations) {
00215
00216
00217 _transfer_input_jets(pseudojets);
00218
00219
00220 _initialise_and_run_AA(jet_def, ghost_spec, writeout_combinations);
00221
00222 }
00223
00224
00225
00226 FASTJET_END_NAMESPACE
00227
00228 #endif // __FASTJET_CLUSTERSEQUENCEACTIVEAREA_HH__