rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1180197.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/IdentifiedFinalState.hh"
00010 #include "Rivet/Projections/VetoedFinalState.hh"
00011 #include "Rivet/Projections/FastJets.hh"
00012 
00013 namespace Rivet {
00014 
00015 
00016   class ATLAS_2012_I1180197 : public Analysis {
00017   public:
00018 
00019     /// @name Constructors etc.
00020     //@{
00021 
00022     /// Constructor
00023 
00024     ATLAS_2012_I1180197()
00025       : Analysis("ATLAS_2012_I1180197")
00026     {    }
00027 
00028     //@}
00029 
00030 
00031   public:
00032 
00033     /// @name Analysis methods
00034     //@{
00035 
00036     /// Book histograms and initialize projections before the run
00037     void init() {
00038 
00039       // projection to find the electrons
00040       std::vector<std::pair<double, double> > eta_e;
00041       eta_e.push_back(make_pair(-2.47,2.47));
00042       IdentifiedFinalState elecs(eta_e, 7.0*GeV);
00043       elecs.acceptIdPair(ELECTRON);
00044       addProjection(elecs, "elecs");
00045 
00046       // projection to find the muons
00047       std::vector<std::pair<double, double> > eta_m;
00048       eta_m.push_back(make_pair(-2.4,2.4));
00049       IdentifiedFinalState muons(eta_m, 6.0*GeV);
00050       muons.acceptIdPair(MUON);
00051       addProjection(muons, "muons");
00052 
00053       // Jet finder
00054       VetoedFinalState vfs;
00055       vfs.addVetoPairId(MUON);
00056       addProjection(FastJets(vfs, FastJets::ANTIKT, 0.4),
00057                     "AntiKtJets04");
00058 
00059       // all tracks (to do deltaR with leptons)
00060       addProjection(ChargedFinalState(-3.0,3.0,0.5*GeV),"cfs");
00061 
00062       // for pTmiss
00063       addProjection(VisibleFinalState(-4.9,4.9),"vfs");
00064 
00065       // Book histograms
00066       _count_1l_3jet_all_channel  = bookHisto1D("count_1l_3jet_all_channel", 1, 0., 1.);
00067       _count_1l_3jet_e_channel    = bookHisto1D("count_1l_3jet_e_channel"  , 1, 0., 1.);
00068       _count_1l_3jet_mu_channel   = bookHisto1D("count_1l_3jet_mu_channel" , 1, 0., 1.);
00069       _count_1l_4jet_all_channel  = bookHisto1D("count_1l_4jet_all_channel", 1, 0., 1.);
00070       _count_1l_4jet_e_channel    = bookHisto1D("count_1l_4jet_e_channel"  , 1, 0., 1.);
00071       _count_1l_4jet_mu_channel   = bookHisto1D("count_1l_4jet_mu_channel" , 1, 0., 1.);
00072       _count_1l_soft_all_channel  = bookHisto1D("count_1l_soft_all_channel", 1, 0., 1.);
00073       _count_1l_soft_e_channel    = bookHisto1D("count_1l_soft_e_channel"  , 1, 0., 1.);
00074       _count_1l_soft_mu_channel   = bookHisto1D("count_1l_soft_mu_channel" , 1, 0., 1.);
00075 
00076       _count_2l_2jet_all_channel  = bookHisto1D("count_2l_2jet_all_channel" , 1, 0., 1.);
00077       _count_2l_2jet_ee_channel   = bookHisto1D("count_2l_2jet_ee_channel"  , 1, 0., 1.);
00078       _count_2l_2jet_emu_channel  = bookHisto1D("count_2l_2jet_emu_channel" , 1, 0., 1.);
00079       _count_2l_2jet_mumu_channel = bookHisto1D("count_2l_2jet_mumu_channel", 1, 0., 1.);
00080       _count_2l_4jet_all_channel  = bookHisto1D("count_2l_4jet_all_channel" , 1, 0., 1.);
00081       _count_2l_4jet_ee_channel   = bookHisto1D("count_2l_4jet_ee_channel"  , 1, 0., 1.);
00082       _count_2l_4jet_emu_channel  = bookHisto1D("count_2l_4jet_emu_channel" , 1, 0., 1.);
00083       _count_2l_4jet_mumu_channel = bookHisto1D("count_2l_4jet_mumu_channel", 1, 0., 1.);
00084       _hist_1l_m_eff_3jet        = bookHisto1D("hist_1l_m_eff_3jet"       ,  6, 400., 1600.);
00085       _hist_1l_m_eff_4jet        = bookHisto1D("hist_1l_m_eff_4jet"       ,  4, 800., 1600.);
00086       _hist_1l_eTmiss_m_eff_soft = bookHisto1D("hist_1l_eTmiss_m_eff_soft",  6, 0.1 , 0.7  );
00087       _hist_2l_m_eff_2jet        = bookHisto1D("hist_2l_m_eff_2jet"       ,  5, 700., 1700.);
00088       _hist_2l_m_eff_4jet        = bookHisto1D("hist_2l_m_eff_4jet"       ,  5, 600., 1600.);
00089     }
00090 
00091 
00092     /// Perform the per-event analysis
00093     void analyze(const Event& event) {
00094       const double weight = event.weight();
00095 
00096       // get the candiate jets
00097       Jets cand_jets;
00098       foreach ( const Jet& jet,
00099                 applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00100         if ( fabs( jet.momentum().eta() ) < 4.5 ) {
00101           cand_jets.push_back(jet);
00102         }
00103       }
00104       // charged tracks for isolation
00105       ParticleVector chg_tracks =
00106         applyProjection<ChargedFinalState>(event, "cfs").particles();
00107       // find the electrons
00108       ParticleVector cand_soft_e,cand_hard_e;
00109       foreach( const Particle & e,
00110                applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt()) {
00111         double pT  = e.momentum().perp();
00112         double eta = e.momentum().eta();
00113         // remove any leptons within 0.4 of any candidate jets
00114         bool e_near_jet = false;
00115         foreach ( const Jet& jet, cand_jets ) {
00116           double dR = deltaR(e.momentum(),jet.momentum());
00117           if ( dR < 0.4 && dR > 0.2 ) {
00118             e_near_jet = true;
00119             break;
00120           }
00121         }
00122         if ( e_near_jet ) continue;
00123         // soft selection
00124         if(pT>7.&&!(fabs(eta)>1.37&&fabs(eta)<1.52)) {
00125           cand_soft_e.push_back(e);
00126         }
00127         // hard selection
00128         if(pT>10.) cand_hard_e.push_back(e);
00129       }
00130       ParticleVector cand_soft_mu,cand_hard_mu;
00131       foreach( const Particle & mu,
00132                applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt()) {
00133         double pT  = mu.momentum().perp();
00134         double eta = mu.momentum().eta();
00135         // remove any leptons within 0.4 of any candidate jets
00136         bool mu_near_jet = false;
00137         foreach ( const Jet& jet, cand_jets ) {
00138           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00139             mu_near_jet = true;
00140             break;
00141           }
00142         }
00143         if ( mu_near_jet ) continue;
00144         // soft selection
00145         if(pT>6.&&!(fabs(eta)>1.37&&fabs(eta)<1.52)) {
00146           cand_soft_mu.push_back(mu);
00147         }
00148         // hard selection
00149         if(pT>10.) cand_hard_mu.push_back(mu);
00150       }
00151       // pTcone around muon track (hard)
00152       ParticleVector recon_hard_mu;
00153       foreach ( const Particle & mu, cand_hard_mu ) {
00154         double pTinCone = -mu.momentum().pT();
00155         foreach ( const Particle & track, chg_tracks ) {
00156           if ( deltaR(mu.momentum(),track.momentum()) < 0.2 )
00157             pTinCone += track.momentum().pT();
00158         }
00159         if ( pTinCone < 1.8*GeV ) recon_hard_mu.push_back(mu);
00160       }
00161       // pTcone around muon track (soft)
00162       ParticleVector recon_soft_mu;
00163       foreach ( const Particle & mu, cand_soft_mu ) {
00164         double pTinCone = -mu.momentum().pT();
00165         if(-pTinCone>20.) continue;
00166         foreach ( const Particle & track, chg_tracks ) {
00167           if ( deltaR(mu.momentum(),track.momentum()) < 0.2 )
00168             pTinCone += track.momentum().pT();
00169         }
00170         if ( pTinCone < 1.8*GeV ) recon_soft_mu.push_back(mu);
00171       }
00172       // pTcone around electron track (hard)
00173       ParticleVector recon_hard_e;
00174       foreach ( const Particle & e, cand_hard_e ) {
00175         double pTinCone = -e.momentum().pT();
00176         foreach ( const Particle & track, chg_tracks ) {
00177           if ( deltaR(e.momentum(),track.momentum()) < 0.2 )
00178             pTinCone += track.momentum().pT();
00179         }
00180         if ( pTinCone < 0.1 * e.momentum().pT() ) recon_hard_e.push_back(e);
00181       }
00182       // pTcone around electron track (soft)
00183       ParticleVector recon_soft_e;
00184       foreach ( const Particle & e, cand_soft_e ) {
00185         double pTinCone = -e.momentum().pT();
00186         if(-pTinCone>25.) continue;
00187         foreach ( const Particle & track, chg_tracks ) {
00188           if ( deltaR(e.momentum(),track.momentum()) < 0.2 )
00189             pTinCone += track.momentum().pT();
00190         }
00191         if ( pTinCone < 0.1 * e.momentum().pT() ) recon_soft_e.push_back(e);
00192       }
00193 
00194       // pTmiss
00195       FourMomentum pTmiss;
00196       foreach ( const Particle & p,
00197                 applyProjection<VisibleFinalState>(event, "vfs").particles() ) {
00198         pTmiss -= p.momentum();
00199       }
00200       double eTmiss = pTmiss.pT();
00201 
00202       // hard lepton selection
00203       if( ! recon_hard_e.empty() || !recon_hard_mu.empty() ) {
00204         // discard jets that overlap with electrons
00205         Jets recon_jets;
00206         foreach ( const Jet& jet, cand_jets ) {
00207           if(fabs(jet.momentum().eta())>2.5||
00208              jet.momentum().perp()<25.) continue;
00209           bool away_from_e = true;
00210           foreach ( const Particle & e, cand_hard_e ) {
00211             if ( deltaR(e.momentum(),jet.momentum()) < 0.2 ) {
00212               away_from_e = false;
00213               break;
00214             }
00215           }
00216           if ( away_from_e ) recon_jets.push_back( jet );
00217         }
00218         // both selections require at least 2 jets
00219         // meff calculation
00220         double HT=0.;
00221         foreach( const Jet & jet, recon_jets) {
00222           HT += jet.momentum().perp();
00223         }
00224         double m_eff_inc  = HT+eTmiss;
00225         unsigned int njet = recon_jets.size();
00226         // 1 lepton only
00227         if( recon_hard_e.size() + recon_hard_mu.size() == 1 && njet >=3 )  {
00228           // get the lepton
00229           Particle lepton = recon_hard_e.empty() ?
00230             recon_hard_mu[0] : recon_hard_e[0];
00231           // lepton variables
00232           double pT = lepton.momentum().perp();
00233           double mT  = 2.*(pT*eTmiss -
00234                            lepton.momentum().x()*pTmiss.x() -
00235                            lepton.momentum().y()*pTmiss.y());
00236           mT = sqrt(mT);
00237           HT += pT;
00238           m_eff_inc += pT;
00239           // apply the cuts on the leptons and min no. of jets
00240           if( ( ( abs(lepton.pdgId()) == ELECTRON && pT > 25. ) ||
00241                 ( abs(lepton.pdgId()) == MUON     && pT > 20. ) ) &&
00242               mT > 100. && eTmiss > 250. ) {
00243             double m_eff = pT+eTmiss;
00244             for(unsigned int ix=0;ix<3;++ix)
00245               m_eff += recon_jets[ix].momentum().perp();
00246             // 3 jet channel
00247             if( (njet == 3 || recon_jets[3].momentum().perp() < 80. ) &&
00248                 recon_jets[0].momentum().perp()>100. ) {
00249               if(eTmiss/m_eff>0.3) {
00250                 if(m_eff_inc>1200.) {
00251                   _count_1l_3jet_all_channel->fill(0.5,weight);
00252                   if(abs(lepton.pdgId()) == ELECTRON )
00253                     _count_1l_3jet_e_channel->fill(0.5,weight);
00254                   else
00255                     _count_1l_3jet_mu_channel->fill(0.5,weight);
00256                 }
00257                 _hist_1l_m_eff_3jet->fill(min(1599.,m_eff_inc),weight);
00258               }
00259             }
00260             // 4 jet channel
00261             else if (njet >=4 && recon_jets[3].momentum().perp()>80.) {
00262               m_eff += recon_jets[3].momentum().perp();
00263               if(eTmiss/m_eff>0.2) {
00264                 if(m_eff_inc>800.) {
00265                   _count_1l_4jet_all_channel->fill(0.5,weight);
00266                   if(abs(lepton.pdgId()) == ELECTRON )
00267                     _count_1l_4jet_e_channel->fill(0.5,weight);
00268                   else
00269                     _count_1l_4jet_mu_channel->fill(0.5,weight);
00270                 }
00271                 _hist_1l_m_eff_4jet->fill(min(1599.,m_eff_inc),weight);
00272               }
00273             }
00274           }
00275         }
00276         // multi lepton
00277         else if( recon_hard_e.size() + recon_hard_mu.size() >= 2 && njet >=2 ) {
00278           // get all the leptons and sort them by pT
00279           ParticleVector leptons(recon_hard_e.begin(),recon_hard_e.end());
00280           leptons.insert(leptons.begin(),recon_hard_mu.begin(),recon_hard_mu.end());
00281           std::sort(leptons.begin(),leptons.end(),cmpParticleByPt);
00282           double m_eff(0.0);
00283           for (size_t ix = 0; ix < leptons.size(); ++ix)
00284             m_eff += leptons[ix].momentum().perp();
00285           m_eff_inc += m_eff;
00286           m_eff += eTmiss;
00287           for (size_t ix = 0; ix < (size_t) min(4, int(recon_jets.size())); ++ix)
00288             m_eff += recon_jets[ix].momentum().perp();
00289           // require opposite sign leptons
00290           if(leptons[0].pdgId()*leptons[1].pdgId()<0) {
00291             // 2 jet
00292             if(recon_jets[1].momentum().perp()>200 &&
00293                ( njet<4 || (njet>=4 && recon_jets[3].momentum().perp()<50.)) && eTmiss>300.) {
00294               _count_2l_2jet_all_channel->fill(0.5,weight);
00295               if(abs(leptons[0].pdgId()) == ELECTRON && abs(leptons[1].pdgId()) == ELECTRON )
00296                 _count_2l_2jet_ee_channel->fill(0.5,weight);
00297               else if (abs(leptons[0].pdgId()) == MUON && abs(leptons[1].pdgId()) == MUON )
00298                 _count_2l_2jet_mumu_channel->fill(0.5,weight);
00299               else
00300                 _count_2l_2jet_emu_channel->fill(0.5,weight);
00301               _hist_2l_m_eff_2jet->fill(min(1699.,m_eff_inc),weight);
00302             }
00303             // 4 jet
00304             else if(njet>=4&& recon_jets[3].momentum().perp()>=50.&&
00305                     eTmiss>100. && eTmiss/m_eff>0.2) {
00306               if( m_eff_inc>650. ) {
00307                 _count_2l_4jet_all_channel->fill(0.5,weight);
00308                 if(abs(leptons[0].pdgId()) == ELECTRON && abs(leptons[1].pdgId()) == ELECTRON )
00309                   _count_2l_4jet_ee_channel->fill(0.5,weight);
00310                 else if (abs(leptons[0].pdgId()) == MUON && abs(leptons[1].pdgId()) == MUON )
00311                   _count_2l_4jet_mumu_channel->fill(0.5,weight);
00312                 else
00313                   _count_2l_4jet_emu_channel->fill(0.5,weight);
00314               }
00315               _hist_2l_m_eff_4jet->fill(min(1599.,m_eff_inc),weight);
00316             }
00317           }
00318         }
00319       }
00320       // soft lepton selection
00321       if( recon_soft_e.size() + recon_soft_mu.size() == 1 ) {
00322         // discard jets that overlap with electrons
00323         Jets recon_jets;
00324         foreach ( const Jet& jet, cand_jets ) {
00325           if(fabs(jet.momentum().eta())>2.5||
00326              jet.momentum().perp()<25.) continue;
00327           bool away_from_e = true;
00328           foreach ( const Particle & e, cand_soft_e ) {
00329             if ( deltaR(e.momentum(),jet.momentum()) < 0.2 ) {
00330               away_from_e = false;
00331               break;
00332             }
00333           }
00334           if ( away_from_e ) recon_jets.push_back( jet );
00335         }
00336         // meff calculation
00337         double HT=0.;
00338         foreach( const Jet & jet, recon_jets) {
00339           HT += jet.momentum().perp();
00340         }
00341         double m_eff_inc  = HT+eTmiss;
00342         // get the lepton
00343         Particle lepton = recon_soft_e.empty() ?
00344           recon_soft_mu[0] : recon_soft_e[0];
00345         // lepton variables
00346         double pT = lepton.momentum().perp();
00347         double mT  = 2.*(pT*eTmiss -
00348                          lepton.momentum().x()*pTmiss.x() -
00349                          lepton.momentum().y()*pTmiss.y());
00350         mT = sqrt(mT);
00351         m_eff_inc += pT;
00352         double m_eff = pT+eTmiss;
00353         // apply final cuts
00354         if(recon_jets.size() >= 2 && recon_jets[0].momentum().perp()>130. &&
00355            mT>100. && eTmiss>250.) {
00356           for(unsigned int ix=0;ix<2;++ix) m_eff += recon_jets[0].momentum().perp();
00357           if( eTmiss/m_eff>0.3 ) {
00358             _count_1l_soft_all_channel->fill(0.5,weight);
00359             if(abs(lepton.pdgId()) == ELECTRON )
00360               _count_1l_soft_e_channel->fill(0.5,weight);
00361             else
00362               _count_1l_soft_mu_channel->fill(0.5,weight);
00363           }
00364           _hist_1l_eTmiss_m_eff_soft->fill( eTmiss/m_eff_inc,weight);
00365         }
00366       }
00367     }
00368     //@}
00369 
00370 
00371     void finalize() {
00372 
00373       double norm = 4.7* crossSection()/sumOfWeights()/femtobarn;
00374       scale(_count_1l_3jet_all_channel  ,norm);
00375       scale(_count_1l_3jet_e_channel    ,norm);
00376       scale(_count_1l_3jet_mu_channel   ,norm);
00377       scale(_count_1l_4jet_all_channel  ,norm);
00378       scale(_count_1l_4jet_e_channel    ,norm);
00379       scale(_count_1l_4jet_mu_channel   ,norm);
00380       scale(_count_1l_soft_all_channel  ,norm);
00381       scale(_count_1l_soft_e_channel    ,norm);
00382       scale(_count_1l_soft_mu_channel   ,norm);
00383       scale(_count_2l_2jet_all_channel  ,norm);
00384       scale(_count_2l_2jet_ee_channel   ,norm);
00385       scale(_count_2l_2jet_emu_channel  ,norm);
00386       scale(_count_2l_2jet_mumu_channel ,norm);
00387       scale(_count_2l_4jet_all_channel  ,norm);
00388       scale(_count_2l_4jet_ee_channel   ,norm);
00389       scale(_count_2l_4jet_emu_channel  ,norm);
00390       scale(_count_2l_4jet_mumu_channel ,norm);
00391 
00392       scale(_hist_1l_m_eff_3jet         ,200.*norm);
00393       scale(_hist_1l_m_eff_4jet         ,200.*norm);
00394       scale(_hist_1l_eTmiss_m_eff_soft  ,0.1*norm);
00395       scale(_hist_2l_m_eff_2jet         ,200.*norm);
00396       scale(_hist_2l_m_eff_4jet         ,200.*norm);
00397 
00398     }
00399 
00400   private:
00401 
00402     /// @name Histos
00403     //@{
00404     Histo1DPtr _count_1l_3jet_all_channel;
00405     Histo1DPtr _count_1l_3jet_e_channel;
00406     Histo1DPtr _count_1l_3jet_mu_channel;
00407     Histo1DPtr _count_1l_4jet_all_channel;
00408     Histo1DPtr _count_1l_4jet_e_channel;
00409     Histo1DPtr _count_1l_4jet_mu_channel;
00410     Histo1DPtr _count_1l_soft_all_channel;
00411     Histo1DPtr _count_1l_soft_e_channel;
00412     Histo1DPtr _count_1l_soft_mu_channel;
00413     Histo1DPtr _count_2l_2jet_all_channel;
00414     Histo1DPtr _count_2l_2jet_ee_channel;
00415     Histo1DPtr _count_2l_2jet_emu_channel;
00416     Histo1DPtr _count_2l_2jet_mumu_channel;
00417     Histo1DPtr _count_2l_4jet_all_channel;
00418     Histo1DPtr _count_2l_4jet_ee_channel;
00419     Histo1DPtr _count_2l_4jet_emu_channel;
00420     Histo1DPtr _count_2l_4jet_mumu_channel;
00421     Histo1DPtr _hist_1l_m_eff_3jet;
00422     Histo1DPtr _hist_1l_m_eff_4jet;
00423     Histo1DPtr _hist_1l_eTmiss_m_eff_soft;
00424     Histo1DPtr _hist_2l_m_eff_2jet;
00425     Histo1DPtr _hist_2l_m_eff_4jet;
00426     //@}
00427 
00428   };
00429 
00430   // The hook for the plugin system
00431   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1180197);
00432 
00433 }