Changeset 35cdc46 in git for external/fastjet/tools/JetMedianBackgroundEstimator.hh
- Timestamp:
- Sep 3, 2014, 3:18:54 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- be2222c
- Parents:
- 5b5a56b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/tools/JetMedianBackgroundEstimator.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_BACKGROUND_ESTIMATOR_HH__ 3 3 4 // STARTHEADER5 // $Id: JetMedianBackgroundEstimator.hh 2689 2011-11-14 14:51:06Z soyez $4 //FJSTARTHEADER 5 // $Id: JetMedianBackgroundEstimator.hh 3517 2014-08-01 14:23:13Z soyez $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/ClusterSequenceAreaBase.hh> … … 121 123 /// 122 124 JetMedianBackgroundEstimator(const Selector &rho_range = SelectorIdentity()) 123 : _rho_range(rho_range), _jet_def(JetDefinition()) { reset(); } 125 : _rho_range(rho_range), _jet_def(JetDefinition()), 126 _enable_rho_m(true){ reset(); } 124 127 125 128 … … 168 171 } 169 172 173 /// determine whether the automatic calculation of rho_m and sigma_m 174 /// is enabled (by default true) 175 void set_compute_rho_m(bool enable){ _enable_rho_m = enable;} 176 170 177 //\} 171 178 … … 201 208 virtual bool has_sigma() {return true;} 202 209 210 //---------------------------------------------------------------- 211 // now do the same thing for rho_m and sigma_m 212 213 /// returns rho_m, the purely longitudinal, particle-mass-induced 214 /// component of the background density per unit area 215 virtual double rho_m() const; 216 217 /// returns sigma_m, a measure of the fluctuations in the purely 218 /// longitudinal, particle-mass-induced component of the background 219 /// density per unit area; must be multipled by sqrt(area) to get 220 /// fluctuations for a region of a given area. 221 virtual double sigma_m() const; 222 223 /// Returns rho_m locally at the jet position. As for rho(jet), it is non-const. 224 virtual double rho_m(const PseudoJet & /*jet*/); 225 226 /// Returns sigma_m locally at the jet position. As for rho(jet), it is non-const. 227 virtual double sigma_m(const PseudoJet & /*jet*/); 228 229 /// Returns true if this background estimator has support for 230 /// determination of rho_m. 231 /// 232 /// In te presence of a density class, support for rho_m is 233 /// automatically disabled 234 /// 235 /// Note that support for sigma_m is automatic is one has sigma and 236 /// rho_m support. 237 virtual bool has_rho_m() const {return _enable_rho_m && (_jet_density_class == 0);} 203 238 //\} 204 239 … … 208 243 /// Returns the mean area of the jets used to actually compute the 209 244 /// background properties in the last call of rho() or sigma() 245 /// If the configuration has changed in the meantime, throw an error. 210 246 double mean_area() const{ 211 _recompute_if_needed(); 247 if (!_uptodate) 248 throw Error("JetMedianBackgroundEstimator::mean_area(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 249 //_recompute_if_needed(); 212 250 return _mean_area; 213 251 } … … 215 253 /// returns the number of jets used to actually compute the 216 254 /// background properties in the last call of rho() or sigma() 255 /// If the configuration has changed in the meantime, throw an error. 217 256 unsigned int n_jets_used() const{ 218 _recompute_if_needed(); 257 if (!_uptodate) 258 throw Error("JetMedianBackgroundEstimator::n_jets_used(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 259 //_recompute_if_needed(); 219 260 return _n_jets_used; 261 } 262 263 /// returns the jets used to actually compute the background 264 /// properties 265 std::vector<PseudoJet> jets_used() const{ 266 if (!_uptodate) throw Error("JetMedianBackgroundEstimator::n_jets_used(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 267 _check_csa_alive(); 268 std::vector<PseudoJet> tmp_jets = _rho_range(_included_jets); 269 std::vector<PseudoJet> used_jets; 270 for (unsigned int i=0; i<tmp_jets.size(); i++){ 271 if (tmp_jets[i].area()>0) used_jets.push_back(tmp_jets[i]); 272 } 273 return used_jets; 220 274 } 221 275 … … 223 277 /// the selector) that is not occupied by jets. The value is that 224 278 /// for the last call of rho() or sigma() 279 /// If the configuration has changed in the meantime, throw an error. 225 280 /// 226 281 /// The answer is defined to be zero if the area calculation … … 234 289 /// call to the ClusterSequenceAreaBase function. 235 290 double empty_area() const{ 236 _recompute_if_needed(); 291 if (!_uptodate) 292 throw Error("JetMedianBackgroundEstimator::empty_area(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 293 //_recompute_if_needed(); 237 294 return _empty_area; 238 295 } … … 241 298 /// background properties. The value is that for the last call of 242 299 /// rho() or sigma(). 300 /// If the configuration has changed in the meantime, throw an error. 243 301 /// 244 302 /// If the area has explicit ghosts the result is zero; for active … … 250 308 /// call to the ClusterSequenceAreaBase function. 251 309 double n_empty_jets() const{ 252 _recompute_if_needed(); 310 if (!_uptodate) 311 throw Error("JetMedianBackgroundEstimator::n_empty_jets(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 312 //_recompute_if_needed(); 253 313 return _n_empty_jets; 254 314 } … … 361 421 /// Issue a warning otherwise 362 422 void _check_jet_alg_good_for_median() const; 363 423 364 424 // the basic parameters of this class (passed through the variou ctors) 365 425 Selector _rho_range; ///< range to compute the background in … … 368 428 std::vector<PseudoJet> _included_jets; ///< jets to be used 369 429 370 // the tunable aprameters of the class430 // the tunable parameters of the class 371 431 bool _use_area_4vector; 372 432 bool _provide_fj2_sigma; 373 433 const FunctionOfPseudoJet<double> * _jet_density_class; 374 434 //SharedPtr<BackgroundRescalingBase> _rescaling_class_sharedptr; 435 bool _enable_rho_m; 375 436 376 437 // the actual results of the computation 377 438 mutable double _rho; ///< background estimated density per unit area 378 439 mutable double _sigma; ///< background estimated fluctuations 440 mutable double _rho_m; ///< "mass" background estimated density per unit area 441 mutable double _sigma_m; ///< "mass" background estimated fluctuations 379 442 mutable double _mean_area; ///< mean area of the jets used to estimate the background 380 443 mutable unsigned int _n_jets_used; ///< number of jets used to estimate the background … … 429 492 virtual double result(const PseudoJet & jet) const; 430 493 431 virtual std::string description() const {return "BackgroundScalarJetPtDensity";}494 virtual std::string description() const; 432 495 433 496 private:
Note:
See TracChangeset
for help on using the changeset viewer.