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   /// @author Peter Richardson
00015   class ATLAS_2012_I1112263 : public Analysis {
00016   public:
00017 
00018     /// @name Constructors etc.
00019     //@{
00020 
00021     /// Constructor
00022     ATLAS_2012_I1112263()
00023       : Analysis("ATLAS_2012_I1112263")
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       std::vector<std::pair<double, double> > eta_e;
00039       eta_e.push_back(make_pair(-2.47,2.47));
00040       IdentifiedFinalState elecs(eta_e, 10.0*GeV);
00041       elecs.acceptIdPair(PID::ELECTRON);
00042       addProjection(elecs, "elecs");
00043 
00044       // projection to find the muons
00045       std::vector<std::pair<double, double> > eta_m;
00046       eta_m.push_back(make_pair(-2.4,2.4));
00047       IdentifiedFinalState muons(eta_m, 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_leptonpT_SR1.push_back(bookHisto1D("hist_lepton_pT_1_SR1",11,0.,220.));
00066       _hist_leptonpT_SR1.push_back(bookHisto1D("hist_lepton_pT_2_SR1", 7,0.,140.));
00067       _hist_leptonpT_SR1.push_back(bookHisto1D("hist_lepton_pT_3_SR1", 8,0.,160.));
00068       _hist_leptonpT_SR2.push_back(bookHisto1D("hist_lepton_pT_1_SR2",11,0.,220.));
00069       _hist_leptonpT_SR2.push_back(bookHisto1D("hist_lepton_pT_2_SR2", 7,0.,140.));
00070       _hist_leptonpT_SR2.push_back(bookHisto1D("hist_lepton_pT_3_SR2", 8,0.,160.));
00071       _hist_etmiss_SR1_A = bookHisto1D("hist_etmiss_SR1_A",15,10.,310.);
00072       _hist_etmiss_SR1_B = bookHisto1D("hist_etmiss_SR1_B", 9,10.,190.);
00073       _hist_etmiss_SR2_A = bookHisto1D("hist_etmiss_SR2_A",15,10.,310.);
00074       _hist_etmiss_SR2_B = bookHisto1D("hist_etmiss_SR2_B", 9,10.,190.);
00075       _hist_mSFOS= bookHisto1D("hist_mSFOF",9,0.,180.);
00076 
00077       _count_SR1 = bookHisto1D("count_SR1", 1, 0., 1.);
00078       _count_SR2 = bookHisto1D("count_SR2", 1, 0., 1.);
00079     }
00080 
00081 
00082     /// Perform the per-event analysis
00083     void analyze(const Event& event) {
00084       const double weight = event.weight();
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       foreach ( const Particle & e,
00112                 applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt() ) {
00113         double eta = e.eta();
00114         // remove electrons with pT<15 in old veto region
00115         // (NOT EXPLICIT IN THIS PAPER BUT IN SIMILAR 4 LEPTON PAPER and THIS DESCRPITION
00116         //  IS MUCH WORSE SO ASSUME THIS IS DONE)
00117         if( fabs(eta)>1.37 && fabs(eta) < 1.52 && e.momentum().perp()< 15.*GeV)
00118           continue;
00119         double pTinCone = -e.momentum().perp();
00120         foreach ( const Particle & track, chg_tracks ) {
00121           if ( deltaR(e.momentum(),track.momentum()) <= 0.2 )
00122             pTinCone += track.pT();
00123         }
00124         if (pTinCone/e.momentum().perp()<0.1) {
00125           cand_e.push_back(e);
00126         }
00127       }
00128 
00129       // resolve jet/lepton ambiguity
00130       // (NOT EXPLICIT IN THIS PAPER BUT IN SIMILAR 4 LEPTON PAPER and THIS DESCRPITION
00131       //  IS MUCH WORSE SO ASSUME THIS IS DONE)
00132       Jets recon_jets;
00133       foreach ( const Jet& jet, cand_jets ) {
00134         bool away_from_e = true;
00135         foreach ( const Particle & e, cand_e ) {
00136           if ( deltaR(e.momentum(),jet.momentum()) <= 0.2 ) {
00137             away_from_e = false;
00138             break;
00139           }
00140         }
00141         if ( away_from_e )
00142           recon_jets.push_back( jet );
00143       }
00144 
00145       // only keep electrons more than R=0.4 from jets
00146       Particles recon_e;
00147       foreach ( const Particle & e, cand_e ) {
00148         bool away = true;
00149         foreach ( const Jet& jet, recon_jets ) {
00150           if ( deltaR(e.momentum(),jet.momentum()) < 0.4 ) {
00151             away = false;
00152             break;
00153           }
00154         }
00155         // and 0.1 from any muons
00156         if ( ! away ) {
00157           foreach ( const Particle & mu, cand_e ) {
00158             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00159               away = false;
00160               break;
00161             }
00162           }
00163         }
00164         if ( away )
00165           recon_e.push_back( e );
00166       }
00167       // only keep muons more than R=0.4 from jets
00168       Particles recon_mu;
00169       foreach ( const Particle & mu, cand_mu ) {
00170         bool away = true;
00171         foreach ( const Jet& jet, recon_jets ) {
00172           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00173             away = false;
00174             break;
00175           }
00176         }
00177         // and 0.1 from any electrona
00178         if ( ! away ) {
00179           foreach ( const Particle & e, cand_e ) {
00180             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00181               away = false;
00182               break;
00183             }
00184           }
00185         }
00186         if ( away )
00187           recon_mu.push_back( mu );
00188       }
00189 
00190       // pTmiss
00191       Particles vfs_particles =
00192         applyProjection<VisibleFinalState>(event, "vfs").particles();
00193       FourMomentum pTmiss;
00194       foreach ( const Particle & p, vfs_particles ) {
00195         pTmiss -= p.momentum();
00196       }
00197       double eTmiss = pTmiss.pT();
00198 
00199       // now only use recon_jets, recon_mu, recon_e
00200 
00201       // reject events with wrong number of leptons
00202       if ( recon_mu.size() + recon_e.size() != 3 ) {
00203         MSG_DEBUG("To few charged leptons left after selection");
00204         vetoEvent;
00205       }
00206 
00207       // ATLAS calo problem
00208       if(rand()/static_cast<double>(RAND_MAX)<=0.42) {
00209         foreach ( const Particle & e, recon_e ) {
00210           double eta = e.eta();
00211           double phi = e.momentum().azimuthalAngle(MINUSPI_PLUSPI);
00212           if(eta>-0.1&&eta<1.5&&phi>-0.9&&phi<-0.5)
00213             vetoEvent;
00214         }
00215         foreach ( const Jet & jet, recon_jets ) {
00216           double eta = jet.rapidity();
00217           double phi = jet.momentum().azimuthalAngle(MINUSPI_PLUSPI);
00218           if(jet.momentum().perp()>40 && eta>-0.1&&eta<1.5&&phi>-0.9&&phi<-0.5)
00219             vetoEvent;
00220         }
00221       }
00222 
00223       // check at least one e/mu passing trigger
00224       if( !( !recon_e .empty() && recon_e[0] .momentum().perp()>25.)  &&
00225           !( !recon_mu.empty() && recon_mu[0].momentum().perp()>20.) ) {
00226         MSG_DEBUG("Hardest lepton fails trigger");
00227         vetoEvent;
00228       }
00229 
00230       // eTmiss cut
00231       if(eTmiss<50.) vetoEvent;
00232 
00233       // check at least 1 SFOS pair
00234       double mSFOS=1e30, mdiff=1e30;
00235       unsigned int nSFOS=0;
00236       for(unsigned int ix=0;ix<recon_e.size();++ix) {
00237         for(unsigned int iy=ix+1;iy<recon_e.size();++iy) {
00238           if(recon_e[ix].pdgId()*recon_e[iy].pdgId()>0) continue;
00239           ++nSFOS;
00240           double mtest = (recon_e[ix].momentum()+recon_e[iy].momentum()).mass();
00241           // veto is mass<20
00242           if(mtest<20.) vetoEvent;
00243           if(fabs(mtest-90.)<mdiff) {
00244             mSFOS = mtest;
00245             mdiff = fabs(mtest-90.);
00246           }
00247         }
00248       }
00249       for(unsigned int ix=0;ix<recon_mu.size();++ix) {
00250         for(unsigned int iy=ix+1;iy<recon_mu.size();++iy) {
00251           if(recon_mu[ix].pdgId()*recon_mu[iy].pdgId()>0) continue;
00252           ++nSFOS;
00253           double mtest = (recon_mu[ix].momentum()+recon_mu[iy].momentum()).mass();
00254           // veto is mass<20
00255           if(mtest<20.) vetoEvent;
00256           if(fabs(mtest-90.)<mdiff) {
00257             mSFOS = mtest;
00258             mdiff = fabs(mtest-90.);
00259           }
00260         }
00261       }
00262       // require at least 1 SFOS pair
00263       if(nSFOS==0) vetoEvent;
00264       // b-jet veto in SR!
00265       if(mdiff>10.) {
00266         foreach (const Jet & jet, recon_jets ) {
00267           if(jet.containsBottom() &&
00268              rand()/static_cast<double>(RAND_MAX)<=0.60)
00269             vetoEvent;
00270         }
00271       }
00272       // region SR1, Z depleted
00273       if(mdiff>10.) {
00274         _count_SR1->fill(0.5,weight);
00275         _hist_etmiss_SR1_A->fill(eTmiss,weight);
00276         _hist_etmiss_SR1_B->fill(eTmiss,weight);
00277         _hist_mSFOS->fill(mSFOS,weight);
00278       }
00279       // region SR2, Z enriched
00280       else {
00281         _count_SR2->fill(0.5,weight);
00282         _hist_etmiss_SR2_A->fill(eTmiss,weight);
00283         _hist_etmiss_SR2_B->fill(eTmiss,weight);
00284       }
00285       // make the control plots
00286       // lepton pT
00287       unsigned int ie=0,imu=0;
00288       for(unsigned int ix=0;ix<3;++ix) {
00289         Histo1DPtr hist = mdiff>10. ?
00290           _hist_leptonpT_SR1[ix] :  _hist_leptonpT_SR2[ix];
00291         double pTe  = ie <recon_e .size() ?
00292           recon_e [ie ].momentum().perp() : -1*GeV;
00293         double pTmu = imu<recon_mu.size() ?
00294           recon_mu[imu].momentum().perp() : -1*GeV;
00295         if(pTe>pTmu) {
00296           hist->fill(pTe ,weight);
00297           ++ie;
00298         }
00299         else {
00300           hist->fill(pTmu,weight);
00301           ++imu;
00302         }
00303       }
00304     }
00305 
00306     //@}
00307 
00308     void finalize() {
00309       double norm = crossSection()/femtobarn*2.06/sumOfWeights();
00310       // these are number of events at 2.06fb^-1 per 20 GeV
00311       for(unsigned int ix=0;ix<3;++ix) {
00312         scale(_hist_leptonpT_SR1[ix],norm*20.);
00313         scale(_hist_leptonpT_SR2[ix],norm*20.);
00314       }
00315       scale(_hist_etmiss_SR1_A,norm*20.);
00316       scale(_hist_etmiss_SR1_B,norm*20.);
00317       scale(_hist_etmiss_SR2_A,norm*20.);
00318       scale(_hist_etmiss_SR2_B,norm*20.);
00319       scale(_hist_mSFOS    ,norm*20.);
00320       // these are number of events at 2.06fb^-1
00321       scale(_count_SR1,norm);
00322       scale(_count_SR2,norm);
00323     }
00324 
00325   private:
00326 
00327   /// @name Histograms
00328   //@{
00329   vector<Histo1DPtr> _hist_leptonpT_SR1;
00330   vector<Histo1DPtr> _hist_leptonpT_SR2;
00331   Histo1DPtr _hist_etmiss_SR1_A;
00332   Histo1DPtr _hist_etmiss_SR1_B;
00333   Histo1DPtr _hist_etmiss_SR2_A;
00334   Histo1DPtr _hist_etmiss_SR2_B;
00335   Histo1DPtr _hist_mSFOS;
00336   Histo1DPtr _count_SR1;
00337   Histo1DPtr _count_SR2;
00338   //@}
00339 
00340   };
00341 
00342   // The hook for the plugin system
00343   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1112263);
00344 
00345 }