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