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