]>
Commit | Line | Data |
---|---|---|
370be031 | 1 | //STARTHEADER |
2 | // $Id: ClusterSequenceArea.hh 1303 2008-10-29 16:42:09Z salam $ | |
3 | // | |
4 | // Copyright (c) 2006-2007, Matteo Cacciari, Gavin Salam and Gregory Soyez | |
5 | // | |
6 | //---------------------------------------------------------------------- | |
7 | // This file is part of FastJet. | |
8 | // | |
9 | // FastJet is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; either version 2 of the License, or | |
12 | // (at your option) any later version. | |
13 | // | |
14 | // The algorithms that underlie FastJet have required considerable | |
15 | // development and are described in hep-ph/0512210. If you use | |
16 | // FastJet as part of work towards a scientific publication, please | |
17 | // include a citation to the FastJet paper. | |
18 | // | |
19 | // FastJet is distributed in the hope that it will be useful, | |
20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | // GNU General Public License for more details. | |
23 | // | |
24 | // You should have received a copy of the GNU General Public License | |
25 | // along with FastJet; if not, write to the Free Software | |
26 | // Foundation, Inc.: | |
27 | // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
28 | //---------------------------------------------------------------------- | |
29 | //ENDHEADER | |
30 | ||
31 | #ifndef __FASTJET_CLUSTERSEQUENCEAREA_HH__ | |
32 | #define __FASTJET_CLUSTERSEQUENCEAREA_HH__ | |
33 | ||
34 | #include "fastjet/ClusterSequenceAreaBase.hh" | |
35 | #include "fastjet/ClusterSequenceActiveArea.hh" | |
36 | #include "fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh" | |
37 | #include "fastjet/ClusterSequencePassiveArea.hh" | |
38 | #include "fastjet/ClusterSequenceVoronoiArea.hh" | |
39 | #include "fastjet/AreaDefinition.hh" | |
40 | ||
41 | namespace fastjet { | |
42 | ||
43 | /// General class for user to obtain ClusterSequence with additional | |
44 | /// area information. | |
45 | /// | |
46 | /// Based on the area_def, it automatically dispatches the work to the | |
47 | /// appropriate actual ClusterSequenceAreaBase-derived-class to do the | |
48 | /// real work. | |
49 | class ClusterSequenceArea : public ClusterSequenceAreaBase { | |
50 | public: | |
51 | /// main constructor | |
52 | template<class L> ClusterSequenceArea | |
53 | (const std::vector<L> & pseudojets, | |
54 | const JetDefinition & jet_def, | |
55 | const AreaDefinition & area_def_in) : _area_def(area_def_in) { | |
56 | initialize_and_run_cswa(pseudojets, jet_def); | |
57 | } | |
58 | ||
59 | /// constructor with a GhostedAreaSpec | |
60 | template<class L> ClusterSequenceArea | |
61 | (const std::vector<L> & pseudojets, | |
62 | const JetDefinition & jet_def, | |
63 | const GhostedAreaSpec & area_spec) : _area_def(area_spec){ | |
64 | initialize_and_run_cswa(pseudojets, jet_def); | |
65 | } | |
66 | ||
67 | /// constructor with a VoronoiAreaSpec | |
68 | template<class L> ClusterSequenceArea | |
69 | (const std::vector<L> & pseudojets, | |
70 | const JetDefinition & jet_def, | |
71 | const VoronoiAreaSpec & area_spec) : _area_def(area_spec){ | |
72 | initialize_and_run_cswa(pseudojets, jet_def); | |
73 | } | |
74 | ||
75 | /// return a reference to the area definition | |
76 | const AreaDefinition & area_def() const {return _area_def;} | |
77 | ||
78 | ||
79 | /// return the area associated with the given jet | |
80 | virtual double area (const PseudoJet & jet) const { | |
81 | return _area_base->area(jet);} | |
82 | ||
83 | /// return the error (uncertainty) associated with the determination | |
84 | /// of the area of this jet | |
85 | virtual double area_error (const PseudoJet & jet) const { | |
86 | return _area_base->area_error(jet);} | |
87 | ||
88 | /// return the 4-vector area | |
89 | virtual PseudoJet area_4vector(const PseudoJet & jet) const { | |
90 | return _area_base->area_4vector(jet);} | |
91 | ||
92 | // /// return the total area, up to |y|<maxrap, that is free of jets | |
93 | // virtual double empty_area(double maxrap) const { | |
94 | // return _area_base->empty_area(maxrap);} | |
95 | // | |
96 | // /// return something similar to the number of pure ghost jets | |
97 | // /// in the given rapidity range in an active area case. | |
98 | // /// For the local implementation we return empty_area/(0.55 pi R^2), | |
99 | // /// based on measured properties of ghost jets with kt and cam. Note | |
100 | // /// that the number returned is a double. | |
101 | // virtual double n_empty_jets(double maxrap) const { | |
102 | // return _area_base->n_empty_jets(maxrap); | |
103 | ||
104 | /// return the total area, in the given rap-phi range, that is free of jets | |
105 | virtual double empty_area(const RangeDefinition & range) const { | |
106 | return _area_base->empty_area(range);} | |
107 | ||
108 | /// return something similar to the number of pure ghost jets | |
109 | /// in the given rap-phi range in an active area case. | |
110 | /// For the local implementation we return empty_area/(0.55 pi R^2), | |
111 | /// based on measured properties of ghost jets with kt and cam. Note | |
112 | /// that the number returned is a double. | |
113 | virtual double n_empty_jets(const RangeDefinition & range) const { | |
114 | return _area_base->n_empty_jets(range); | |
115 | } | |
116 | ||
117 | /// true if a jet is made exclusively of ghosts | |
118 | virtual bool is_pure_ghost(const PseudoJet & jet) const { | |
119 | return _area_base->is_pure_ghost(jet); | |
120 | } | |
121 | ||
122 | /// true if this ClusterSequence has explicit ghosts | |
123 | virtual bool has_explicit_ghosts() const { | |
124 | return _area_base->has_explicit_ghosts(); | |
125 | } | |
126 | ||
127 | ||
128 | /// overload version of what's in the ClusterSequenceAreaBase class, which | |
129 | /// additionally checks compatibility between "range" and region in which | |
130 | /// ghosts are thrown. | |
131 | virtual void get_median_rho_and_sigma(const std::vector<PseudoJet> & all_jets, | |
132 | const RangeDefinition & range, | |
133 | bool use_area_4vector, | |
134 | double & median, double & sigma, | |
135 | double & mean_area, | |
136 | bool all_are_incl = false) const { | |
137 | _warn_if_range_unsuitable(range); | |
138 | ClusterSequenceAreaBase::get_median_rho_and_sigma( | |
139 | all_jets, range, use_area_4vector, | |
140 | median, sigma, mean_area, all_are_incl); | |
141 | } | |
142 | ||
143 | /// overload version of what's in the ClusterSequenceAreaBase class, | |
144 | /// which actually just does the same thing as the base version (but | |
145 | /// since we've overridden the 5-argument version above, we have to | |
146 | /// override the 4-argument version too. | |
147 | virtual void get_median_rho_and_sigma(const RangeDefinition & range, | |
148 | bool use_area_4vector, | |
149 | double & median, double & sigma) const { | |
150 | ClusterSequenceAreaBase::get_median_rho_and_sigma(range,use_area_4vector, | |
151 | median,sigma); | |
152 | } | |
153 | ||
154 | /// overload version of what's in the ClusterSequenceAreaBase class, | |
155 | /// which actually just does the same thing as the base version (but | |
156 | /// since we've overridden the multi-argument version above, we have to | |
157 | /// override the 5-argument version too. | |
158 | virtual void get_median_rho_and_sigma(const RangeDefinition & range, | |
159 | bool use_area_4vector, | |
160 | double & median, double & sigma, | |
161 | double & mean_area) const { | |
162 | ClusterSequenceAreaBase::get_median_rho_and_sigma(range,use_area_4vector, | |
163 | median,sigma, mean_area); | |
164 | } | |
165 | ||
166 | ||
167 | /// overload version of what's in the ClusterSequenceAreaBase class, which | |
168 | /// additionally checks compatibility between "range" and region in which | |
169 | /// ghosts are thrown. | |
170 | virtual void parabolic_pt_per_unit_area(double & a, double & b, | |
171 | const RangeDefinition & range, | |
172 | double exclude_above=-1.0, | |
173 | bool use_area_4vector=false) const { | |
174 | _warn_if_range_unsuitable(range); | |
175 | ClusterSequenceAreaBase::parabolic_pt_per_unit_area( | |
176 | a,b,range, exclude_above, use_area_4vector); | |
177 | } | |
178 | ||
179 | ||
180 | private: | |
181 | ||
182 | /// print a warning if the range is unsuitable for the current | |
183 | /// calculation of the area (e.g. because ghosts do not extend | |
184 | /// far enough). | |
185 | void _warn_if_range_unsuitable(const RangeDefinition & range) const; | |
186 | ||
187 | template<class L> void initialize_and_run_cswa ( | |
188 | const std::vector<L> & pseudojets, | |
189 | const JetDefinition & jet_def); | |
190 | ||
191 | std::auto_ptr<ClusterSequenceAreaBase> _area_base; | |
192 | AreaDefinition _area_def; | |
193 | static LimitedWarning _range_warnings; | |
194 | ||
195 | }; | |
196 | ||
197 | //---------------------------------------------------------------------- | |
198 | template<class L> void ClusterSequenceArea::initialize_and_run_cswa( | |
199 | const std::vector<L> & pseudojets, | |
200 | const JetDefinition & jet_def) | |
201 | { | |
202 | ||
203 | ClusterSequenceAreaBase * _area_base_ptr; | |
204 | switch(_area_def.area_type()) { | |
205 | case active_area: | |
206 | _area_base_ptr = new ClusterSequenceActiveArea(pseudojets, | |
207 | jet_def, | |
208 | _area_def.ghost_spec()); | |
209 | break; | |
210 | case active_area_explicit_ghosts: | |
211 | _area_base_ptr = new ClusterSequenceActiveAreaExplicitGhosts(pseudojets, | |
212 | jet_def, | |
213 | _area_def.ghost_spec()); | |
214 | break; | |
215 | case voronoi_area: | |
216 | _area_base_ptr = new ClusterSequenceVoronoiArea(pseudojets, | |
217 | jet_def, | |
218 | _area_def.voronoi_spec()); | |
219 | break; | |
220 | case one_ghost_passive_area: | |
221 | _area_base_ptr = new ClusterSequence1GhostPassiveArea(pseudojets, | |
222 | jet_def, | |
223 | _area_def.ghost_spec()); | |
224 | break; | |
225 | case passive_area: | |
226 | _area_base_ptr = new ClusterSequencePassiveArea(pseudojets, | |
227 | jet_def, | |
228 | _area_def.ghost_spec()); | |
229 | break; | |
230 | default: | |
231 | std::cerr << "Error: unrecognized area_type in ClusterSequenceArea:" | |
232 | << _area_def.area_type() << std::endl; | |
233 | exit(-1); | |
234 | } | |
235 | // now copy across the information from the area base class | |
236 | _area_base = std::auto_ptr<ClusterSequenceAreaBase>(_area_base_ptr); | |
237 | transfer_from_sequence(*_area_base); | |
238 | } | |
239 | ||
240 | } // fastjet namespace | |
241 | ||
242 | #endif // __FASTJET_CLUSTERSEQUENCEAREA_HH__ | |
243 | ||
244 |