ClusterSequenceActiveAreaExplicitGhosts.hh
Go to the documentation of this file.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
00107 virtual bool has_explicit_ghosts() const {return true;}
00108
00111 virtual double empty_area(const RangeDefinition & range) const;
00112
00114 double total_area () const;
00115
00118 double max_ghost_perp2() const {return _max_ghost_perp2;}
00119
00123 bool has_dangerous_particles() const {return _has_dangerous_particles;}
00124
00125 private:
00126
00127 int _n_ghosts;
00128 double _ghost_area;
00129 std::vector<bool> _is_pure_ghost;
00130 std::vector<double> _areas;
00131 std::vector<PseudoJet> _area_4vectors;
00132
00133
00134 double _max_ghost_perp2;
00135 bool _has_dangerous_particles;
00136 static LimitedWarning _warnings;
00137
00138
00139
00140
00141
00142 unsigned int _initial_hard_n;
00143
00146 void _add_ghosts(const GhostedAreaSpec & area_spec);
00147
00149 template<class L> void _add_ghosts (
00150 const std::vector<L> & ghosts,
00151 double ghost_area);
00152
00156 void _post_process();
00157
00158 };
00159
00160
00161
00162
00163
00164 template<class L> void ClusterSequenceActiveAreaExplicitGhosts::_initialise
00165 (const std::vector<L> & pseudojets,
00166 const JetDefinition & jet_def,
00167 const GhostedAreaSpec * area_spec,
00168 const std::vector<L> * ghosts,
00169 double ghost_area,
00170 const bool & writeout_combinations) {
00171
00172
00173
00174
00175
00176
00177 for (unsigned int i = 0; i < pseudojets.size(); i++) {
00178 PseudoJet mom(pseudojets[i]);
00179
00180 _jets.push_back(mom);
00181 _is_pure_ghost.push_back(false);
00182 }
00183
00184 _initial_hard_n = _jets.size();
00185
00186 if (area_spec != NULL) {
00187 _add_ghosts(*area_spec);
00188 } else {
00189 _add_ghosts(*ghosts, ghost_area);
00190 }
00191
00192 if (writeout_combinations) {
00193 std::cout << "# Printing particles including ghosts\n";
00194 for (unsigned j = 0; j < _jets.size(); j++) {
00195 printf("%5u %20.13f %20.13f %20.13e\n",
00196 j,_jets[j].rap(),_jets[j].phi_02pi(),_jets[j].kt2());
00197 }
00198 std::cout << "# Finished printing particles including ghosts\n";
00199 }
00200
00201
00202
00203 _jets.reserve(_jets.size()*2);
00204
00205
00206 _initialise_and_run(jet_def,writeout_combinations);
00207
00208
00209 _post_process();
00210 }
00211
00212
00213 inline unsigned int ClusterSequenceActiveAreaExplicitGhosts::n_hard_particles() const {return _initial_hard_n;}
00214
00215
00216
00218 template<class L> void ClusterSequenceActiveAreaExplicitGhosts::_add_ghosts (
00219 const std::vector<L> & ghosts,
00220 double ghost_area) {
00221
00222
00223 for (unsigned i = 0; i < ghosts.size(); i++) {
00224 _is_pure_ghost.push_back(true);
00225 _jets.push_back(ghosts[i]);
00226 }
00227
00228 _ghost_area = ghost_area;
00229 _n_ghosts = ghosts.size();
00230 }
00231
00232
00233 FASTJET_END_NAMESPACE
00234
00235 #endif // __FASTJET_CLUSTERSEQUENCEACTIVEAREAEXPLICITGHOSTS_HH_