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