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       FinalState fs;
00033       Cut cuts = EtaIn(-2.1,2.1) & (Cuts::pT >= 20.0*GeV);
00034       ZFinder zfinder_dressed_mu_pt(fs, cuts, PID::MUON, 60*GeV, 120*GeV, 0.2);
00035       addProjection(zfinder_dressed_mu_pt, "ZFinder_dressed_mu_pt");
00036       ZFinder zfinder_dressed_el_pt(fs, cuts, PID::ELECTRON, 60*GeV, 120*GeV, 0.1);
00037       addProjection(zfinder_dressed_el_pt, "ZFinder_dressed_el_pt");
00038 
00039       ZFinder zfinder_dressed_mu_rap(fs, Cuts::open(), PID::MUON, 60*GeV, 120*GeV, 0.1);
00040       addProjection(zfinder_dressed_mu_rap, "ZFinder_dressed_mu_rap");
00041       ZFinder zfinder_dressed_el_rap(fs, Cuts::open(), PID::ELECTRON, 60*GeV, 120*GeV, 0.1);
00042       addProjection(zfinder_dressed_el_rap, "ZFinder_dressed_el_rap");
00043 
00044       // Book histograms
00045       _hist_zrap_mu_dressed      = bookHisto1D(1, 1, 1);  // muon "dressed" rapidity
00046       _hist_zrap_el_dressed      = bookHisto1D(1, 1, 2);  // electron "dressed" rapidity
00047       _hist_zrap_comb_dressed    = bookHisto1D(1, 1, 3);  // electron "dressed" rapidity
00048 
00049       _hist_zpt_mu_dressed       = bookHisto1D(2, 1, 1);  // muon "dressed" pt
00050       _hist_zpt_el_dressed       = bookHisto1D(2, 1, 2);  // electron "dressed" pt
00051       _hist_zpt_comb_dressed     = bookHisto1D(2, 1, 3);  // electron "dressed" pt
00052 
00053       _hist_zptpeak_mu_dressed   = bookHisto1D(3, 1, 1);  // muon "dressed" pt peak
00054       _hist_zptpeak_el_dressed   = bookHisto1D(3, 1, 2);  // electron "dressed" pt peak
00055       _hist_zptpeak_comb_dressed = bookHisto1D(3, 1, 3);  // electron "dressed" pt peak
00056     }
00057 
00058 
00059     /// Do the analysis
00060     void analyze(const Event& evt) {
00061       const double weight = evt.weight();
00062 
00063       const ZFinder& zfinder_dressed_mu_rap = applyProjection<ZFinder>(evt, "ZFinder_dressed_mu_rap");
00064       if (!zfinder_dressed_mu_rap.bosons().empty()) {
00065         _sumw_mu_dressed_rap += weight;
00066         const FourMomentum pZ = zfinder_dressed_mu_rap.bosons()[0].momentum();
00067         _hist_zrap_mu_dressed->fill(pZ.rapidity()/GeV, weight);
00068         _hist_zrap_comb_dressed->fill(pZ.rapidity()/GeV, weight);
00069       }
00070 
00071       const ZFinder& zfinder_dressed_mu_pt = applyProjection<ZFinder>(evt, "ZFinder_dressed_mu_pt");
00072       if (!zfinder_dressed_mu_pt.bosons().empty()) {
00073         _sumw_mu_dressed_pt += weight;
00074         const FourMomentum pZ = zfinder_dressed_mu_pt.bosons()[0].momentum();
00075         _hist_zpt_mu_dressed->fill(pZ.pT()/GeV, weight);
00076         _hist_zpt_comb_dressed->fill(pZ.pT()/GeV, weight);
00077         if (pZ.pT() < 30*GeV) {
00078           _sumwpeak_mu_dressed += weight;
00079           _hist_zptpeak_mu_dressed->fill(pZ.pT()/GeV, weight);
00080           _hist_zptpeak_comb_dressed->fill(pZ.pT()/GeV, weight);
00081         }
00082       }
00083 
00084       const ZFinder& zfinder_dressed_el_rap = applyProjection<ZFinder>(evt, "ZFinder_dressed_el_rap");
00085       if (!zfinder_dressed_el_rap.bosons().empty()) {
00086         _sumw_el_dressed_rap += weight;
00087         const FourMomentum pZ = zfinder_dressed_el_rap.bosons()[0].momentum();
00088         _hist_zrap_el_dressed->fill(pZ.rapidity()/GeV, weight);
00089         _hist_zrap_comb_dressed->fill(pZ.rapidity()/GeV, weight);
00090       }
00091 
00092       const ZFinder& zfinder_dressed_el_pt = applyProjection<ZFinder>(evt, "ZFinder_dressed_el_pt");
00093       if (!zfinder_dressed_el_pt.bosons().empty()) {
00094         _sumw_el_dressed_pt += weight;
00095         const FourMomentum pZ = zfinder_dressed_el_pt.bosons()[0].momentum();
00096         _hist_zpt_el_dressed->fill(pZ.pT()/GeV, weight);
00097         _hist_zpt_comb_dressed->fill(pZ.pT()/GeV, weight);
00098         if (pZ.pT() < 30*GeV) {
00099           _sumwpeak_el_dressed += weight;
00100           _hist_zptpeak_el_dressed->fill(pZ.pT()/GeV, weight);
00101           _hist_zptpeak_comb_dressed->fill(pZ.pT()/GeV, weight);
00102         }
00103       }
00104 
00105     }
00106 
00107 
00108     void finalize() {
00109       scale(_hist_zrap_mu_dressed, safediv(1, _sumw_mu_dressed_rap, 1));
00110       scale(_hist_zpt_mu_dressed, safediv(1, _sumw_mu_dressed_pt, 1));
00111       scale(_hist_zptpeak_mu_dressed, safediv(1, _sumwpeak_mu_dressed, 1));
00112 
00113       scale(_hist_zrap_el_dressed, safediv(1, _sumw_el_dressed_rap, 1));
00114       scale(_hist_zpt_el_dressed, safediv(1, _sumw_el_dressed_pt, 1));
00115       scale(_hist_zptpeak_el_dressed, safediv(1, _sumwpeak_el_dressed, 1));
00116 
00117       scale(_hist_zrap_comb_dressed, safediv(1, _sumw_el_dressed_rap+_sumw_mu_dressed_rap, 1));
00118       scale(_hist_zpt_comb_dressed, safediv(1, _sumw_el_dressed_pt+_sumw_mu_dressed_pt, 1));
00119       scale(_hist_zptpeak_comb_dressed, safediv(1, _sumwpeak_el_dressed+_sumwpeak_mu_dressed, 1));
00120     }
00121 
00122     //@}
00123 
00124 
00125   private:
00126 
00127     double _sumw_mu_dressed_rap;
00128     double _sumw_mu_dressed_pt;
00129     double _sumwpeak_mu_dressed;
00130 
00131     double _sumw_el_dressed_rap;
00132     double _sumw_el_dressed_pt;
00133     double _sumwpeak_el_dressed;
00134 
00135     Histo1DPtr _hist_zrap_mu_dressed;
00136     Histo1DPtr _hist_zpt_mu_dressed;
00137     Histo1DPtr _hist_zptpeak_mu_dressed;
00138 
00139     Histo1DPtr _hist_zrap_el_dressed;
00140     Histo1DPtr _hist_zpt_el_dressed;
00141     Histo1DPtr _hist_zptpeak_el_dressed;
00142 
00143     Histo1DPtr _hist_zrap_comb_dressed;
00144     Histo1DPtr _hist_zpt_comb_dressed;
00145     Histo1DPtr _hist_zptpeak_comb_dressed;
00146 
00147   };
00148 
00149 
00150   DECLARE_RIVET_PLUGIN(CMS_2012_I941555);
00151 
00152 }