File indexing completed on 2025-01-18 09:57:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #ifndef __FASTJET_CLUSTERSEQUENCEAREA_HH__
0032 #define __FASTJET_CLUSTERSEQUENCEAREA_HH__
0033
0034 #include "fastjet/ClusterSequenceAreaBase.hh"
0035 #include "fastjet/ClusterSequenceActiveArea.hh"
0036 #include "fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh"
0037 #include "fastjet/ClusterSequencePassiveArea.hh"
0038 #include "fastjet/ClusterSequenceVoronoiArea.hh"
0039 #include "fastjet/AreaDefinition.hh"
0040
0041 FASTJET_BEGIN_NAMESPACE
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 class ClusterSequenceArea : public ClusterSequenceAreaBase {
0052 public:
0053
0054 template<class L> ClusterSequenceArea
0055 (const std::vector<L> & pseudojets,
0056 const JetDefinition & jet_def_in,
0057 const AreaDefinition & area_def_in) : _area_def(area_def_in) {
0058 initialize_and_run_cswa(pseudojets, jet_def_in);
0059 }
0060
0061
0062 template<class L> ClusterSequenceArea
0063 (const std::vector<L> & pseudojets,
0064 const JetDefinition & jet_def_in,
0065 const GhostedAreaSpec & ghost_spec) : _area_def(ghost_spec){
0066 initialize_and_run_cswa(pseudojets, jet_def_in);
0067 }
0068
0069
0070 template<class L> ClusterSequenceArea
0071 (const std::vector<L> & pseudojets,
0072 const JetDefinition & jet_def_in,
0073 const VoronoiAreaSpec & voronoi_spec) : _area_def(voronoi_spec){
0074 initialize_and_run_cswa(pseudojets, jet_def_in);
0075 }
0076
0077
0078 const AreaDefinition & area_def() const {return _area_def;}
0079
0080
0081
0082 virtual double area (const PseudoJet & jet) const FASTJET_OVERRIDE{
0083 return _area_base->area(jet);}
0084
0085
0086
0087 virtual double area_error (const PseudoJet & jet) const FASTJET_OVERRIDE{
0088 return _area_base->area_error(jet);}
0089
0090
0091 virtual PseudoJet area_4vector(const PseudoJet & jet) const FASTJET_OVERRIDE{
0092 return _area_base->area_4vector(jet);}
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112 virtual double empty_area(const Selector & selector) const FASTJET_OVERRIDE{
0113 return _area_base->empty_area(selector);}
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124 virtual double n_empty_jets(const Selector & selector) const FASTJET_OVERRIDE{
0125 return _area_base->n_empty_jets(selector);
0126 }
0127
0128
0129 virtual bool is_pure_ghost(const PseudoJet & jet) const FASTJET_OVERRIDE{
0130 return _area_base->is_pure_ghost(jet);
0131 }
0132
0133
0134 virtual bool has_explicit_ghosts() const FASTJET_OVERRIDE{
0135 return _area_base->has_explicit_ghosts();
0136 }
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147 virtual void get_median_rho_and_sigma(const std::vector<PseudoJet> & all_jets,
0148 const Selector & selector,
0149 bool use_area_4vector,
0150 double & median, double & sigma,
0151 double & mean_area,
0152 bool all_are_incl = false) const FASTJET_OVERRIDE{
0153 _warn_if_range_unsuitable(selector);
0154 ClusterSequenceAreaBase::_get_median_rho_and_sigma(
0155 all_jets, selector, use_area_4vector,
0156 median, sigma, mean_area, all_are_incl);
0157 }
0158
0159
0160
0161
0162
0163
0164 virtual void get_median_rho_and_sigma(const Selector & selector,
0165 bool use_area_4vector,
0166 double & median, double & sigma) const FASTJET_OVERRIDE{
0167 ClusterSequenceAreaBase::_get_median_rho_and_sigma(selector,use_area_4vector,
0168 median,sigma);
0169 }
0170
0171
0172
0173
0174
0175
0176 virtual void get_median_rho_and_sigma(const Selector & selector,
0177 bool use_area_4vector,
0178 double & median, double & sigma,
0179 double & mean_area) const FASTJET_OVERRIDE{
0180 ClusterSequenceAreaBase::_get_median_rho_and_sigma(selector,use_area_4vector,
0181 median,sigma, mean_area);
0182 }
0183
0184
0185
0186
0187
0188
0189 virtual void parabolic_pt_per_unit_area(double & a, double & b,
0190 const Selector & selector,
0191 double exclude_above=-1.0,
0192 bool use_area_4vector=false) const FASTJET_OVERRIDE{
0193 return _parabolic_pt_per_unit_area(a,b,selector,exclude_above,use_area_4vector);
0194 }
0195
0196
0197 private:
0198
0199
0200
0201
0202 void _warn_if_range_unsuitable(const Selector & selector) const;
0203
0204 template<class L> void initialize_and_run_cswa (
0205 const std::vector<L> & pseudojets,
0206 const JetDefinition & jet_def);
0207
0208 SharedPtr<ClusterSequenceAreaBase> _area_base;
0209 AreaDefinition _area_def;
0210 static LimitedWarning _range_warnings;
0211 static LimitedWarning _explicit_ghosts_repeats_warnings;
0212
0213
0214
0215
0216
0217
0218
0219 virtual void _parabolic_pt_per_unit_area(double & a, double & b,
0220 const Selector & selector,
0221 double exclude_above=-1.0,
0222 bool use_area_4vector=false) const FASTJET_OVERRIDE {
0223 _warn_if_range_unsuitable(selector);
0224 ClusterSequenceAreaBase::_parabolic_pt_per_unit_area(
0225 a,b,selector, exclude_above, use_area_4vector);
0226 }
0227
0228 };
0229
0230
0231 template<class L> void ClusterSequenceArea::initialize_and_run_cswa(
0232 const std::vector<L> & pseudojets,
0233 const JetDefinition & jet_def_in)
0234 {
0235
0236 ClusterSequenceAreaBase * _area_base_ptr;
0237 switch(_area_def.area_type()) {
0238 case active_area:
0239 _area_base_ptr = new ClusterSequenceActiveArea(pseudojets,
0240 jet_def_in,
0241 _area_def.ghost_spec());
0242 break;
0243 case active_area_explicit_ghosts:
0244 if (_area_def.ghost_spec().repeat() != 1)
0245 _explicit_ghosts_repeats_warnings.warn("Requested active area with explicit ghosts with repeat != 1; only 1 set of ghosts will be used");
0246 _area_base_ptr = new ClusterSequenceActiveAreaExplicitGhosts(pseudojets,
0247 jet_def_in,
0248 _area_def.ghost_spec());
0249 break;
0250 case voronoi_area:
0251 _area_base_ptr = new ClusterSequenceVoronoiArea(pseudojets,
0252 jet_def_in,
0253 _area_def.voronoi_spec());
0254 break;
0255 case one_ghost_passive_area:
0256 _area_base_ptr = new ClusterSequence1GhostPassiveArea(pseudojets,
0257 jet_def_in,
0258 _area_def.ghost_spec());
0259 break;
0260 case passive_area:
0261 _area_base_ptr = new ClusterSequencePassiveArea(pseudojets,
0262 jet_def_in,
0263 _area_def.ghost_spec());
0264 break;
0265 default:
0266 std::ostringstream err;
0267 err << "Error: unrecognized area_type in ClusterSequenceArea:"
0268 << _area_def.area_type();
0269 throw Error(err.str());
0270
0271 }
0272
0273 _area_base = SharedPtr<ClusterSequenceAreaBase>(_area_base_ptr);
0274 transfer_from_sequence(*_area_base);
0275 }
0276
0277 FASTJET_END_NAMESPACE
0278
0279 #endif
0280
0281