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