rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_CONF_2012_104.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/IdentifiedFinalState.hh"
00010 #include "Rivet/Projections/VetoedFinalState.hh"
00011 #include "Rivet/Projections/FastJets.hh"
00012 
00013 namespace Rivet {
00014 
00015 
00016   class ATLAS_2012_CONF_2012_104 : public Analysis {
00017   public:
00018 
00019     /// @name Constructors etc.
00020     //@{
00021 
00022     /// Constructor
00023 
00024     ATLAS_2012_CONF_2012_104()
00025       : Analysis("ATLAS_2012_CONF_2012_104")
00026     {    }
00027 
00028     //@}
00029 
00030 
00031   public:
00032 
00033     /// @name Analysis methods
00034     //@{
00035 
00036     /// Book histograms and initialize projections before the run
00037     void init() {
00038 
00039       // projection to find the electrons
00040       vector<pair<double, double> > eta_e;
00041       eta_e.push_back(make_pair(-2.47,2.47));
00042       IdentifiedFinalState elecs(eta_e, 10.0*GeV);
00043       elecs.acceptIdPair(ELECTRON);
00044       addProjection(elecs, "elecs");
00045 
00046       // projection to find the muons
00047       vector<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       // Jet finder
00054       VetoedFinalState vfs;
00055       vfs.addVetoPairId(MUON);
00056       addProjection(FastJets(vfs, FastJets::ANTIKT, 0.4), "AntiKtJets04");
00057 
00058       // all tracks (to do deltaR with leptons)
00059       addProjection(ChargedFinalState(-3.0,3.0,0.5*GeV),"cfs");
00060 
00061       // for pTmiss
00062       addProjection(VisibleFinalState(-4.9,4.9),"vfs");
00063 
00064       // Book histograms
00065       _count_e  = bookHisto1D("count_e" , 1, 0., 1.);
00066       _count_mu = bookHisto1D("count_mu", 1, 0., 1.);
00067 
00068       _hist_eTmiss_e  = bookHisto1D("hist_eTmiss_e"  , 25, 0., 1000.);
00069       _hist_eTmiss_mu = bookHisto1D("hist_eTmiss_mu" , 25, 0., 1000.);
00070 
00071     }
00072 
00073     /// Perform the per-event analysis
00074     void analyze(const Event& event) {
00075       const double weight = event.weight();
00076 
00077       // get the candiate jets
00078       Jets cand_jets;
00079       foreach ( const Jet& jet,
00080                 applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00081         if ( fabs( jet.momentum().eta() ) < 2.8 ) {
00082           cand_jets.push_back(jet);
00083         }
00084       }
00085 
00086       // get the candidate "medium" leptons without isolation
00087       ParticleVector cand_e;
00088       foreach( const Particle & e,
00089                applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt()) {
00090         // remove any leptons within 0.4 of any candidate jets
00091         bool e_near_jet = false;
00092         foreach ( const Jet& jet, cand_jets ) {
00093           double dR = deltaR(e.momentum(),jet.momentum());
00094           if ( dR < 0.4 && dR > 0.2 ) {
00095             e_near_jet = true;
00096             break;
00097           }
00098         }
00099         if ( ! e_near_jet ) cand_e.push_back(e);
00100       }
00101       ParticleVector cand_mu;
00102       foreach( const Particle & mu,
00103                applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt()) {
00104         // remove any leptons within 0.4 of any candidate jets
00105         bool mu_near_jet = false;
00106         foreach ( const Jet& jet, cand_jets ) {
00107           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00108             mu_near_jet = true;
00109             break;
00110           }
00111         }
00112         if ( ! mu_near_jet ) cand_mu.push_back(mu);
00113       }
00114       // apply the isolation
00115       ParticleVector chg_tracks =
00116         applyProjection<ChargedFinalState>(event, "cfs").particles();
00117       // pTcone around muon track (hard)
00118       ParticleVector recon_mu;
00119       foreach ( const Particle & mu, cand_mu ) {
00120         double pTinCone = -mu.momentum().pT();
00121         if(-pTinCone<25.) continue;
00122         foreach ( const Particle & track, chg_tracks ) {
00123           if ( deltaR(mu.momentum(),track.momentum()) < 0.2 )
00124             pTinCone += track.momentum().pT();
00125         }
00126         if ( pTinCone < 1.8*GeV ) recon_mu.push_back(mu);
00127       }
00128       // pTcone around electron track (hard)
00129       ParticleVector recon_e;
00130       foreach ( const Particle & e, cand_e ) {
00131         double pTinCone = -e.momentum().pT();
00132         if(-pTinCone<25.) continue;
00133         foreach ( const Particle & track, chg_tracks ) {
00134           if ( deltaR(e.momentum(),track.momentum()) < 0.2 )
00135             pTinCone += track.momentum().pT();
00136         }
00137         if ( pTinCone < 0.1 * e.momentum().pT() ) recon_e.push_back(e);
00138       }
00139 
00140       // discard jets that overlap with electrons
00141       Jets recon_jets;
00142       foreach ( const Jet& jet, cand_jets ) {
00143         if(fabs(jet.momentum().eta())>2.5||
00144            jet.momentum().perp()<25.) continue;
00145         bool away_from_e = true;
00146         foreach ( const Particle & e, cand_e ) {
00147           if ( deltaR(e.momentum(),jet.momentum()) < 0.2 ) {
00148             away_from_e = false;
00149             break;
00150           }
00151         }
00152         if ( away_from_e ) recon_jets.push_back( jet );
00153       }
00154 
00155       // pTmiss
00156       FourMomentum pTmiss;
00157       foreach ( const Particle & p,
00158                 applyProjection<VisibleFinalState>(event, "vfs").particles() ) {
00159         pTmiss -= p.momentum();
00160       }
00161       double eTmiss = pTmiss.pT();
00162 
00163       // at least 4 jets with pT>80.
00164       if(recon_jets.size()<4 || recon_jets[3].momentum().perp()<80.) vetoEvent;
00165 
00166       // only 1 signal lepton
00167       if( recon_e.size() + recon_mu.size() != 1 )
00168         vetoEvent;
00169       if( cand_e .size() + cand_mu .size() != 1 )
00170         vetoEvent;
00171 
00172       // start of meff calculation
00173       double HT=0.;
00174       foreach( const Jet & jet, recon_jets) {
00175         double pT = jet.momentum().perp();
00176         if(pT>40.) HT += pT;
00177       }
00178 
00179       // get the lepton
00180       Particle lepton = recon_e.empty() ? recon_mu[0] : recon_e[0];
00181 
00182       // lepton variables
00183       double pT = lepton.momentum().perp();
00184 
00185       double mT  = 2.*(pT*eTmiss -
00186                        lepton.momentum().x()*pTmiss.x() -
00187                        lepton.momentum().y()*pTmiss.y());
00188       mT = sqrt(mT);
00189       HT += pT;
00190       double m_eff_inc  = HT + eTmiss + pT;
00191       double m_eff_4 = eTmiss + pT;
00192       for(unsigned int ix=0;ix<4;++ix)
00193         m_eff_4 +=  recon_jets[ix].momentum().perp();
00194 
00195       // four jet selecton
00196       if(mT>100.&& eTmiss/m_eff_4>0.2 &&
00197          m_eff_inc > 800.) {
00198         if( eTmiss > 250. ) {
00199           if(abs(lepton.pdgId())==ELECTRON)
00200             _count_e->fill(0.5,weight);
00201           else if(abs(lepton.pdgId())==MUON)
00202             _count_mu->fill(0.5,weight);
00203         }
00204         if(abs(lepton.pdgId())==ELECTRON)
00205           _hist_eTmiss_e ->fill(eTmiss,weight);
00206         else if(abs(lepton.pdgId())==MUON)
00207           _hist_eTmiss_mu->fill(eTmiss,weight);
00208       }
00209     }
00210     //@}
00211 
00212 
00213     void finalize() {
00214 
00215       double norm = 5.8* crossSection()/sumOfWeights()/femtobarn;
00216       scale(_count_e ,norm);
00217       scale(_count_mu,norm);
00218       scale(_hist_eTmiss_e  ,40.*norm);
00219       scale(_hist_eTmiss_mu ,40.*norm);
00220 
00221     }
00222 
00223   private:
00224 
00225     /// @name Histograms
00226     //@{
00227     Histo1DPtr _count_e ;
00228     Histo1DPtr _count_mu;
00229 
00230     Histo1DPtr _hist_eTmiss_e ;
00231     Histo1DPtr _hist_eTmiss_mu;
00232     //@}
00233 
00234   };
00235 
00236   // The hook for the plugin system
00237   DECLARE_RIVET_PLUGIN(ATLAS_2012_CONF_2012_104);
00238 
00239 }