MC_PDFS.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/RivetYODA.hh" 00004 #include "Rivet/Tools/Logging.hh" 00005 // #include "Rivet/Projections/ChargedFinalState.hh" 00006 00007 namespace Rivet { 00008 00009 00010 /// Generic analysis looking at various distributions of final state particles 00011 class MC_PDFS : public Analysis { 00012 public: 00013 00014 /// Constructor 00015 MC_PDFS() 00016 : Analysis("MC_PDFS") 00017 { } 00018 00019 00020 public: 00021 00022 /// @name Analysis methods 00023 //@{ 00024 00025 /// Book histograms and initialise projections before the run 00026 void init() { 00027 // Projections 00028 // addProjection(ChargedFinalState(-5.0, 5.0, 500*MeV), "CFS"); 00029 00030 // Histograms 00031 _histPdfX = bookHisto1D("PdfX", logspace(50, 0.000001, 1.0)); 00032 _histPdfXmin = bookHisto1D("PdfXmin", logspace(50, 0.000001, 1.0)); 00033 _histPdfXmax = bookHisto1D("PdfXmax", logspace(50, 0.000001, 1.0)); 00034 _histPdfQ = bookHisto1D("PdfQ", 50, 0.0, 30.0); 00035 // _histPdfXQ = bookHisto2D("PdfXQ", logspace(50, 0.000001, 1.0), linspace(50, 0.0, 30.0)); 00036 // _histPdfTrackptVsX = bookProfile1D("PdfTrackptVsX", logspace(50, 0.000001, 1.0)); 00037 // _histPdfTrackptVsQ = bookProfile1D("PdfTrackptVsQ", 50, 0.0, 30.0); 00038 } 00039 00040 00041 /// Perform the per-event analysis 00042 void analyze(const Event& event) { 00043 const double weight = event.weight(); 00044 00045 // This analysis needs a valid HepMC PDF info object to do anything 00046 if (event.genEvent().pdf_info() == 0) vetoEvent; 00047 HepMC::PdfInfo pdfi = *event.genEvent().pdf_info(); 00048 00049 MSG_DEBUG("PDF Q = " << pdfi.scalePDF() << " for (id, x) = " 00050 << "(" << pdfi.id1() << ", " << pdfi.x1() << ") " 00051 << "(" << pdfi.id2() << ", " << pdfi.x2() << ")"); 00052 _histPdfX->fill(pdfi.x1(), weight); 00053 _histPdfX->fill(pdfi.x2(), weight); 00054 _histPdfXmin->fill(std::min(pdfi.x1(), pdfi.x2()), weight); 00055 _histPdfXmax->fill(std::max(pdfi.x1(), pdfi.x2()), weight); 00056 _histPdfQ->fill(pdfi.scalePDF(), weight); // always in GeV? 00057 00058 // const FinalState& cfs = applyProjection<FinalState>(event, "CFS"); 00059 // foreach (const Particle& p, cfs.particles()) { 00060 // if (fabs(eta) < 2.5 && p.momentum().pT() > 10*GeV) { 00061 // _histPdfTrackptVsX->fill(pdfi.x1(), p.momentum().pT()/GeV, weight); 00062 // _histPdfTrackptVsX->fill(pdfi.x2(), p.momentum().pT()/GeV, weight); 00063 // _histPdfTrackptVsQ->fill(pdfi.scalePDF(), p.momentum().pT()/GeV, weight); 00064 // } 00065 // } 00066 00067 } 00068 00069 00070 00071 /// Finalize 00072 void finalize() { 00073 scale(_histPdfX, 1/sumOfWeights()); 00074 scale(_histPdfXmin, 1/sumOfWeights()); 00075 scale(_histPdfXmax, 1/sumOfWeights()); 00076 scale(_histPdfQ, 1/sumOfWeights()); 00077 } 00078 00079 //@} 00080 00081 00082 private: 00083 00084 /// @name Histograms 00085 //@{ 00086 Histo1DPtr _histPdfX, _histPdfXmin, _histPdfXmax, _histPdfQ; 00087 // Profile1DPtr _histPdfTrackptVsX, _histPdfTrackptVsQ; 00088 //@} 00089 00090 }; 00091 00092 00093 // The hook for the plugin system 00094 DECLARE_RIVET_PLUGIN(MC_PDFS); 00095 00096 } Generated on Fri Dec 21 2012 15:03:41 for The Rivet MC analysis system by ![]() |