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