FastJet 3.0beta1
12-boosted_higgs-old.cc
Go to the documentation of this file.
00001 //----------------------------------------------------------------------
00002 /// \file
00003 /// \page Example12old 12 - boosted Higgs tagging (old version)
00004 ///
00005 /// fastjet example program, illustration of carrying out boosted
00006 /// Higgs subjet ID analysis
00007 ///
00008 /// It illustrates two kinds of functionality: 
00009 ///
00010 ///  - following the decomposition of a jet into pieces
00011 ///  - following information on a b-tag through the jet
00012 ///
00013 /// This kind of functionality was used in arXiv:0802.2470
00014 /// (Butterworth, Davison, Rubin & Salam) for boosted Higgs searches,
00015 /// and related functionality was used in arXiv:0806.0848 (Kaplan,
00016 /// Rehermann, Schwartz & Tweedie) in searching for boosted tops
00017 /// (without b-tag assumptions).
00018 ///
00019 /// Note that this example is deprecated --- see 12-boosted_higgs.cc
00020 /// for the newest version --- so it is not built by default
00021 ///
00022 /// run it with    : ./12-boosted_higgs-old < data/HZ-event-Hmass115.dat
00023 ///
00024 /// Source code: 12-boosted_higgs-old.cc
00025 //----------------------------------------------------------------------
00026 
00027 
00028 //STARTHEADER
00029 // $Id: 12-boosted_higgs-old.cc 2409 2011-07-08 15:58:15Z soyez $
00030 //
00031 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin Salam and Gregory Soyez
00032 //
00033 //----------------------------------------------------------------------
00034 // This file is part of FastJet.
00035 //
00036 //  FastJet is free software; you can redistribute it and/or modify
00037 //  it under the terms of the GNU General Public License as published by
00038 //  the Free Software Foundation; either version 2 of the License, or
00039 //  (at your option) any later version.
00040 //
00041 //  The algorithms that underlie FastJet have required considerable
00042 //  development and are described in hep-ph/0512210. If you use
00043 //  FastJet as part of work towards a scientific publication, please
00044 //  include a citation to the FastJet paper.
00045 //
00046 //  FastJet is distributed in the hope that it will be useful,
00047 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00048 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00049 //  GNU General Public License for more details.
00050 //
00051 //  You should have received a copy of the GNU General Public License
00052 //  along with FastJet; if not, write to the Free Software
00053 //  Foundation, Inc.:
00054 //      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00055 //----------------------------------------------------------------------
00056 //ENDHEADER
00057 
00058 #include "fastjet/ClusterSequence.hh"
00059 #include <iostream> // needed for io
00060 #include <sstream>  // needed for internal io
00061 #include <iomanip>  
00062 #include <cmath>
00063 
00064 using namespace std;
00065 using namespace fastjet;
00066 
00067 
00068 //----------------------------------------------------------------------
00069 // set up a class to give standard (by default E-scheme)
00070 // recombination, with additional tracking of flavour information in
00071 // the user_index. 
00072 //
00073 // b-tagged particles are assumed to have their user_index set to 1,
00074 // and other particles should have user_index to 0.
00075 //
00076 // Watch out however that, by default, the user_index of a particle is
00077 // set to -1 and you may not have control over that (e.g. if you
00078 // compute the jet area using explicit ghosts, the ghosts will have a
00079 // default user_index of -1). For that reason, if one of the particle
00080 // being combined has a user index of -1, we assume it is not b-tagged
00081 // (i.e. we count it as 0 in the recombination)
00082 //
00083 // This will work for native algorithms, but not for all plugins
00084 //----------------------------------------------------------------------
00085 typedef JetDefinition::DefaultRecombiner DefRecomb;
00086 
00087 class FlavourRecombiner : public  DefRecomb {
00088 public:
00089   FlavourRecombiner(RecombinationScheme recomb_scheme = E_scheme) : 
00090     DefRecomb(recomb_scheme) {};
00091 
00092   virtual std::string description() const {
00093     return DefRecomb::description()+" (with user index addition)";}
00094 
00095   /// recombine pa and pb and put result into pab
00096   virtual void recombine(const PseudoJet & pa, const PseudoJet & pb, 
00097                          PseudoJet & pab) const {
00098     DefRecomb::recombine(pa,pb,pab);
00099     // Note: see the above discussion for the fact that we consider
00100     // negative user indices as "0"
00101     pab.set_user_index(max(pa.user_index(),0) + max(pb.user_index(),0));
00102   }
00103 };
00104 
00105 
00106 //----------------------------------------------------------------------
00107 // forward declaration for printing out info about a jet
00108 //----------------------------------------------------------------------
00109 ostream & operator<<(ostream &, PseudoJet &);
00110 
00111 
00112 //----------------------------------------------------------------------
00113 // core of the program
00114 //----------------------------------------------------------------------
00115 int main (int argc, char ** argv) {
00116 
00117   vector<PseudoJet> particles;
00118 
00119   // read in data in format px py pz E b-tag [last of these is optional]
00120   // lines starting with "#" are considered as comments and discarded
00121   //----------------------------------------------------------
00122 
00123   string line;
00124   while (getline(cin,line)) {
00125     if (line.substr(0,1) == "#") {continue;}
00126     istringstream linestream(line);
00127     double px,py,pz,E;
00128     linestream >> px >> py >> pz >> E;
00129 
00130     // optionally read in btag information
00131     int    btag;
00132     if (! (linestream >> btag)) btag = 0;
00133 
00134     // construct the particle
00135     PseudoJet particle(px,py,pz,E);
00136     particle.set_user_index(btag); // btag info goes in user index, for flavour tracking
00137     particles.push_back(particle);
00138   }
00139 
00140 
00141   // set up the jet finding
00142   //
00143   // This also shows how to use the "FlavourRecombiner" user-defined
00144   // recombiner 
00145   // ----------------------------------------------------------
00146   double R = 1.2;
00147   FlavourRecombiner flav_recombiner; // for tracking flavour
00148   JetDefinition jet_def(cambridge_algorithm, R, &flav_recombiner);
00149 
00150   
00151   // run the jet finding; find the hardest jet
00152   ClusterSequence cs(particles, jet_def);
00153   vector<PseudoJet> jets = sorted_by_pt(cs.inclusive_jets());
00154 
00155   cout << "Ran: " << jet_def.description() << endl << endl;
00156   cout << "Hardest jet: " << jets[0] << endl << endl;
00157 
00158   // now do the subjet decomposition
00159   //----------------------------------------------------------
00160   //
00161   // when unpeeling a C/A jet, often only a very soft piece may break off;
00162   // the mass_drop_threshold indicates how much "lighter" the heavier of the two
00163   // resulting pieces must be in order for us to consider that we've really
00164   // seen some form of substructure
00165   double mass_drop_threshold = 0.667; 
00166   // QCD backgrounds that give larger jet masses have a component
00167   // where a quite soft gluon is emitted; to eliminate part of this
00168   // one can place a cut on the asymmetry of the branching; 
00169   //
00170   // Here the cut is expressed in terms of y, the kt-distance scaled
00171   // to the squared jet mass; an easier way to see it is in terms of
00172   // a requirement on the momentum fraction in the splitting: z/(1-z)
00173   // and (1-z)/z > rtycut^2 [the correspondence holds only at LO]
00174   double rtycut              = 0.3;
00175 
00176   PseudoJet this_jet = jets[0];
00177   PseudoJet parent1, parent2;
00178   bool had_parents;
00179 
00180   while ((had_parents = this_jet.has_parents(parent1,parent2))) {
00181     // make parent1 the more massive jet
00182     if (parent1.m() < parent2.m()) swap(parent1,parent2);
00183 
00184     // if we pass the conditions on the mass drop and its degree of
00185     // asymmetry (z/(1-z) \sim kt_dist/m^2 > rtycut), then we've found
00186     // something interesting, so exit the loop
00187     if (parent1.m() < mass_drop_threshold * this_jet.m() &&
00188         parent1.kt_distance(parent2) > pow(rtycut,2) * this_jet.m2()) {
00189       break;
00190     } else {
00191       // otherwise try a futher decomposition on the more massive jet
00192       this_jet = parent1;
00193     }
00194   }
00195 
00196   // look to see what we found
00197   if (!had_parents) {
00198     cout << "Did not find suitable hard substructure in this event." << endl;
00199     return 0;
00200   }
00201 
00202   cout << "Found suitable pair of subjets: " << endl;
00203   cout << " " << parent1 << endl;
00204   cout << " " << parent2 << endl;
00205   cout << "Total = " << endl;
00206   cout << " " << this_jet << endl << endl;
00207 
00208   // next we "filter" it, to remove UE & pileup contamination
00209   //----------------------------------------------------------
00210   //
00211   // [there are two ways of doing this; here we directly use the
00212   // exsiting cluster sequence and find the exclusive subjets of
00213   // this_jet (i.e. work backwards within the cs starting from
00214   // this_jet); alternatively one can recluster just the
00215   // constituents of the jet]
00216   //
00217   // first get separation between the subjets (called Rbb -- assuming it's a Higgs!)
00218   double   Rbb = sqrt(parent1.squared_distance(parent2));
00219   double   Rfilt = min(Rbb/2, 0.3); // somewhat arbitrary choice
00220   unsigned nfilt = 3;               // number of pieces we'll take
00221   cout << "Subjet separation (Rbb) = " << Rbb << ", Rfilt = " << Rfilt << endl;
00222 
00223   double   dcut  = pow(Rfilt/R,2);  // for C/A get a view at Rfilt by
00224   // using a dcut=(Rfilt/R)^2
00225   vector<PseudoJet> filt_subjets = sorted_by_pt(this_jet.exclusive_subjets(dcut));
00226 
00227   // now print out the filtered jets and reconstruct total 
00228   // at the same time
00229   cout << "Filtered pieces are " << endl;
00230   cout << " " << filt_subjets[0] << endl;
00231   PseudoJet filtered_total = filt_subjets[0];
00232   for (unsigned i = 1; i < nfilt && i < filt_subjets.size(); i++) {
00233     cout << " " << filt_subjets[i] << endl;
00234     flav_recombiner.plus_equal(filtered_total, filt_subjets[i]);
00235   }
00236   cout << "Filtered total is " << endl;
00237   cout << " " << filtered_total << endl;
00238 
00239 }
00240 
00241 
00242 //----------------------------------------------------------------------
00243 // does the actual work for printing out a jet
00244 //----------------------------------------------------------------------
00245 ostream & operator<<(ostream & ostr, PseudoJet & jet) {
00246   ostr << "pt, y, phi =" 
00247        << " " << setw(10) << jet.perp() 
00248        << " " << setw(6) <<  jet.rap()  
00249        << " " << setw(6) <<  jet.phi()  
00250        << ", mass = " << setw(10) << jet.m()
00251        << ", btag = " << jet.user_index();
00252   return ostr;
00253 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends