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