source: HiSusy/trunk/Delphes/Delphes-3.0.9/external/fastjet/tools/Subtractor.cc @ 5

Last change on this file since 5 was 5, checked in by zerwas, 11 years ago

update to Delphes-3.0.9

File size: 2.8 KB
Line 
1//STARTHEADER
2// $Id: Subtractor.cc 999 2013-03-04 11:48:06Z pavel $
3//
4// Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. 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, see <http://www.gnu.org/licenses/>.
26//----------------------------------------------------------------------
27//ENDHEADER
28
29#include "fastjet/tools/Subtractor.hh"
30#include <cassert>
31#include <sstream>
32#include <limits>
33using namespace std;
34
35FASTJET_BEGIN_NAMESPACE     // defined in fastjet/internal/base.hh
36
37const double Subtractor::_invalid_rho = -numeric_limits<double>::infinity();
38
39
40Subtractor::Subtractor(double rho) : _bge(0), _rho(rho) {
41  assert(_rho>0.0);
42}
43
44PseudoJet Subtractor::result(const PseudoJet & jet) const {
45  if (!jet.has_area()){
46    throw Error("Trying to subtract a jet without area support");
47  }
48 
49  double rho;
50  if (_bge != 0) {
51    rho = _bge->rho(jet);
52  } else if (_rho != _invalid_rho) {
53    rho = _rho;
54  } else {
55    throw Error("default Subtractor does not have any information about the background, which is needed to perform the subtraction");
56  }
57
58  PseudoJet subtracted_jet = jet;
59  PseudoJet area4vect = jet.area_4vector();
60  // sanity check
61  if (rho*area4vect.perp() < jet.perp() ) { 
62    // this subtraction should retain the jet's structural
63    // information
64    subtracted_jet -= rho*area4vect;
65  } else { 
66    // this sets the jet's momentum to zero while
67    // maintaining all of the jet's structural information
68    subtracted_jet *= 0;
69  }
70  return subtracted_jet;
71}
72
73//----------------------------------------------------------------------
74std::string Subtractor::description() const{
75  if (_bge != 0) {
76    return "Subtractor that uses the following background estimator to determine rho: "+_bge->description();
77  } else if (_rho != _invalid_rho) {
78    ostringstream ostr;
79    ostr << "Subtractor that uses a fixed value of rho = " << _rho;
80    return ostr.str();
81  } else {
82    return "Uninitialised subtractor";
83  }
84}
85
86FASTJET_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.