fastjet 2.4.5
fastjet_boosted_higgs.cc
Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: fastjet_boosted_higgs.cc 1701 2010-03-08 18:24:09Z salam $
00003 //
00004 // Copyright (c) 2005-2008, 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 
00032 //----------------------------------------------------------------------
00033 // fastjet example program, illustration of carrying out boosted
00034 // Higgs subjet ID analysis
00035 //
00036 // It illustrates two kinds of functionality: 
00037 //
00038 //  - following the decomposition of a jet into pieces
00039 //  - following information on a b-tag through the jet
00040 //
00041 // This kind of functionality was used in arXiv:0802.2470
00042 // (Butterworth, Davison, Rubin & Salam) for boosted Higgs searches,
00043 // and related functionality was used in arXiv:0806.0848 (Kaplan,
00044 // Rehermann, Schwartz & Tweedie) in searching for boosted tops
00045 // (without b-tag assumptions).
00046 
00047 // Compile it with: make fastjet_boosted_higgs
00048 // run it with    : ./fastjet_boosted_higgs < data/HZ-event-Hmass115.dat
00049 //
00050 //----------------------------------------------------------------------
00051 
00052 #include "fastjet/ClusterSequence.hh"
00053 #include<iostream> // needed for io
00054 #include<sstream>  // needed for internal io
00055 #include<iomanip>  
00056 #include<cmath>
00057 
00058 using namespace std;
00059 namespace fj = fastjet;
00060 
00061 
00062 
00063 
00064 //----------------------------------------------------------------------
00073 typedef fj::JetDefinition::DefaultRecombiner DefRecomb;
00074 class FlavourRecombiner : public  DefRecomb {
00075 public:
00076   FlavourRecombiner(fj::RecombinationScheme recomb_scheme = fj::E_scheme) : 
00077     DefRecomb(recomb_scheme) {};
00078 
00079   virtual std::string description() const {return DefRecomb::description()
00080       +" (with user index addition)";}
00081 
00083   virtual void recombine(const fj::PseudoJet & pa, 
00084                          const fj::PseudoJet & pb, 
00085                          fj::PseudoJet & pab) const {
00086     DefRecomb::recombine(pa,pb,pab);
00087     pab.set_user_index(pa.user_index() + pb.user_index());
00088   }
00089 
00090 };
00091 
00092 
00094 ostream & operator<<(ostream &, fj::PseudoJet &);
00095 
00096 
00097 //----------------------------------------------------------------------
00098 int main (int argc, char ** argv) {
00099   
00100   vector<fj::PseudoJet> particles;
00101 
00102   // read in data in format px py pz E b-tag [last of these is optional]
00103   string line;
00104   while (getline(cin,line)) {
00105     if (line.substr(0,1) == "#") {continue;}
00106     istringstream linestream(line);
00107     double px,py,pz,E;
00108     linestream >> px >> py >> pz >> E;
00109 
00110     // optionally read in btag information
00111     int    btag;
00112     if (! (linestream >> btag)) btag = 0;
00113 
00114     // construct the particle
00115     fj::PseudoJet particle(px,py,pz,E);
00116     particle.set_user_index(btag); // btag info goes in user index, for flavour tracking
00117     particles.push_back(particle);
00118   }
00119 
00120 
00121   // set up the jet finding
00122   double R = 1.2;
00123   FlavourRecombiner flav_recombiner; // for tracking flavour
00124   fj::JetDefinition jet_def(fj::cambridge_algorithm, R, &flav_recombiner);
00125 
00126   
00127   // run the jet finding; find the hardest jet
00128   fj::ClusterSequence cs(particles, jet_def);
00129   vector<fj::PseudoJet> jets = sorted_by_pt(cs.inclusive_jets());
00130 
00131 
00132   cout << "Ran: " << jet_def.description() << endl << endl;
00133   cout << "Hardest jet: " << jets[0] << endl << endl;
00134 
00135 
00137   //
00142   double mass_drop_threshold = 0.667; 
00151   double rtycut              = 0.3;
00152 
00153   fj::PseudoJet this_jet = jets[0], parent1, parent2;
00154   bool had_parents;
00155 
00156   while ((had_parents = cs.has_parents(this_jet,parent1,parent2))) {
00157     // make parent1 the more massive jet
00158     if (parent1.m() < parent2.m()) swap(parent1,parent2);
00159     //
00160     // if we pass the conditions on the mass drop and its degree of
00161     // asymmetry (z/(1-z) \sim kt_dist/m^2 > rtycut), then we've found
00162     // something interesting, so exit the loop
00163     if (parent1.m() < mass_drop_threshold * this_jet.m() &&
00164         parent1.kt_distance(parent2) > pow(rtycut,2) * this_jet.m2()) {
00165       break;
00166     } else {
00167       // otherwise try a futher decomposition on the more massive jet
00168       this_jet = parent1;
00169     }
00170   }
00171 
00172   // look to see what we found
00173   if (had_parents) {
00174     cout << "Found suitable pair of subjets: " << endl;
00175     cout << " " << parent1 << endl;
00176     cout << " " << parent2 << endl;
00177     cout << "Total = " << endl;
00178     cout << " " << this_jet << endl << endl;
00179 
00180     // next we "filter" it, to remove UE & pileup contamination
00181     //
00182     // [there are two ways of doing this; here we directly use the
00183     // exsiting cluster sequence and find the exclusive subjets of
00184     // this_jet (i.e. work backwards within the cs starting from
00185     // this_jet); alternatively one can recluster just the
00186     // constituents of the jet]
00187     //
00188     // first get separation between the subjets (called Rbb -- assuming it's a Higgs!)
00189     double   Rbb = sqrt(parent1.squared_distance(parent2));
00190     double   Rfilt = min(Rbb/2, 0.3); // somewhat arbitrary choice
00191     unsigned nfilt = 3;               // number of pieces we'll take
00192     cout << "Subjet separation (Rbb) = " << Rbb << ", Rfilt = " << Rfilt << endl;
00193 
00194     double   dcut  = pow(Rfilt/R,2);  // for C/A get a view at Rfilt by
00195                                     // using a dcut=(Rfilt/R)^2
00196     vector<fj::PseudoJet> filt_subjets = sorted_by_pt(cs.exclusive_subjets(this_jet, dcut));
00197 
00198     // now print out the filtered jets and reconstruct total 
00199     // at the same time
00200     cout << "Filtered pieces are " << endl;
00201     cout << " " << filt_subjets[0] << endl;
00202     fj::PseudoJet filtered_total = filt_subjets[0];
00203     for (unsigned i = 1; i < nfilt && i < filt_subjets.size(); i++) {
00204       cout << " " << filt_subjets[i] << endl;
00205       flav_recombiner.plus_equal(filtered_total, filt_subjets[i]);
00206     }
00207     cout << "Filtered total is " << endl;
00208     cout << " " << filtered_total << endl;
00209 
00210   } else {
00211     cout << "Did not find suitable hard substructure in this event." << endl;
00212   }
00213 }
00214 
00215 
00217 ostream & operator<<(ostream & ostr, fj::PseudoJet & jet) {
00218   ostr << "pt, y, phi =" 
00219        << " " << setw(10) << jet.perp() 
00220        << " " << setw(6) <<  jet.rap()  
00221        << " " << setw(6) <<  jet.phi()  
00222        << ", mass = " << setw(10) << jet.m()
00223        << ", btag = " << jet.user_index();
00224   return ostr;
00225 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines