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