rivet is hosted by Hepforge, IPPP Durham
CMS_2015_I1310737.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FastJets.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 #include "Rivet/Projections/InvMassFinalState.hh"
00006 #include "Rivet/Projections/VisibleFinalState.hh"
00007 #include "Rivet/Projections/VetoedFinalState.hh"
00008 #include "Rivet/Projections/ZFinder.hh"
00009 
00010 namespace Rivet {
00011 
00012 
00013   class CMS_2015_I1310737 : public Analysis {
00014   public:
00015 
00016     /// Constructor
00017     DEFAULT_RIVET_ANALYSIS_CTOR(CMS_2015_I1310737);
00018 
00019 
00020     /// Book histograms and initialise projections before the run
00021     void init() {
00022 
00023       FinalState fs; ///< @todo No cuts?
00024       VisibleFinalState visfs(fs);
00025 
00026       ZFinder zeeFinder(fs, Cuts::abseta < 2.4 && Cuts::pT > 20*GeV, PID::ELECTRON, 71.0*GeV, 111.0*GeV);
00027       declare(zeeFinder, "ZeeFinder");
00028 
00029       ZFinder zmumuFinder(fs, Cuts::abseta < 2.4 && Cuts::pT > 20*GeV, PID::MUON, 71.0*GeV, 111.0*GeV);
00030       declare(zmumuFinder, "ZmumuFinder");
00031 
00032       VetoedFinalState jetConstits(visfs);
00033       jetConstits.addVetoOnThisFinalState(zeeFinder);
00034       jetConstits.addVetoOnThisFinalState(zmumuFinder);
00035 
00036       FastJets akt05Jets(jetConstits, FastJets::ANTIKT, 0.5);
00037       declare(akt05Jets, "AntiKt05Jets");
00038 
00039 
00040       _h_excmult_jets_tot = bookHisto1D(1, 1, 1);
00041       _h_incmult_jets_tot = bookHisto1D(2, 1, 1);
00042       _h_leading_jet_pt_tot = bookHisto1D(3, 1, 1);
00043       _h_second_jet_pt_tot = bookHisto1D(4, 1, 1);
00044       _h_third_jet_pt_tot = bookHisto1D(5, 1, 1);
00045       _h_fourth_jet_pt_tot = bookHisto1D(6, 1, 1);
00046       _h_leading_jet_eta_tot = bookHisto1D(7, 1, 1);
00047       _h_second_jet_eta_tot = bookHisto1D(8, 1, 1);
00048       _h_third_jet_eta_tot = bookHisto1D(9, 1, 1);
00049       _h_fourth_jet_eta_tot = bookHisto1D(10, 1, 1);
00050       _h_ht1_tot = bookHisto1D(11, 1, 1);
00051       _h_ht2_tot = bookHisto1D(12, 1, 1);
00052       _h_ht3_tot = bookHisto1D(13, 1, 1);
00053       _h_ht4_tot = bookHisto1D(14, 1, 1);
00054     }
00055 
00056 
00057     /// Perform the per-event analysis
00058     void analyze(const Event& event) {;
00059 
00060       const ZFinder& zeeFS = apply<ZFinder>(event, "ZeeFinder");
00061       const ZFinder& zmumuFS = apply<ZFinder>(event, "ZmumuFinder");
00062 
00063       const Particles& zees = zeeFS.bosons();
00064       const Particles& zmumus = zmumuFS.bosons();
00065 
00066       // We did not find exactly one Z. No good.
00067       if (zees.size() + zmumus.size() != 1) {
00068         MSG_DEBUG("Did not find exactly one good Z candidate");
00069         vetoEvent;
00070       }
00071 
00072       // Find the (dressed!) leptons
00073       const Particles& dressedLeptons = zees.size() ? zeeFS.constituents() : zmumuFS.constituents();
00074 
00075       // Cluster jets
00076       // NB. Veto has already been applied on leptons and photons used for dressing
00077       const FastJets& fj = apply<FastJets>(event, "AntiKt05Jets");
00078       const Jets& jets = fj.jetsByPt(Cuts::abseta < 2.4 && Cuts::pT > 30*GeV);
00079 
00080       // Perform lepton-jet overlap and HT calculation
00081       double ht = 0;
00082       Jets goodjets;
00083       foreach (const Jet& j, jets) {
00084         // Decide if this jet is "good", i.e. isolated from the leptons
00085         /// @todo Nice use-case for any() and a C++11 lambda
00086         bool overlap = false;
00087         foreach (const Particle& l, dressedLeptons) {
00088           if (Rivet::deltaR(j, l) < 0.5) {
00089             overlap = true;
00090             break;
00091           }
00092         }
00093 
00094         // Fill HT and good-jets collection
00095         if (overlap) continue;
00096         goodjets.push_back(j);
00097         ht += j.pT();
00098       }
00099 
00100       // We don't care about events with no isolated jets
00101       if (goodjets.empty()) {
00102         MSG_DEBUG("No jets in event");
00103         vetoEvent;
00104       }
00105 
00106 
00107       /////////////////
00108 
00109 
00110       // Weight to be used for histo filling
00111       const double w = 0.5 * event.weight();
00112 
00113       // Fill jet number integral histograms
00114       _h_excmult_jets_tot->fill(goodjets.size(), w);
00115       /// @todo Could be better computed by toIntegral transform on exclusive histo
00116       for (size_t iJet = 1; iJet <= goodjets.size(); iJet++ )
00117         _h_incmult_jets_tot->fill(iJet, w);
00118 
00119       // Fill leading jet histograms
00120       const Jet& j1 = goodjets[0];
00121       _h_leading_jet_pt_tot->fill(j1.pT()/GeV, w);
00122       _h_leading_jet_eta_tot->fill(j1.abseta(), w);
00123       _h_ht1_tot->fill(ht/GeV, w);
00124 
00125       // Fill 2nd jet histograms
00126       if (goodjets.size() < 2) return;
00127       const Jet& j2 = goodjets[1];
00128       _h_second_jet_pt_tot->fill(j2.pT()/GeV, w);
00129       _h_second_jet_eta_tot->fill(j2.abseta(), w);
00130       _h_ht2_tot->fill(ht/GeV, w);
00131 
00132       // Fill 3rd jet histograms
00133       if (goodjets.size() < 3) return;
00134       const Jet& j3 = goodjets[2];
00135       _h_third_jet_pt_tot->fill(j3.pT()/GeV, w);
00136       _h_third_jet_eta_tot->fill(j3.abseta(), w);
00137       _h_ht3_tot->fill(ht/GeV, w);
00138 
00139       // Fill 4th jet histograms
00140       if (goodjets.size() < 4) return;
00141       const Jet& j4 = goodjets[3];
00142       _h_fourth_jet_pt_tot->fill(j4.pT()/GeV, w);
00143       _h_fourth_jet_eta_tot->fill(j4.abseta(), w);
00144       _h_ht4_tot->fill(ht/GeV, w);
00145     }
00146 
00147 
00148     /// Normalise histograms etc., after the run
00149     void finalize() {
00150 
00151       const double norm = (sumOfWeights() != 0) ? crossSection()/sumOfWeights() : 1.0;
00152 
00153       MSG_INFO("Cross section = " << std::setfill(' ') << std::setw(14) << std::fixed << std::setprecision(3) << crossSection() << " pb");
00154       MSG_INFO("# Events      = " << std::setfill(' ') << std::setw(14) << std::fixed << std::setprecision(3) << numEvents() );
00155       MSG_INFO("SumW          = " << std::setfill(' ') << std::setw(14) << std::fixed << std::setprecision(3) << sumOfWeights());
00156       MSG_INFO("Norm factor   = " << std::setfill(' ') << std::setw(14) << std::fixed << std::setprecision(6) << norm);
00157 
00158       scale(_h_excmult_jets_tot, norm );
00159       scale(_h_incmult_jets_tot, norm );
00160       scale(_h_leading_jet_pt_tot, norm );
00161       scale(_h_second_jet_pt_tot, norm );
00162       scale(_h_third_jet_pt_tot, norm );
00163       scale(_h_fourth_jet_pt_tot, norm );
00164       scale(_h_leading_jet_eta_tot, norm );
00165       scale(_h_second_jet_eta_tot, norm );
00166       scale(_h_third_jet_eta_tot, norm );
00167       scale(_h_fourth_jet_eta_tot, norm );
00168       scale(_h_ht1_tot, norm );
00169       scale(_h_ht2_tot, norm );
00170       scale(_h_ht3_tot, norm );
00171       scale(_h_ht4_tot, norm );
00172     }
00173 
00174 
00175   private:
00176 
00177     /// @name Histograms
00178 
00179     Histo1DPtr _h_excmult_jets_tot,  _h_incmult_jets_tot;
00180     Histo1DPtr _h_leading_jet_pt_tot, _h_second_jet_pt_tot, _h_third_jet_pt_tot, _h_fourth_jet_pt_tot;
00181     Histo1DPtr _h_leading_jet_eta_tot, _h_second_jet_eta_tot, _h_third_jet_eta_tot, _h_fourth_jet_eta_tot;
00182     Histo1DPtr _h_ht1_tot, _h_ht2_tot, _h_ht3_tot, _h_ht4_tot;
00183 
00184   };
00185 
00186 
00187   DECLARE_RIVET_PLUGIN(CMS_2015_I1310737);
00188 
00189 
00190 }