rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1190891.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   using namespace Cuts;
00015 
00016   /// @author Peter Richardson
00017   class ATLAS_2012_I1190891 : public Analysis {
00018   public:
00019 
00020     /// @name Constructors etc.
00021     //@{
00022 
00023     /// Constructor
00024     ATLAS_2012_I1190891()
00025       : Analysis("ATLAS_2012_I1190891")
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       IdentifiedFinalState elecs(etaIn(-2.47, 2.47) 
00041                  & (pT >= 10.0*GeV));
00042       elecs.acceptIdPair(PID::ELECTRON);
00043       addProjection(elecs, "elecs");
00044 
00045       // projection to find the muons
00046       IdentifiedFinalState muons(etaIn(-2.4, 2.4) 
00047                  & (pT >= 10.0*GeV));
00048       muons.acceptIdPair(PID::MUON);
00049       addProjection(muons, "muons");
00050 
00051       // for pTmiss
00052       addProjection(VisibleFinalState(-4.9,4.9),"vfs");
00053 
00054       VetoedFinalState vfs;
00055       vfs.addVetoPairId(PID::MUON);
00056 
00057       /// Jet finder
00058       addProjection(FastJets(vfs, FastJets::ANTIKT, 0.4),
00059                     "AntiKtJets04");
00060 
00061       // all tracks (to do deltaR with leptons)
00062       addProjection(ChargedFinalState(-3.0,3.0),"cfs");
00063 
00064       // Book histograms
00065       _hist_etmiss = bookHisto1D("hist_etmiss",10,0.,500.);
00066       _hist_meff   = bookHisto1D("hist_m_eff",7,0.,1050.);
00067       _count_SR1 = bookHisto1D("count_SR1", 1, 0., 1.);
00068       _count_SR2 = bookHisto1D("count_SR2", 1, 0., 1.);
00069     }
00070 
00071 
00072     /// Perform the per-event analysis
00073     void analyze(const Event& event) {
00074       const double weight = event.weight();
00075       // get the jet candidates
00076       Jets cand_jets;
00077       foreach (const Jet& jet,
00078                applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00079         if ( fabs( jet.eta() ) < 2.5 ) {
00080           cand_jets.push_back(jet);
00081         }
00082       }
00083 
00084       // candidate muons
00085       Particles cand_mu;
00086       Particles chg_tracks =
00087         applyProjection<ChargedFinalState>(event, "cfs").particles();
00088       foreach ( const Particle & mu,
00089                 applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt() ) {
00090         double pTinCone = -mu.pT();
00091         foreach ( const Particle & track, chg_tracks ) {
00092           if ( deltaR(mu.momentum(),track.momentum()) <= 0.2 )
00093             pTinCone += track.pT();
00094         }
00095         if ( pTinCone < 1.8*GeV )
00096           cand_mu.push_back(mu);
00097       }
00098 
00099       // candidate electrons
00100       Particles cand_e;
00101       foreach ( const Particle & e,
00102                 applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt() ) {
00103         double pTinCone = -e.perp();
00104         foreach ( const Particle & track, chg_tracks ) {
00105           if ( deltaR(e.momentum(),track.momentum()) <= 0.2 )
00106             pTinCone += track.pT();
00107         }
00108         if (pTinCone/e.perp()<0.1) {
00109           cand_e.push_back(e);
00110         }
00111       }
00112 
00113       // resolve jet/lepton ambiguity
00114       Jets recon_jets;
00115       foreach ( const Jet& jet, cand_jets ) {
00116         bool away_from_e = true;
00117         foreach ( const Particle & e, cand_e ) {
00118           if ( deltaR(e.momentum(),jet.momentum()) <= 0.2 ) {
00119             away_from_e = false;
00120             break;
00121           }
00122         }
00123         if ( away_from_e )
00124           recon_jets.push_back( jet );
00125       }
00126 
00127       // only keep electrons more than R=0.4 from jets
00128       Particles cand2_e;
00129       for(unsigned int ie=0;ie<cand_e.size();++ie) {
00130         const Particle & e = cand_e[ie];
00131         // at least 0.4 from any jets
00132         bool away = true;
00133         foreach ( const Jet& jet, recon_jets ) {
00134           if ( deltaR(e.momentum(),jet.momentum()) < 0.4 ) {
00135             away = false;
00136             break;
00137           }
00138         }
00139         // and 0.1 from any muons
00140         if ( away ) {
00141           foreach ( const Particle & mu, cand_mu ) {
00142             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00143               away = false;
00144               break;
00145             }
00146           }
00147         }
00148         // and 0.1 from electrons ( keep higher energy)
00149         for(unsigned int ie2=0;ie2<cand_e.size();++ie2) {
00150           if(ie==ie2) continue;
00151           if ( deltaR(e.momentum(),cand_e[ie2].momentum()) < 0.1 &&
00152                e.E() < cand_e[ie2].E() ) {
00153             away = false;
00154             break;
00155           }
00156         }
00157         // if isolated keep it
00158         if ( away )
00159           cand2_e.push_back( e );
00160       }
00161 
00162       // remove e+e- pairs with mass < 20.
00163       Particles recon_e;
00164       for(unsigned int ie=0;ie<cand2_e.size();++ie) {
00165         bool pass = true;
00166         for(unsigned int ie2=0;ie2<cand2_e.size();++ie2) {
00167           if(cand2_e[ie].pid()*cand2_e[ie2].pid()>0) continue;
00168           double mtest = (cand2_e[ie].momentum()+cand2_e[ie2].momentum()).mass();
00169           if(mtest<=20.) {
00170             pass = false;
00171             break;
00172           }
00173         }
00174         if(pass) recon_e.push_back(cand2_e[ie]);
00175       }
00176 
00177       // only keep muons more than R=0.4 from jets
00178       Particles cand2_mu;
00179       for(unsigned int imu=0;imu<cand_mu.size();++imu) {
00180         const Particle & mu = cand_mu[imu];
00181         bool away = true;
00182         // at least 0.4 from any jets
00183         foreach ( const Jet& jet, recon_jets ) {
00184           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00185             away = false;
00186             break;
00187           }
00188         }
00189         // and 0.1 from any electrona
00190         if ( away ) {
00191           foreach ( const Particle & e, cand_e ) {
00192             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00193               away = false;
00194               break;
00195             }
00196           }
00197         }
00198         if ( away )
00199           cand2_mu.push_back( mu );
00200       }
00201 
00202       // remove mu+mu- pairs with mass < 20.
00203       Particles recon_mu;
00204       for(unsigned int imu=0;imu<cand2_mu.size();++imu) {
00205         bool pass = true;
00206         for(unsigned int imu2=0;imu2<cand2_mu.size();++imu2) {
00207           if(cand2_mu[imu].pid()*cand2_mu[imu2].pid()>0) continue;
00208           double mtest = (cand2_mu[imu].momentum()+cand2_mu[imu2].momentum()).mass();
00209           if(mtest<=20.) {
00210             pass = false;
00211             break;
00212           }
00213         }
00214         if(pass) recon_mu.push_back(cand2_mu[imu]);
00215       }
00216 
00217       // pTmiss
00218       Particles vfs_particles =
00219         applyProjection<VisibleFinalState>(event, "vfs").particles();
00220       FourMomentum pTmiss;
00221       foreach ( const Particle & p, vfs_particles ) {
00222         pTmiss -= p.momentum();
00223       }
00224       double eTmiss = pTmiss.pT();
00225 
00226       // now only use recon_jets, recon_mu, recon_e
00227 
00228       // reject events with less than 4 electrons and muons
00229       if ( recon_mu.size() + recon_e.size() < 4 ) {
00230         MSG_DEBUG("To few charged leptons left after selection");
00231         vetoEvent;
00232       }
00233 
00234       // check if passes single lepton trigger
00235       bool passSingle =
00236         ( !recon_e .empty() && recon_e[0] .perp()>25. )||
00237         ( !recon_mu.empty() && recon_mu[0].perp()>20.);
00238 
00239       // or two lepton trigger
00240       bool passDouble =
00241         ( recon_mu.size()>=2 && recon_mu[1].perp()>12.) ||
00242         ( recon_e .size()>=2 && recon_e [1].perp()>17.) ||
00243         ( !recon_e.empty() && !recon_mu.empty() &&
00244           recon_e[0].perp()>15. &&  recon_mu[0].perp()>10.);
00245 
00246       // must pass a trigger
00247       if( !passSingle && !passDouble ) {
00248         MSG_DEBUG("Hardest lepton fails trigger");
00249         vetoEvent;
00250       }
00251 
00252       // calculate meff
00253       double meff = eTmiss;
00254       foreach ( const Particle & e , recon_e  )
00255         meff += e.perp();
00256       foreach ( const Particle & mu, recon_mu )
00257         meff += mu.perp();
00258       foreach ( const Jet & jet, recon_jets ) {
00259         double pT = jet.perp();
00260         if(pT>40.) meff += pT;
00261       }
00262 
00263       // mass of SFOS pairs closest to the Z mass
00264       for(unsigned int ix=0;ix<recon_e.size();++ix) {
00265         for(unsigned int iy=ix+1;iy<recon_e.size();++iy) {
00266           if(recon_e[ix].pid()*recon_e[iy].pid()>0) continue;
00267           double mtest = (recon_e[ix].momentum()+recon_e[iy].momentum()).mass();
00268           if(mtest>81.2 && mtest<101.2) vetoEvent;
00269         }
00270       }
00271       for(unsigned int ix=0;ix<recon_mu.size();++ix) {
00272         for(unsigned int iy=ix+1;iy<recon_mu.size();++iy) {
00273           if(recon_mu[ix].pid()*recon_mu[iy].pid()>0) continue;
00274           double mtest = (recon_mu[ix].momentum()+recon_mu[iy].momentum()).mass();
00275           if(mtest>81.2 && mtest<101.2) vetoEvent;
00276         }
00277       }
00278 
00279       // make the control plots
00280       _hist_etmiss ->fill(eTmiss,weight);
00281       _hist_meff   ->fill(meff  ,weight);
00282       // finally the counts
00283       if(eTmiss>50.) _count_SR1->fill(0.5,weight);
00284       if(meff >300.) _count_SR2->fill(0.5,weight);
00285     }
00286 
00287     //@}
00288 
00289     void finalize() {
00290       double norm = crossSection()/femtobarn*4.7/sumOfWeights();
00291       scale(_hist_etmiss,norm* 50.);
00292       scale(_hist_meff  ,norm*150.);
00293       scale(_count_SR1,norm);
00294       scale(_count_SR2,norm);
00295     }
00296 
00297   private:
00298 
00299     /// @name Histograms
00300     //@{
00301     Histo1DPtr _hist_etmiss;
00302     Histo1DPtr _hist_meff;
00303     Histo1DPtr _count_SR1;
00304     Histo1DPtr _count_SR2;
00305     //@}
00306 
00307   };
00308 
00309   // The hook for the plugin system
00310   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1190891);
00311 
00312 }