rivet is hosted by Hepforge, IPPP Durham
MC_ZINC.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 MC validation analysis for Z events
00009   class MC_ZINC : public Analysis {
00010   public:
00011 
00012     /// Default constructor
00013     MC_ZINC()
00014       : Analysis("MC_ZINC")
00015     {    }
00016 
00017 
00018     /// @name Analysis methods
00019     //@{
00020 
00021     /// Book histograms
00022     void init() {
00023       FinalState fs;
00024       Cut cut = EtaIn(-3.5,3.5) & (Cuts::pT >= 25.0*GeV);
00025       ZFinder zfinder(fs, cut, PID::ELECTRON, 65.0*GeV, 115.0*GeV, 0.2, ZFinder::CLUSTERNODECAY, ZFinder::TRACK);
00026       addProjection(zfinder, "ZFinder");
00027 
00028       _h_Z_mass = bookHisto1D("Z_mass", 50, 66.0, 116.0);
00029       _h_Z_pT = bookHisto1D("Z_pT", logspace(100, 1.0, 0.5*sqrtS()/GeV));
00030       _h_Z_pT_peak = bookHisto1D("Z_pT_peak", 25, 0.0, 25.0);
00031       _h_Z_y = bookHisto1D("Z_y", 40, -4.0, 4.0);
00032       _h_Z_phi = bookHisto1D("Z_phi", 25, 0.0, TWOPI);
00033       _h_lepton_pT = bookHisto1D("lepton_pT", logspace(100, 10.0, 0.25*sqrtS()/GeV));
00034       _h_lepton_eta = bookHisto1D("lepton_eta", 40, -4.0, 4.0);
00035 
00036     }
00037 
00038 
00039 
00040     /// Do the analysis
00041     void analyze(const Event & e) {
00042       const ZFinder& zfinder = applyProjection<ZFinder>(e, "ZFinder");
00043       if (zfinder.bosons().size()!=1) {
00044         vetoEvent;
00045       }
00046       const double weight = e.weight();
00047 
00048       FourMomentum zmom(zfinder.bosons()[0].momentum());
00049       _h_Z_mass->fill(zmom.mass()/GeV, weight);
00050       _h_Z_pT->fill(zmom.pT()/GeV, weight);
00051       _h_Z_pT_peak->fill(zmom.pT()/GeV, weight);
00052       _h_Z_y->fill(zmom.rapidity(), weight);
00053       _h_Z_phi->fill(zmom.azimuthalAngle(), weight);
00054       foreach (const Particle& l, zfinder.constituents()) {
00055         _h_lepton_pT->fill(l.pT()/GeV, weight);
00056         _h_lepton_eta->fill(l.eta(), weight);
00057       }
00058     }
00059 
00060 
00061     /// Finalize
00062     void finalize() {
00063       const double xsec = crossSection()/picobarn;
00064       normalize(_h_Z_mass, xsec);
00065       normalize(_h_Z_pT, xsec);
00066       normalize(_h_Z_pT_peak, xsec);
00067       normalize(_h_Z_y, xsec);
00068       normalize(_h_Z_phi, xsec);
00069       normalize(_h_lepton_pT, xsec);
00070       normalize(_h_lepton_eta, xsec);
00071     }
00072 
00073     //@}
00074 
00075 
00076   private:
00077 
00078     /// @name Histograms
00079     //@{
00080     Histo1DPtr _h_Z_mass;
00081     Histo1DPtr _h_Z_pT;
00082     Histo1DPtr _h_Z_pT_peak;
00083     Histo1DPtr _h_Z_y;
00084     Histo1DPtr _h_Z_phi;
00085     Histo1DPtr _h_lepton_pT;
00086     Histo1DPtr _h_lepton_eta;
00087     //@}
00088 
00089   };
00090 
00091 
00092 
00093   // The hook for the plugin system
00094   DECLARE_RIVET_PLUGIN(MC_ZINC);
00095 
00096 }