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