FastJet 3.0beta1
|
00001 //STARTHEADER 00002 // $Id: Subtractor.cc 2486 2011-08-02 09:38:36Z salam $ 00003 // 00004 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin Salam and Gregory Soyez 00005 // 00006 //---------------------------------------------------------------------- 00007 // This file is part of FastJet. 00008 // 00009 // FastJet is free software; you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation; either version 2 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // The algorithms that underlie FastJet have required considerable 00015 // development and are described in hep-ph/0512210. If you use 00016 // FastJet as part of work towards a scientific publication, please 00017 // include a citation to the FastJet paper. 00018 // 00019 // FastJet is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 // GNU General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with FastJet; if not, write to the Free Software 00026 // Foundation, Inc.: 00027 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00028 //---------------------------------------------------------------------- 00029 //ENDHEADER 00030 00031 #include "fastjet/tools/Subtractor.hh" 00032 #include <cassert> 00033 #include <sstream> 00034 #include <limits> 00035 using namespace std; 00036 00037 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00038 00039 const double Subtractor::_invalid_rho = -numeric_limits<double>::infinity(); 00040 00041 00042 Subtractor::Subtractor(double rho) : _bge(0), _rho(rho) { 00043 assert(_rho>0.0); 00044 } 00045 00046 PseudoJet Subtractor::result(const PseudoJet & jet) const { 00047 if (!jet.has_area()){ 00048 throw Error("Trying to subtract a jet without area support"); 00049 } 00050 00051 double rho; 00052 if (_bge != 0) { 00053 rho = _bge->rho(jet); 00054 } else if (_rho != _invalid_rho) { 00055 rho = _rho; 00056 } else { 00057 throw Error("default Subtractor does not have any information about the background, which is needed to perform the subtraction"); 00058 } 00059 00060 PseudoJet subtracted_jet = jet; 00061 PseudoJet area4vect = jet.area_4vector(); 00062 // sanity check 00063 if (rho*area4vect.perp() < jet.perp() ) { 00064 // this subtraction should retain the jet's structural 00065 // information 00066 subtracted_jet -= rho*area4vect; 00067 } else { 00068 // this sets the jet's momentum to zero while 00069 // maintaining all of the jet's structural information 00070 subtracted_jet *= 0; 00071 } 00072 return subtracted_jet; 00073 } 00074 00075 //---------------------------------------------------------------------- 00076 std::string Subtractor::description() const{ 00077 if (_bge != 0) { 00078 return "Subtractor that uses the following background estimator to determine rho: "+_bge->description(); 00079 } else if (_rho != _invalid_rho) { 00080 ostringstream ostr; 00081 ostr << "Subtractor that uses a fixed value of rho = " << _rho; 00082 return ostr.str(); 00083 } else { 00084 return "Uninitialised subtractor"; 00085 } 00086 } 00087 00088 FASTJET_END_NAMESPACE