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_CLUSTERSEQUENCEACTIVEAREAEXPLICITGHOSTS_HH_
00032 #define __FASTJET_CLUSTERSEQUENCEACTIVEAREAEXPLICITGHOSTS_HH_
00033
00034 #include "fastjet/PseudoJet.hh"
00035 #include "fastjet/ClusterSequenceAreaBase.hh"
00036 #include "fastjet/GhostedAreaSpec.hh"
00037 #include "fastjet/internal/LimitedWarning.hh"
00038 #include<iostream>
00039 #include<vector>
00040
00041 FASTJET_BEGIN_NAMESPACE
00042
00043
00048 class ClusterSequenceActiveAreaExplicitGhosts :
00049 public ClusterSequenceAreaBase {
00050 public:
00053 template<class L> ClusterSequenceActiveAreaExplicitGhosts
00054 (const std::vector<L> & pseudojets,
00055 const JetDefinition & jet_def,
00056 const GhostedAreaSpec & area_spec,
00057 const bool & writeout_combinations = false)
00058 : ClusterSequenceAreaBase() {
00059 std::vector<L> * ghosts = NULL;
00060 _initialise(pseudojets,jet_def,&area_spec,ghosts,0.0,
00061 writeout_combinations); }
00062
00063 template<class L> ClusterSequenceActiveAreaExplicitGhosts
00064 (const std::vector<L> & pseudojets,
00065 const JetDefinition & jet_def,
00066 const std::vector<L> & ghosts,
00067 double ghost_area,
00068 const bool & writeout_combinations = false)
00069 : ClusterSequenceAreaBase() {
00070 const GhostedAreaSpec * area_spec = NULL;
00071 _initialise(pseudojets,jet_def,area_spec,&ghosts,ghost_area,
00072 writeout_combinations); }
00073
00074
00076 template<class L> void _initialise
00077 (const std::vector<L> & pseudojets,
00078 const JetDefinition & jet_def,
00079 const GhostedAreaSpec * area_spec,
00080 const std::vector<L> * ghosts,
00081 double ghost_area,
00082 const bool & writeout_combinations);
00083
00084
00085
00087 unsigned int n_hard_particles() const;
00088
00090 virtual double area (const PseudoJet & jet) const;
00091
00096 virtual PseudoJet area_4vector (const PseudoJet & jet) const;
00097
00099 virtual bool is_pure_ghost(const PseudoJet & jet) const;
00100
00104 bool is_pure_ghost(int history_index) const;
00105
00108 virtual double empty_area(const RangeDefinition & range) const;
00109
00111 double total_area () const;
00112
00115 double max_ghost_perp2() const {return _max_ghost_perp2;}
00116
00120 bool has_dangerous_particles() const {return _has_dangerous_particles;}
00121
00122 private:
00123
00124 int _n_ghosts;
00125 double _ghost_area;
00126 std::vector<bool> _is_pure_ghost;
00127 std::vector<double> _areas;
00128 std::vector<PseudoJet> _area_4vectors;
00129
00130
00131 double _max_ghost_perp2;
00132 bool _has_dangerous_particles;
00133 static LimitedWarning _warnings;
00134
00135
00136
00137
00138
00139 unsigned int _initial_hard_n;
00140
00143 void _add_ghosts(const GhostedAreaSpec & area_spec);
00144
00146 template<class L> void _add_ghosts (
00147 const std::vector<L> & ghosts,
00148 double ghost_area);
00149
00153 void _post_process();
00154
00155 };
00156
00157
00158
00159
00160
00161 template<class L> void ClusterSequenceActiveAreaExplicitGhosts::_initialise
00162 (const std::vector<L> & pseudojets,
00163 const JetDefinition & jet_def,
00164 const GhostedAreaSpec * area_spec,
00165 const std::vector<L> * ghosts,
00166 double ghost_area,
00167 const bool & writeout_combinations) {
00168
00169
00170
00171
00172
00173
00174 for (unsigned int i = 0; i < pseudojets.size(); i++) {
00175 PseudoJet mom(pseudojets[i]);
00176
00177 _jets.push_back(mom);
00178 _is_pure_ghost.push_back(false);
00179 }
00180
00181 _initial_hard_n = _jets.size();
00182
00183 if (area_spec != NULL) {
00184 _add_ghosts(*area_spec);
00185 } else {
00186 _add_ghosts(*ghosts, ghost_area);
00187 }
00188
00189 if (writeout_combinations) {
00190 std::cout << "# Printing particles including ghosts\n";
00191 for (unsigned j = 0; j < _jets.size(); j++) {
00192 printf("%5u %20.13f %20.13f %20.13e\n",
00193 j,_jets[j].rap(),_jets[j].phi_02pi(),_jets[j].kt2());
00194 }
00195 std::cout << "# Finished printing particles including ghosts\n";
00196 }
00197
00198
00199
00200 _jets.reserve(_jets.size()*2);
00201
00202
00203 _initialise_and_run(jet_def,writeout_combinations);
00204
00205
00206 _post_process();
00207 }
00208
00209
00210 inline unsigned int ClusterSequenceActiveAreaExplicitGhosts::n_hard_particles() const {return _initial_hard_n;}
00211
00212
00213
00215 template<class L> void ClusterSequenceActiveAreaExplicitGhosts::_add_ghosts (
00216 const std::vector<L> & ghosts,
00217 double ghost_area) {
00218
00219
00220 for (unsigned i = 0; i < ghosts.size(); i++) {
00221 _is_pure_ghost.push_back(true);
00222 _jets.push_back(ghosts[i]);
00223 }
00224
00225 _ghost_area = ghost_area;
00226 _n_ghosts = ghosts.size();
00227 }
00228
00229
00230 FASTJET_END_NAMESPACE
00231
00232 #endif // __FASTJET_CLUSTERSEQUENCEACTIVEAREAEXPLICITGHOSTS_HH_