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