|
FastJet 3.0alpha3
|
00001 //STARTHEADER 00002 // $Id: NSubjettinessTagger.cc 2209 2011-06-02 19:47:54Z soyez $ 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/NSubjettinessTagger.hh> 00032 #include <fastjet/tools/Boost.hh> 00033 #include <fastjet/ClusterSequence.hh> 00034 #include <sstream> 00035 00036 using namespace fastjet; 00037 using namespace std; 00038 00039 //------------------------------------------------------------------------ 00040 // NSubjettinessTagger class implementation 00041 //------------------------------------------------------------------------ 00042 00043 //------------------------------------------------------------------------ 00044 // tagger description 00045 string NSubjettinessTagger::description() const{ 00046 ostringstream oss; 00047 oss << "NSubjettiness cut with tau_2<" << _t2cut 00048 << " and cos(theta_s)<" << _costscut; 00049 return oss.str(); 00050 } 00051 00052 00053 //------------------------------------------------------------------------ 00054 // action on a single jet 00055 PseudoJet NSubjettinessTagger::result(const PseudoJet & jet) const{ 00056 // make sure that the jet has constituents 00057 if (!jet.has_constituents()) 00058 throw("The jet you try to tag needs to have accessible constituents"); 00059 00060 // get the constituents and boost them into the rest frame of the jet 00061 vector<PseudoJet> rest_input = jet.constituents(); 00062 for (unsigned int i=0; i<rest_input.size(); i++) 00063 rest_input[i].unboost(jet); 00064 00065 ClusterSequence cs_rest(rest_input, _subjet_def); 00066 vector<PseudoJet> subjets = (_use_exclusive) 00067 ? cs_rest.exclusive_jets(2) 00068 : sorted_by_E(cs_rest.inclusive_jets()); 00069 00070 // impose the cuts in the rest-frame 00071 if (subjets.size()<2) return PseudoJet(); 00072 00073 const PseudoJet &j0 = subjets[0]; 00074 const PseudoJet &j1 = subjets[1]; 00075 00076 /// impose the cut on cos(theta_s) 00077 double ct0 = (j0.px()*jet.px() + j0.py()*jet.py() + j0.pz()*jet.pz()) 00078 /sqrt(j0.modp2()*jet.modp2()); 00079 double ct1 = (j1.px()*jet.px() + j1.py()*jet.py() + j1.pz()*jet.pz()) 00080 /sqrt(j1.modp2()*jet.modp2()); 00081 if ((ct0 > _costscut) || (ct1 > _costscut)) return PseudoJet(); 00082 00083 // ccompute the 2-subjettiness and impose the coresponding cut 00084 double tau2 = 0.0; 00085 for (unsigned int i=0; i<rest_input.size(); i++) 00086 tau2 += min(dot_product(rest_input[i], j0), 00087 dot_product(rest_input[i], j1)); 00088 00089 tau2 *= (2.0/jet.m2()); 00090 00091 if (tau2 > _t2cut) return PseudoJet(); 00092 00093 // We have a positive tag, 00094 // - boost everything back into the lab frame 00095 // - record the info in the interface 00096 // Note that in order to point to the correct Clustersequence, the 00097 // subjets must be taken from the boosted one. We extract that 00098 // through the history index of the rest-frame subjets 00099 ClusterSequence * cs_structure = new ClusterSequence(); 00100 Boost boost(jet); 00101 cs_structure->transfer_from_sequence(cs_rest, &boost); 00102 PseudoJet subjet_lab1 = cs_structure->jets()[cs_rest.history()[subjets[0].cluster_hist_index()].jetp_index]; 00103 PseudoJet subjet_lab2 = cs_structure->jets()[cs_rest.history()[subjets[0].cluster_hist_index()].jetp_index]; 00104 00105 PseudoJet result = join<StructureType>(subjet_lab1,subjet_lab2); 00106 StructureType * s = (StructureType *) result.structure_non_const_ptr(); 00107 s->_tau2 = tau2; 00108 s->_costhetas = max(ct0, ct1); 00109 00110 // keep the rest-frame CS alive 00111 cs_structure->delete_self_when_unused(); 00112 00113 return result; 00114 }
1.7.4