rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1112263.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   /// @author Peter Richardson
00016   class ATLAS_2012_I1112263 : public Analysis {
00017   public:
00018 
00019     /// Constructor
00020     ATLAS_2012_I1112263()
00021       : Analysis("ATLAS_2012_I1112263")
00022     {    }
00023 
00024 
00025     /// @name Analysis methods
00026     //@{
00027 
00028     /// Book histograms and initialise projections before the run
00029     void init() {
00030 
00031       // projection to find the electrons
00032       IdentifiedFinalState elecs(Cuts::abseta < 2.47 && Cuts::pT > 10*GeV);
00033       elecs.acceptIdPair(PID::ELECTRON);
00034       addProjection(elecs, "elecs");
00035 
00036       // projection to find the muons
00037       IdentifiedFinalState muons(Cuts::abseta < 2.4 && Cuts::pT > 10*GeV);
00038       muons.acceptIdPair(PID::MUON);
00039       addProjection(muons, "muons");
00040 
00041       // for pTmiss
00042       addProjection(VisibleFinalState(Cuts::abseta < 4.9),"vfs");
00043 
00044       VetoedFinalState vfs;
00045       vfs.addVetoPairId(PID::MUON);
00046 
00047       /// Jet finder
00048       addProjection(FastJets(vfs, FastJets::ANTIKT, 0.4), "AntiKtJets04");
00049 
00050       // all tracks (to do deltaR with leptons)
00051       addProjection(ChargedFinalState(Cuts::abseta < 3.0),"cfs");
00052 
00053       // Book histograms
00054       _hist_leptonpT_SR1.push_back(bookHisto1D("hist_lepton_pT_1_SR1",11,0.,220.));
00055       _hist_leptonpT_SR1.push_back(bookHisto1D("hist_lepton_pT_2_SR1", 7,0.,140.));
00056       _hist_leptonpT_SR1.push_back(bookHisto1D("hist_lepton_pT_3_SR1", 8,0.,160.));
00057       _hist_leptonpT_SR2.push_back(bookHisto1D("hist_lepton_pT_1_SR2",11,0.,220.));
00058       _hist_leptonpT_SR2.push_back(bookHisto1D("hist_lepton_pT_2_SR2", 7,0.,140.));
00059       _hist_leptonpT_SR2.push_back(bookHisto1D("hist_lepton_pT_3_SR2", 8,0.,160.));
00060       _hist_etmiss_SR1_A = bookHisto1D("hist_etmiss_SR1_A",15,10.,310.);
00061       _hist_etmiss_SR1_B = bookHisto1D("hist_etmiss_SR1_B", 9,10.,190.);
00062       _hist_etmiss_SR2_A = bookHisto1D("hist_etmiss_SR2_A",15,10.,310.);
00063       _hist_etmiss_SR2_B = bookHisto1D("hist_etmiss_SR2_B", 9,10.,190.);
00064       _hist_mSFOS= bookHisto1D("hist_mSFOF",9,0.,180.);
00065 
00066       _count_SR1 = bookHisto1D("count_SR1", 1, 0., 1.);
00067       _count_SR2 = bookHisto1D("count_SR2", 1, 0., 1.);
00068     }
00069 
00070 
00071     /// Perform the per-event analysis
00072     void analyze(const Event& event) {
00073 
00074       // Get the jet candidates
00075       Jets cand_jets;
00076       foreach (const Jet& jet, applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00077         if ( fabs( jet.eta() ) < 2.8 ) {
00078           cand_jets.push_back(jet);
00079         }
00080       }
00081 
00082       // Candidate muons
00083       Particles cand_mu;
00084       Particles chg_tracks =
00085         applyProjection<ChargedFinalState>(event, "cfs").particles();
00086       foreach ( const Particle & mu, applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt() ) {
00087         double pTinCone = -mu.pT();
00088         foreach ( const Particle & track, chg_tracks ) {
00089           if ( deltaR(mu.momentum(),track.momentum()) <= 0.2 )
00090             pTinCone += track.pT();
00091         }
00092         if ( pTinCone < 1.8*GeV )
00093           cand_mu.push_back(mu);
00094       }
00095 
00096       // Candidate electrons
00097       Particles cand_e;
00098       foreach ( const Particle & e, applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt() ) {
00099         double eta = e.eta();
00100         // Remove electrons with pT<15 in old veto region
00101         // (NOT EXPLICIT IN THIS PAPER BUT IN SIMILAR 4 LEPTON PAPER and THIS DESCRPITION
00102         //  IS MUCH WORSE SO ASSUME THIS IS DONE)
00103         if ( fabs(eta)>1.37 && fabs(eta) < 1.52 && e.perp()< 15.*GeV)
00104           continue;
00105         double pTinCone = -e.perp();
00106         foreach ( const Particle & track, chg_tracks ) {
00107           if ( deltaR(e.momentum(),track.momentum()) <= 0.2 )
00108             pTinCone += track.pT();
00109         }
00110         if (pTinCone/e.perp()<0.1) {
00111           cand_e.push_back(e);
00112         }
00113       }
00114 
00115       // Resolve jet/lepton ambiguity
00116       // (NOT EXPLICIT IN THIS PAPER BUT IN SIMILAR 4 LEPTON PAPER and THIS DESCRPITION
00117       //  IS MUCH WORSE SO ASSUME THIS IS DONE)
00118       Jets recon_jets;
00119       foreach ( const Jet& jet, cand_jets ) {
00120         bool away_from_e = true;
00121         foreach ( const Particle & e, cand_e ) {
00122           if ( deltaR(e.momentum(),jet.momentum()) <= 0.2 ) {
00123             away_from_e = false;
00124             break;
00125           }
00126         }
00127         if ( away_from_e )
00128           recon_jets.push_back( jet );
00129       }
00130 
00131       // Only keep electrons more than R=0.4 from jets
00132       Particles recon_e;
00133       foreach ( const Particle & e, cand_e ) {
00134         bool away = true;
00135         foreach ( const Jet& jet, recon_jets ) {
00136           if ( deltaR(e.momentum(),jet.momentum()) < 0.4 ) {
00137             away = false;
00138             break;
00139           }
00140         }
00141         // ... and 0.1 from any muons
00142         if ( ! away ) {
00143           foreach ( const Particle & mu, cand_e ) {
00144             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00145               away = false;
00146               break;
00147             }
00148           }
00149         }
00150         if ( away )
00151           recon_e.push_back( e );
00152       }
00153       // Only keep muons more than R=0.4 from jets
00154       Particles recon_mu;
00155       foreach ( const Particle & mu, cand_mu ) {
00156         bool away = true;
00157         foreach ( const Jet& jet, recon_jets ) {
00158           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00159             away = false;
00160             break;
00161           }
00162         }
00163         // ... and 0.1 from any electrona
00164         if ( ! away ) {
00165           foreach ( const Particle & e, cand_e ) {
00166             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00167               away = false;
00168               break;
00169             }
00170           }
00171         }
00172         if ( away )
00173           recon_mu.push_back( mu );
00174       }
00175 
00176       // pTmiss
00177       Particles vfs_particles =
00178         applyProjection<VisibleFinalState>(event, "vfs").particles();
00179       FourMomentum pTmiss;
00180       foreach ( const Particle & p, vfs_particles ) {
00181         pTmiss -= p.momentum();
00182       }
00183       double eTmiss = pTmiss.pT();
00184 
00185       // Now only use recon_jets, recon_mu, recon_e
00186 
00187       // Reject events with wrong number of leptons
00188       if ( recon_mu.size() + recon_e.size() != 3 ) {
00189         MSG_DEBUG("To few charged leptons left after selection");
00190         vetoEvent;
00191       }
00192 
00193       // ATLAS calo problem
00194       if (rand()/static_cast<double>(RAND_MAX) <= 0.42) {
00195         foreach ( const Particle & e, recon_e ) {
00196           double eta = e.eta();
00197           double phi = e.azimuthalAngle(MINUSPI_PLUSPI);
00198           if (inRange(eta, -0.1, 1.5) && inRange(phi, -0.9, -0.5)) vetoEvent;
00199         }
00200         foreach ( const Jet & jet, recon_jets ) {
00201           const double eta = jet.rapidity();
00202           const double phi = jet.azimuthalAngle(MINUSPI_PLUSPI);
00203           if (jet.perp() > 40*GeV && inRange(eta, -0.1, 1.5) && inRange(phi, -0.9, -0.5)) vetoEvent;
00204         }
00205       }
00206 
00207       if ( !( !recon_e .empty() && recon_e[0] .perp() > 25*GeV) &&
00208            !( !recon_mu.empty() && recon_mu[0].perp() > 20*GeV) ) {
00209         MSG_DEBUG("Hardest lepton fails trigger");
00210         vetoEvent;
00211       }
00212 
00213       // eTmiss cut
00214       if (eTmiss < 50*GeV) vetoEvent;
00215 
00216       // Check at least 1 SFOS pair
00217       double mSFOS=1e30, mdiff=1e30*GeV;
00218       size_t nSFOS=0;
00219       for (size_t ix = 0; ix < recon_e.size(); ++ix) {
00220         for (size_t iy = ix+1; iy < recon_e.size(); ++iy) {
00221           if (recon_e[ix].pid()*recon_e[iy].pid() > 0) continue;
00222           ++nSFOS;
00223           double mtest = (recon_e[ix].momentum() + recon_e[iy].momentum()).mass();
00224           // Veto is mass<20
00225           if (mtest < 20*GeV) vetoEvent;
00226           if (fabs(mtest - 90*GeV) < mdiff) {
00227             mSFOS = mtest;
00228             mdiff = fabs(mtest - 90*GeV);
00229           }
00230         }
00231       }
00232       for (size_t ix = 0; ix < recon_mu.size(); ++ix) {
00233         for (size_t iy = ix+1; iy < recon_mu.size(); ++iy) {
00234           if (recon_mu[ix].pid()*recon_mu[iy].pid() > 0) continue;
00235           ++nSFOS;
00236           double mtest = (recon_mu[ix].momentum() + recon_mu[iy].momentum()).mass();
00237           // Veto is mass < 20*GeV
00238           if (mtest < 20*GeV) vetoEvent;
00239           if (fabs(mtest - 90*GeV) < mdiff) {
00240             mSFOS = mtest;
00241             mdiff = fabs(mtest - 90*GeV);
00242           }
00243         }
00244       }
00245       // Require at least 1 SFOS pair
00246       if (nSFOS == 0) vetoEvent;
00247       // b-jet veto in SR!
00248       if (mdiff > 10*GeV) {
00249         foreach (const Jet & jet, recon_jets ) {
00250           if (jet.bTagged() && rand()/static_cast<double>(RAND_MAX) <= 0.60) vetoEvent;
00251         }
00252       }
00253 
00254       // Histogram filling
00255       const double weight = event.weight();
00256 
00257       // Region SR1, Z depleted
00258       if (mdiff > 10*GeV) {
00259         _count_SR1->fill(0.5, weight);
00260         _hist_etmiss_SR1_A->fill(eTmiss, weight);
00261         _hist_etmiss_SR1_B->fill(eTmiss, weight);
00262         _hist_mSFOS->fill(mSFOS, weight);
00263       }
00264       // Region SR2, Z enriched
00265       else {
00266         _count_SR2->fill(0.5, weight);
00267         _hist_etmiss_SR2_A->fill(eTmiss, weight);
00268         _hist_etmiss_SR2_B->fill(eTmiss, weight);
00269       }
00270       // Make the control plots
00271       // lepton pT
00272       size_t ie=0, imu=0;
00273       for (size_t ix = 0; ix < 3; ++ix) {
00274         Histo1DPtr hist = (mdiff > 10*GeV) ? _hist_leptonpT_SR1[ix] :  _hist_leptonpT_SR2[ix];
00275         double pTe  = (ie  < recon_e .size()) ? recon_e [ie ].perp() : -1*GeV;
00276         double pTmu = (imu < recon_mu.size()) ? recon_mu[imu].perp() : -1*GeV;
00277         if (pTe > pTmu) {
00278           hist->fill(pTe, weight);
00279           ++ie;
00280         } else {
00281           hist->fill(pTmu, weight);
00282           ++imu;
00283         }
00284       }
00285 
00286     }
00287 
00288 
00289     void finalize() {
00290       const double norm = crossSection()/femtobarn*2.06/sumOfWeights();
00291       // These are number of events at 2.06fb^-1 per 20 GeV
00292       for (size_t ix = 0; ix < 3; ++ix) {
00293         scale(_hist_leptonpT_SR1[ix], norm*20.);
00294         scale(_hist_leptonpT_SR2[ix], norm*20.);
00295       }
00296       scale(_hist_etmiss_SR1_A, norm*20.);
00297       scale(_hist_etmiss_SR1_B, norm*20.);
00298       scale(_hist_etmiss_SR2_A, norm*20.);
00299       scale(_hist_etmiss_SR2_B, norm*20.);
00300       scale(_hist_mSFOS, norm*20.);
00301       // These are number of events at 2.06fb^-1
00302       scale(_count_SR1, norm);
00303       scale(_count_SR2, norm);
00304     }
00305 
00306     //@}
00307 
00308 
00309   private:
00310 
00311   /// @name Histograms
00312   //@{
00313   vector<Histo1DPtr> _hist_leptonpT_SR1, _hist_leptonpT_SR2;
00314   Histo1DPtr _hist_etmiss_SR1_A, _hist_etmiss_SR1_B, _hist_etmiss_SR2_A, _hist_etmiss_SR2_B;
00315   Histo1DPtr _hist_mSFOS, _count_SR1, _count_SR2;
00316   //@}
00317 
00318   };
00319 
00320   // The hook for the plugin system
00321   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1112263);
00322 
00323 }