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