00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/RivetAIDA.hh" 00004 #include "Rivet/Tools/Logging.hh" 00005 #include "Rivet/Projections/ChargedFinalState.hh" 00006 00007 namespace Rivet { 00008 00009 00010 /// @brief MC validation analysis for Z + jets events 00011 /// @todo More! This analysis just checks the \f$ \eta \f$ distribution at the moment. 00012 class MC_TTBAR : public Analysis { 00013 public: 00014 00015 /// @name Constructors etc. 00016 //@{ 00017 00018 /// Constructor 00019 MC_TTBAR() 00020 : Analysis("MC_TTBAR") 00021 { 00022 //setNeedsCrossSection(false); 00023 } 00024 00025 //@} 00026 00027 00028 public: 00029 00030 /// @name Analysis methods 00031 //@{ 00032 00033 /// Book histograms and initialise projections before the run 00034 void init() { 00035 00036 const ChargedFinalState cfs(-5.0, 5.0); 00037 addProjection(cfs, "CFS"); 00038 00039 /// @todo Book histograms here, e.g.: 00040 _hist_nch_eta = bookHistogram1D("nch-eta", 20, -5.0, 5.0); 00041 00042 } 00043 00044 00045 /// Perform the per-event analysis 00046 void analyze(const Event& event) { 00047 const double weight = event.weight(); 00048 const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFS"); 00049 00050 foreach (const Particle& p, cfs.particles()) { 00051 double eta = p.momentum().pseudorapidity(); 00052 _hist_nch_eta->fill(eta, weight); 00053 } 00054 00055 } 00056 00057 00058 /// Normalise histograms etc., after the run 00059 void finalize() { 00060 scale(_hist_nch_eta, 1.0/sumOfWeights()); 00061 } 00062 00063 00064 private: 00065 00066 /// @name Histograms 00067 //@{ 00068 AIDA::IHistogram1D* _hist_nch_eta; 00069 //@} 00070 00071 }; 00072 00073 00074 00075 // This global object acts as a hook for the plugin system 00076 AnalysisBuilder<MC_TTBAR> plugin_MC_TTBAR; 00077 00078 00079 }