Fork me on GitHub

source: svn/trunk/Utilities/Fastjet/include/fastjet/ClusterSequenceArea.hh@ 729

Last change on this file since 729 was 11, checked in by severine ovyn, 16 years ago

Fastjet added; CDFCones directory has been changed

File size: 9.0 KB
RevLine 
[11]1//STARTHEADER
2// $Id: ClusterSequenceArea.hh,v 1.1 2008-11-06 14:32:08 ovyn Exp $
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 "Utilities/Fastjet/include/fastjet/ClusterSequenceAreaBase.hh"
35#include "Utilities/Fastjet/include/fastjet/ClusterSequenceActiveArea.hh"
36#include "Utilities/Fastjet/include/fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh"
37#include "Utilities/Fastjet/include/fastjet/ClusterSequencePassiveArea.hh"
38#include "Utilities/Fastjet/include/fastjet/ClusterSequenceVoronoiArea.hh"
39#include "Utilities/Fastjet/include/fastjet/AreaDefinition.hh"
40
41FASTJET_BEGIN_NAMESPACE
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.
49class ClusterSequenceArea : public ClusterSequenceAreaBase {
50public:
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 /// overload version of what's in the ClusterSequenceAreaBase class, which
123 /// additionally checks compatibility between "range" and region in which
124 /// ghosts are thrown.
125 virtual void get_median_rho_and_sigma(const RangeDefinition & range,
126 bool use_area_4vector,
127 double & median, double & sigma,
128 double & mean_area) const {
129 _warn_if_range_unsuitable(range);
130 ClusterSequenceAreaBase::get_median_rho_and_sigma(range, use_area_4vector,
131 median, sigma, mean_area);
132 }
133
134 /// overload version of what's in the ClusterSequenceAreaBase class,
135 /// which actually just does the same thing as the base version (but
136 /// since we've overridden the 5-argument version above, we have to
137 /// override the 4-argument version too.
138 virtual void get_median_rho_and_sigma(const RangeDefinition & range,
139 bool use_area_4vector,
140 double & median, double & sigma) const {
141 ClusterSequenceAreaBase::get_median_rho_and_sigma(range,use_area_4vector,
142 median,sigma);
143 }
144
145
146 /// overload version of what's in the ClusterSequenceAreaBase class, which
147 /// additionally checks compatibility between "range" and region in which
148 /// ghosts are thrown.
149 virtual void parabolic_pt_per_unit_area(double & a, double & b,
150 const RangeDefinition & range,
151 double exclude_above=-1.0,
152 bool use_area_4vector=false) const {
153 _warn_if_range_unsuitable(range);
154 ClusterSequenceAreaBase::parabolic_pt_per_unit_area(
155 a,b,range, exclude_above, use_area_4vector);
156 }
157
158
159private:
160
161 /// print a warning if the range is unsuitable for the current
162 /// calculation of the area (e.g. because ghosts do not extend
163 /// far enough).
164 void _warn_if_range_unsuitable(const RangeDefinition & range) const;
165
166 template<class L> void initialize_and_run_cswa (
167 const std::vector<L> & pseudojets,
168 const JetDefinition & jet_def);
169
170 std::auto_ptr<ClusterSequenceAreaBase> _area_base;
171 AreaDefinition _area_def;
172 static LimitedWarning _range_warnings;
173
174};
175
176//----------------------------------------------------------------------
177template<class L> void ClusterSequenceArea::initialize_and_run_cswa(
178 const std::vector<L> & pseudojets,
179 const JetDefinition & jet_def)
180 {
181
182 ClusterSequenceAreaBase * _area_base_ptr;
183 switch(_area_def.area_type()) {
184 case active_area:
185 _area_base_ptr = new ClusterSequenceActiveArea(pseudojets,
186 jet_def,
187 _area_def.ghost_spec());
188 break;
189 case active_area_explicit_ghosts:
190 _area_base_ptr = new ClusterSequenceActiveAreaExplicitGhosts(pseudojets,
191 jet_def,
192 _area_def.ghost_spec());
193 break;
194 case voronoi_area:
195 _area_base_ptr = new ClusterSequenceVoronoiArea(pseudojets,
196 jet_def,
197 _area_def.voronoi_spec());
198 break;
199 case one_ghost_passive_area:
200 _area_base_ptr = new ClusterSequence1GhostPassiveArea(pseudojets,
201 jet_def,
202 _area_def.ghost_spec());
203 break;
204 case passive_area:
205 _area_base_ptr = new ClusterSequencePassiveArea(pseudojets,
206 jet_def,
207 _area_def.ghost_spec());
208 break;
209 default:
210 std::cerr << "Error: unrecognized area_type in ClusterSequenceArea:"
211 << _area_def.area_type() << std::endl;
212 exit(-1);
213 }
214 // now copy across the information from the area base class
215 _area_base = std::auto_ptr<ClusterSequenceAreaBase>(_area_base_ptr);
216 transfer_from_sequence(*_area_base);
217}
218
219FASTJET_END_NAMESPACE
220
221#endif // __FASTJET_CLUSTERSEQUENCEAREA_HH__
222
223
Note: See TracBrowser for help on using the repository browser.