rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1117704.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Tools/BinnedHistogram.hh"
00004 #include "Rivet/RivetYODA.hh"
00005 #include "Rivet/Tools/Logging.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/ChargedFinalState.hh"
00008 #include "Rivet/Projections/VisibleFinalState.hh"
00009 #include "Rivet/Projections/VetoedFinalState.hh"
00010 #include "Rivet/Projections/IdentifiedFinalState.hh"
00011 #include "Rivet/Projections/FastJets.hh"
00012 #include "Rivet/Tools/RivetMT2.hh"
00013 
00014 namespace Rivet {
00015 
00016 
00017   class ATLAS_2012_I1117704 : public Analysis {
00018   public:
00019 
00020     /// @name Constructors etc.
00021     //@{
00022 
00023     /// Constructor
00024     ATLAS_2012_I1117704()
00025       : Analysis("ATLAS_2012_I1117704")
00026     {    }
00027 
00028     //@}
00029 
00030 
00031   public:
00032 
00033     /// @name Analysis methods
00034     //@{
00035 
00036     /// Book histograms and initialise projections before the run
00037     void init() {
00038 
00039       // projection to find the electrons
00040       std::vector<std::pair<double, double> > eta_e;
00041       eta_e.push_back(make_pair(-2.47,2.47));
00042       IdentifiedFinalState elecs(eta_e, 20.0*GeV);
00043       elecs.acceptIdPair(ELECTRON);
00044       addProjection(elecs, "elecs");
00045 
00046       // projection to find the muons
00047       std::vector<std::pair<double, double> > eta_m;
00048       eta_m.push_back(make_pair(-2.4,2.4));
00049       IdentifiedFinalState muons(eta_m, 10.0*GeV);
00050       muons.acceptIdPair(MUON);
00051       addProjection(muons, "muons");
00052 
00053       // for pTmiss
00054       addProjection(VisibleFinalState(-4.9,4.9),"vfs");
00055 
00056       VetoedFinalState vfs;
00057       vfs.addVetoPairId(MUON);
00058 
00059       /// Jet finder
00060       addProjection(FastJets(vfs, FastJets::ANTIKT, 0.4),
00061                     "AntiKtJets04");
00062 
00063       // all tracks (to do deltaR with leptons)
00064       addProjection(ChargedFinalState(-3.0,3.0),"cfs");
00065 
00066       /// Book histograms
00067       _etmiss_HT_7j55 = bookHisto1D("etmiss_HT_7j55", 8, 0., 16.);
00068       _etmiss_HT_8j55 = bookHisto1D("etmiss_HT_8j55", 8, 0., 16.);
00069       _etmiss_HT_9j55 = bookHisto1D("etmiss_HT_9j55", 8, 0., 16.);
00070       _etmiss_HT_6j80 = bookHisto1D("etmiss_HT_6j80", 8, 0., 16.);
00071       _etmiss_HT_7j80 = bookHisto1D("etmiss_HT_7j80", 8, 0., 16.);
00072       _etmiss_HT_8j80 = bookHisto1D("etmiss_HT_8j80", 8, 0., 16.);
00073 
00074       _hist_njet55 = bookHisto1D("hist_njet55", 11, 2.5, 13.5);
00075       _hist_njet80 = bookHisto1D("hist_njet80", 11, 2.5, 13.5);
00076 
00077       _count_7j55 = bookHisto1D("count_7j55", 1, 0., 1.);
00078       _count_8j55 = bookHisto1D("count_8j55", 1, 0., 1.);
00079       _count_9j55 = bookHisto1D("count_9j55", 1, 0., 1.);
00080       _count_6j80 = bookHisto1D("count_6j80", 1, 0., 1.);
00081       _count_7j80 = bookHisto1D("count_7j80", 1, 0., 1.);
00082       _count_8j80 = bookHisto1D("count_8j80", 1, 0., 1.);
00083 
00084     }
00085 
00086 
00087     /// Perform the per-event analysis
00088     void analyze(const Event& event) {
00089       const double weight = event.weight();
00090 
00091       // get the jet candidates
00092       Jets cand_jets;
00093       foreach (const Jet& jet,
00094                applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00095         if ( fabs( jet.momentum().eta() ) < 2.8 ) {
00096           cand_jets.push_back(jet);
00097         }
00098       }
00099 
00100       // candidate muons
00101       ParticleVector cand_mu;
00102       ParticleVector chg_tracks =
00103         applyProjection<ChargedFinalState>(event, "cfs").particles();
00104       foreach ( const Particle & mu,
00105                 applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt() ) {
00106         double pTinCone = -mu.momentum().pT();
00107         foreach ( const Particle & track, chg_tracks ) {
00108           if ( deltaR(mu.momentum(),track.momentum()) <= 0.2 )
00109             pTinCone += track.momentum().pT();
00110         }
00111         if ( pTinCone < 1.8*GeV )
00112           cand_mu.push_back(mu);
00113       }
00114 
00115       // candidate electrons
00116       ParticleVector cand_e  =
00117         applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt();
00118 
00119       // resolve jet/lepton ambiguity
00120       Jets recon_jets;
00121       foreach ( const Jet& jet, cand_jets ) {
00122         // candidates after |eta| < 2.8
00123         if ( fabs( jet.momentum().eta() ) >= 2.8 ) continue;
00124         bool away_from_e = true;
00125         foreach ( const Particle & e, cand_e ) {
00126           if ( deltaR(e.momentum(),jet.momentum()) <= 0.2 ) {
00127             away_from_e = false;
00128             break;
00129           }
00130         }
00131         if ( away_from_e ) recon_jets.push_back( jet );
00132       }
00133 
00134       // only keep electrons more than R=0.4 from jets
00135       ParticleVector recon_e;
00136       foreach ( const Particle & e, cand_e ) {
00137         bool away = true;
00138         foreach ( const Jet& jet, recon_jets ) {
00139           if ( deltaR(e.momentum(),jet.momentum()) < 0.4 ) {
00140             away = false;
00141             break;
00142           }
00143         }
00144         if ( away )
00145           recon_e.push_back( e );
00146       }
00147 
00148       // only keep muons more than R=0.4 from jets
00149       ParticleVector recon_mu;
00150       foreach ( const Particle & mu, cand_mu ) {
00151         bool away = true;
00152         foreach ( const Jet& jet, recon_jets ) {
00153           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00154             away = false;
00155             break;
00156           }
00157         }
00158         if ( away )
00159           recon_mu.push_back( mu );
00160       }
00161 
00162       // pTmiss
00163       ParticleVector vfs_particles =
00164         applyProjection<VisibleFinalState>(event, "vfs").particles();
00165       FourMomentum pTmiss;
00166       foreach ( const Particle & p, vfs_particles ) {
00167         pTmiss -= p.momentum();
00168       }
00169       double eTmiss = pTmiss.pT();
00170 
00171       // now only use recon_jets, recon_mu, recon_e
00172 
00173       // reject events with electrons and muons
00174       if ( ! ( recon_mu.empty() && recon_e.empty() ) ) {
00175         MSG_DEBUG("Charged leptons left after selection");
00176         vetoEvent;
00177       }
00178 
00179       // calculate H_T
00180       double HT=0;
00181       foreach ( const Jet& jet, recon_jets ) {
00182         if ( jet.momentum().pT() > 40 * GeV )
00183           HT += jet.momentum().pT() ;
00184       }
00185 
00186       // number of jets
00187       unsigned int njet55=0, njet80=0;
00188       for (unsigned int ix=0;ix<recon_jets.size();++ix) {
00189         if(recon_jets[ix].momentum().pT()>80.*GeV) ++njet80;
00190         if(recon_jets[ix].momentum().pT()>55.*GeV) ++njet55;
00191       }
00192 
00193       if(njet55==0) vetoEvent;
00194 
00195       double ratio = eTmiss/sqrt(HT);
00196 
00197       if(ratio>4.) {
00198         _hist_njet55->fill(njet55,weight);
00199         _hist_njet80->fill(njet80,weight);
00200         // 7j55
00201         if(njet55>=7)
00202           _count_7j55->fill( 0.5, weight);
00203         // 8j55
00204         if(njet55>=8)
00205           _count_8j55->fill( 0.5, weight) ;
00206         // 8j55
00207         if(njet55>=9)
00208           _count_9j55->fill( 0.5, weight) ;
00209         // 6j80
00210         if(njet80>=6)
00211           _count_6j80->fill( 0.5, weight) ;
00212         // 7j80
00213         if(njet80>=7)
00214           _count_7j80->fill( 0.5, weight) ;
00215         // 8j80
00216         if(njet80>=8)
00217           _count_8j80->fill( 0.5, weight) ;
00218       }
00219 
00220       if(njet55>=7)
00221         _etmiss_HT_7j55->fill( ratio, weight);
00222       // 8j55
00223       if(njet55>=8)
00224         _etmiss_HT_8j55->fill( ratio, weight) ;
00225       // 8j55
00226       if(njet55>=9)
00227         _etmiss_HT_9j55->fill( ratio, weight) ;
00228       // 6j80
00229       if(njet80>=6)
00230         _etmiss_HT_6j80->fill( ratio, weight) ;
00231       // 7j80
00232       if(njet80>=7)
00233         _etmiss_HT_7j80->fill( ratio, weight) ;
00234       // 8j80
00235       if(njet80>=8)
00236         _etmiss_HT_8j80->fill( ratio, weight) ;
00237 
00238     }
00239 
00240     //@}
00241 
00242     void finalize() {
00243       double norm = crossSection()/femtobarn*4.7/sumOfWeights();
00244 
00245       scale(_etmiss_HT_7j55,2.*norm);
00246       scale(_etmiss_HT_8j55,2.*norm);
00247       scale(_etmiss_HT_9j55,2.*norm);
00248       scale(_etmiss_HT_6j80,2.*norm);
00249       scale(_etmiss_HT_7j80,2.*norm);
00250       scale(_etmiss_HT_8j80,2.*norm);
00251 
00252       scale(_hist_njet55,norm);
00253       scale(_hist_njet80,norm);
00254 
00255       scale(_count_7j55,norm);
00256       scale(_count_8j55,norm);
00257       scale(_count_9j55,norm);
00258       scale(_count_6j80,norm);
00259       scale(_count_7j80,norm);
00260       scale(_count_8j80,norm);
00261     }
00262 
00263   private:
00264 
00265     /// @name Histograms
00266     //@{
00267     Histo1DPtr _etmiss_HT_7j55;
00268     Histo1DPtr _etmiss_HT_8j55;
00269     Histo1DPtr _etmiss_HT_9j55;
00270     Histo1DPtr _etmiss_HT_6j80;
00271     Histo1DPtr _etmiss_HT_7j80;
00272     Histo1DPtr _etmiss_HT_8j80;
00273 
00274     Histo1DPtr _hist_njet55;
00275     Histo1DPtr _hist_njet80;
00276 
00277     Histo1DPtr _count_7j55;
00278     Histo1DPtr _count_8j55;
00279     Histo1DPtr _count_9j55;
00280     Histo1DPtr _count_6j80;
00281     Histo1DPtr _count_7j80;
00282     Histo1DPtr _count_8j80;
00283     //@}
00284 
00285   };
00286 
00287   // The hook for the plugin system
00288   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1117704);
00289 
00290 }