rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1186556.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/IdentifiedFinalState.hh"
00008 #include "Rivet/Projections/VetoedFinalState.hh"
00009 #include "Rivet/Projections/FastJets.hh"
00010 #include "Rivet/Tools/RivetMT2.hh"
00011 
00012 namespace Rivet {
00013 
00014 
00015   class ATLAS_2012_I1186556 : public Analysis {
00016   public:
00017 
00018     /// Constructor
00019     ATLAS_2012_I1186556()
00020       : Analysis("ATLAS_2012_I1186556")
00021     {    }
00022 
00023 
00024     /// @name Analysis methods
00025     //@{
00026 
00027     /// Book histograms and initialize projections before the run
00028     void init() {
00029 
00030       // projection to find the electrons
00031       IdentifiedFinalState elecs(Cuts::abseta < 2.47 && Cuts::pT > 20*GeV);
00032       elecs.acceptIdPair(PID::ELECTRON);
00033       addProjection(elecs, "elecs");
00034 
00035       // projection to find the muons
00036       IdentifiedFinalState muons(Cuts::abseta < 2.4 && Cuts::pT > 10*GeV);
00037       muons.acceptIdPair(PID::MUON);
00038       addProjection(muons, "muons");
00039 
00040       // Jet finder
00041       VetoedFinalState vfs;
00042       vfs.addVetoPairId(PID::MUON);
00043       addProjection(FastJets(vfs, FastJets::ANTIKT, 0.4), "AntiKtJets04");
00044 
00045       // all tracks (to do deltaR with leptons)
00046       addProjection(ChargedFinalState(Cuts::abseta < 3.0 && Cuts::pT > 1*GeV), "cfs");
00047 
00048       // for pTmiss
00049       addProjection(VisibleFinalState(Cuts::abseta < 4.9),"vfs");
00050 
00051       // Book histograms
00052       _count_SR_SF     = bookHisto1D("count_SR_SF"    , 1, 0., 1.);
00053       _count_SR_OF     = bookHisto1D("count_SR_OF"    , 1, 0., 1.);
00054 
00055       _hist_mT2_SF_exp = bookHisto1D("hist_mT2_SF_exp", 40 , 0., 200. );
00056       _hist_mT2_OF_exp = bookHisto1D("hist_mT2_OF_exp", 40 , 0., 200. );
00057       _hist_mT2_SF_MC  = bookHisto1D("hist_mT2_SF_MC" , 500, 0., 1000.);
00058       _hist_mT2_OF_MC  = bookHisto1D("hist_mT2_OF_MC" , 500, 0., 1000.);
00059 
00060     }
00061 
00062     /// Perform the per-event analysis
00063     void analyze(const Event& event) {
00064       const double weight = event.weight();
00065 
00066       // get the candiate jets
00067       Jets cand_jets;
00068       foreach ( const Jet& jet,
00069                 applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00070         if ( fabs( jet.eta() ) < 4.5 ) {
00071           cand_jets.push_back(jet);
00072         }
00073       }
00074       // charged tracks for isolation
00075       Particles chg_tracks =
00076         applyProjection<ChargedFinalState>(event, "cfs").particles();
00077       // find the electrons
00078       Particles cand_e;
00079       foreach( const Particle & e,
00080                applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt()) {
00081         // remove any leptons within 0.4 of any candidate jets
00082         bool e_near_jet = false;
00083         foreach ( const Jet& jet, cand_jets ) {
00084           double dR = deltaR(e.momentum(),jet.momentum());
00085           if ( dR < 0.4 && dR > 0.2 ) {
00086             e_near_jet = true;
00087             break;
00088           }
00089         }
00090     if ( e_near_jet ) continue;
00091     cand_e.push_back(e);
00092       }
00093       Particles cand_mu;
00094       foreach( const Particle & mu,
00095                applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt()) {
00096         // remove any leptons within 0.4 of any candidate jets
00097         bool mu_near_jet = false;
00098         foreach ( const Jet& jet, cand_jets ) {
00099           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00100             mu_near_jet = true;
00101             break;
00102           }
00103         }
00104         if ( mu_near_jet ) continue;
00105     cand_mu.push_back(mu);
00106       }
00107       // pTcone around muon track
00108       Particles recon_mu;
00109       foreach ( const Particle & mu, cand_mu ) {
00110         double pTinCone = -mu.pT();
00111         foreach ( const Particle & track, chg_tracks ) {
00112           if ( deltaR(mu.momentum(),track.momentum()) < 0.2 )
00113             pTinCone += track.pT();
00114         }
00115         if ( pTinCone < 1.8*GeV ) recon_mu.push_back(mu);
00116       }
00117       // pTcone around electron track
00118       Particles recon_e;
00119       foreach ( const Particle & e, cand_e ) {
00120         double pTinCone = -e.pT();
00121         foreach ( const Particle & track, chg_tracks ) {
00122           if ( deltaR(e.momentum(),track.momentum()) < 0.2 )
00123             pTinCone += track.pT();
00124         }
00125         if ( pTinCone < 0.1 * e.pT() ) recon_e.push_back(e);
00126       }
00127 
00128       // pTmiss
00129       FourMomentum pTmiss;
00130       foreach ( const Particle & p,
00131                 applyProjection<VisibleFinalState>(event, "vfs").particles() ) {
00132         pTmiss -= p.momentum();
00133       }
00134 
00135       // discard jets that overlap with electrons
00136       Jets recon_jets;
00137       foreach ( const Jet& jet, cand_jets ) {
00138         if(jet.abseta()>2.5||
00139            jet.perp()<20.) continue;
00140     bool away_from_e = true;
00141     foreach ( const Particle & e, cand_e ) {
00142       if ( deltaR(e.momentum(),jet.momentum()) < 0.2 ) {
00143         away_from_e = false;
00144         break;
00145       }
00146     }
00147     if ( away_from_e ) recon_jets.push_back( jet );
00148       }
00149 
00150       // put leptons into 1 vector and order by pT
00151       Particles leptons(recon_e.begin(),recon_e.end());
00152       leptons.insert(leptons.begin(),recon_mu.begin(),recon_mu.end());
00153       sort(leptons.begin(),leptons.end(),cmpMomByPt);
00154 
00155       // exactly two leptons
00156       if(leptons.size() !=2) vetoEvent;
00157 
00158       // hardest lepton pT greater the 25 (20) e(mu)
00159       if( (leptons[0].abspid()==PID::ELECTRON && leptons[0].perp()<25.) ||
00160       (leptons[0].abspid()==PID::ELECTRON && leptons[0].perp()<20.))
00161     vetoEvent;
00162 
00163       // require opposite sign
00164       if(leptons[0].pid()*leptons[1].pid()>0) vetoEvent;
00165 
00166       // and invariant mass > 20
00167       double mll = (leptons[0].momentum()+leptons[1].momentum()).mass();
00168       if(mll<20.) vetoEvent;
00169 
00170       // two jets 1st pT > 50 and second pT> 25
00171       if(recon_jets.size()<2 || recon_jets[0].perp()<50. ||
00172      recon_jets[1].perp()<25.) vetoEvent;
00173 
00174       // calculate mT2
00175       double m_T2 = mT2::mT2( leptons[0].momentum(),leptons[1].momentum(),
00176                   pTmiss,0.0 ); // zero mass invisibles
00177 
00178       // same flavour region
00179       if(leptons[0].pid()==-leptons[1].pid()) {
00180     // remove Z region
00181     if(mll>71.&&mll<111.) vetoEvent;
00182     // require at least 1 b jet
00183     unsigned int n_b=0;
00184     for(unsigned int ix=0;ix<recon_jets.size();++ix) {
00185        if(recon_jets[ix].bTagged() && rand()/static_cast<double>(RAND_MAX)<=0.60)
00186          ++n_b;
00187     }
00188     if(n_b==0) vetoEvent;
00189     _hist_mT2_SF_exp->fill(m_T2,weight);
00190     _hist_mT2_SF_MC ->fill(m_T2,weight);
00191     if(m_T2>120.) _count_SR_SF->fill(0.5,weight);
00192       }
00193       // opposite flavour region
00194       else {
00195     _hist_mT2_OF_exp->fill(m_T2,weight);
00196     _hist_mT2_OF_MC ->fill(m_T2,weight);
00197     if(m_T2>120.) _count_SR_OF->fill(0.5,weight);
00198       }
00199     }
00200     //@}
00201 
00202 
00203     void finalize() {
00204 
00205       double norm = 4.7* crossSection()/sumOfWeights()/femtobarn;
00206       scale(_count_SR_SF    ,   norm);
00207       scale(_count_SR_OF    ,   norm);
00208       scale(_hist_mT2_SF_exp,5.*norm);
00209       scale(_hist_mT2_OF_exp,5.*norm);
00210       scale(_hist_mT2_SF_MC ,   norm/4.7);
00211       scale(_hist_mT2_OF_MC ,   norm/4.7);
00212 
00213     }
00214 
00215   private:
00216 
00217     /// @name Histograms
00218     //@{
00219     Histo1DPtr _count_SR_SF;
00220     Histo1DPtr _count_SR_OF;
00221 
00222     Histo1DPtr _hist_mT2_SF_exp;
00223     Histo1DPtr _hist_mT2_OF_exp;
00224     Histo1DPtr _hist_mT2_SF_MC;
00225     Histo1DPtr _hist_mT2_OF_MC;
00226     //@}
00227 
00228   };
00229 
00230   // The hook for the plugin system
00231   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1186556);
00232 
00233 }