rivet is hosted by Hepforge, IPPP Durham
CMS_2012_I941555.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/ZFinder.hh"
00004 
00005 namespace Rivet {
00006 
00007   using namespace Cuts;
00008 
00009 
00010   /// @brief CMS Z pT and rapidity in Drell-Yan events at 7 TeV
00011   /// @author Justin Hugon, Luca Perrozzi
00012   class CMS_2012_I941555 : public Analysis {
00013   public:
00014 
00015     /// Constructor
00016     CMS_2012_I941555()
00017       : Analysis("CMS_2012_I941555")
00018     {
00019       _sumw_mu_dressed_pt  = 0;
00020       _sumwpeak_mu_dressed = 0;
00021       _sumw_el_dressed_rap = 0;
00022       _sumw_el_dressed_pt  = 0;
00023       _sumwpeak_el_dressed = 0;
00024     }
00025 
00026 
00027     /// @name Analysis methods
00028     //@{
00029 
00030     void init() {
00031 
00032       // Set up projections
00033       /// @todo Really?: ZFinder zfinder_dressed_mu_pt(-2.1, 2.1, 20, PID::MUON, 60*GeV, 120*GeV, 0.2, false, true);
00034       FinalState fs;
00035       Cut cuts = etaIn(-2.1,2.1) & (pT >= 20.0*GeV);
00036       ZFinder zfinder_dressed_mu_pt(fs, cuts, PID::MUON, 60*GeV, 120*GeV, 0.2);
00037       addProjection(zfinder_dressed_mu_pt, "ZFinder_dressed_mu_pt");
00038       ZFinder zfinder_dressed_el_pt(fs, cuts, PID::ELECTRON, 60*GeV, 120*GeV, 0.1);
00039       addProjection(zfinder_dressed_el_pt, "ZFinder_dressed_el_pt");
00040 
00041       ZFinder zfinder_dressed_mu_rap(fs, Cuts::open(), PID::MUON, 60*GeV, 120*GeV, 0.1);
00042       addProjection(zfinder_dressed_mu_rap, "ZFinder_dressed_mu_rap");
00043       ZFinder zfinder_dressed_el_rap(fs, Cuts::open(), PID::ELECTRON, 60*GeV, 120*GeV, 0.1);
00044       addProjection(zfinder_dressed_el_rap, "ZFinder_dressed_el_rap");
00045 
00046       // Book histograms
00047       _hist_zrap_mu_dressed      = bookHisto1D(1, 1, 1);  // muon "dressed" rapidity
00048       _hist_zrap_el_dressed      = bookHisto1D(1, 1, 2);  // electron "dressed" rapidity
00049       _hist_zrap_comb_dressed    = bookHisto1D(1, 1, 3);  // electron "dressed" rapidity
00050 
00051       _hist_zpt_mu_dressed       = bookHisto1D(2, 1, 1);  // muon "dressed" pt
00052       _hist_zpt_el_dressed       = bookHisto1D(2, 1, 2);  // electron "dressed" pt
00053       _hist_zpt_comb_dressed     = bookHisto1D(2, 1, 3);  // electron "dressed" pt
00054 
00055       _hist_zptpeak_mu_dressed   = bookHisto1D(3, 1, 1);  // muon "dressed" pt peak
00056       _hist_zptpeak_el_dressed   = bookHisto1D(3, 1, 2);  // electron "dressed" pt peak
00057       _hist_zptpeak_comb_dressed = bookHisto1D(3, 1, 3);  // electron "dressed" pt peak
00058     }
00059 
00060 
00061     /// Do the analysis
00062     void analyze(const Event& evt) {
00063       const double weight = evt.weight();
00064 
00065       const ZFinder& zfinder_dressed_mu_rap = applyProjection<ZFinder>(evt, "ZFinder_dressed_mu_rap");
00066       if (!zfinder_dressed_mu_rap.bosons().empty()) {
00067         _sumw_mu_dressed_rap += weight;
00068         const FourMomentum pZ = zfinder_dressed_mu_rap.bosons()[0].momentum();
00069         _hist_zrap_mu_dressed->fill(pZ.rapidity()/GeV, weight);
00070         _hist_zrap_comb_dressed->fill(pZ.rapidity()/GeV, weight);
00071       }
00072 
00073       const ZFinder& zfinder_dressed_mu_pt = applyProjection<ZFinder>(evt, "ZFinder_dressed_mu_pt");
00074       if (!zfinder_dressed_mu_pt.bosons().empty()) {
00075         _sumw_mu_dressed_pt += weight;
00076         const FourMomentum pZ = zfinder_dressed_mu_pt.bosons()[0].momentum();
00077         _hist_zpt_mu_dressed->fill(pZ.pT()/GeV, weight);
00078         _hist_zpt_comb_dressed->fill(pZ.pT()/GeV, weight);
00079         if (pZ.pT() < 30*GeV) {
00080           _sumwpeak_mu_dressed += weight;
00081           _hist_zptpeak_mu_dressed->fill(pZ.pT()/GeV, weight);
00082           _hist_zptpeak_comb_dressed->fill(pZ.pT()/GeV, weight);
00083         }
00084       }
00085 
00086       const ZFinder& zfinder_dressed_el_rap = applyProjection<ZFinder>(evt, "ZFinder_dressed_el_rap");
00087       if (!zfinder_dressed_el_rap.bosons().empty()) {
00088         _sumw_el_dressed_rap += weight;
00089         const FourMomentum pZ = zfinder_dressed_el_rap.bosons()[0].momentum();
00090         _hist_zrap_el_dressed->fill(pZ.rapidity()/GeV, weight);
00091         _hist_zrap_comb_dressed->fill(pZ.rapidity()/GeV, weight);
00092       }
00093 
00094       const ZFinder& zfinder_dressed_el_pt = applyProjection<ZFinder>(evt, "ZFinder_dressed_el_pt");
00095       if (!zfinder_dressed_el_pt.bosons().empty()) {
00096         _sumw_el_dressed_pt += weight;
00097         const FourMomentum pZ = zfinder_dressed_el_pt.bosons()[0].momentum();
00098         _hist_zpt_el_dressed->fill(pZ.pT()/GeV, weight);
00099         _hist_zpt_comb_dressed->fill(pZ.pT()/GeV, weight);
00100         if (pZ.pT() < 30*GeV) {
00101           _sumwpeak_el_dressed += weight;
00102           _hist_zptpeak_el_dressed->fill(pZ.pT()/GeV, weight);
00103           _hist_zptpeak_comb_dressed->fill(pZ.pT()/GeV, weight);
00104         }
00105       }
00106 
00107     }
00108 
00109 
00110     void finalize() {
00111       scale(_hist_zrap_mu_dressed, safediv(1, _sumw_mu_dressed_rap, 1));
00112       scale(_hist_zpt_mu_dressed, safediv(1, _sumw_mu_dressed_pt, 1));
00113       scale(_hist_zptpeak_mu_dressed, safediv(1, _sumwpeak_mu_dressed, 1));
00114 
00115       scale(_hist_zrap_el_dressed, safediv(1, _sumw_el_dressed_rap, 1));
00116       scale(_hist_zpt_el_dressed, safediv(1, _sumw_el_dressed_pt, 1));
00117       scale(_hist_zptpeak_el_dressed, safediv(1, _sumwpeak_el_dressed, 1));
00118 
00119       scale(_hist_zrap_comb_dressed, safediv(1, _sumw_el_dressed_rap+_sumw_mu_dressed_rap, 1));
00120       scale(_hist_zpt_comb_dressed, safediv(1, _sumw_el_dressed_pt+_sumw_mu_dressed_pt, 1));
00121       scale(_hist_zptpeak_comb_dressed, safediv(1, _sumwpeak_el_dressed+_sumwpeak_mu_dressed, 1));
00122     }
00123 
00124     //@}
00125 
00126 
00127   private:
00128 
00129     double _sumw_mu_dressed_rap;
00130     double _sumw_mu_dressed_pt;
00131     double _sumwpeak_mu_dressed;
00132 
00133     double _sumw_el_dressed_rap;
00134     double _sumw_el_dressed_pt;
00135     double _sumwpeak_el_dressed;
00136 
00137     Histo1DPtr _hist_zrap_mu_dressed;
00138     Histo1DPtr _hist_zpt_mu_dressed;
00139     Histo1DPtr _hist_zptpeak_mu_dressed;
00140 
00141     Histo1DPtr _hist_zrap_el_dressed;
00142     Histo1DPtr _hist_zpt_el_dressed;
00143     Histo1DPtr _hist_zptpeak_el_dressed;
00144 
00145     Histo1DPtr _hist_zrap_comb_dressed;
00146     Histo1DPtr _hist_zpt_comb_dressed;
00147     Histo1DPtr _hist_zptpeak_comb_dressed;
00148 
00149   };
00150 
00151 
00152   DECLARE_RIVET_PLUGIN(CMS_2012_I941555);
00153 
00154 }