MC_PDFS.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 // #include "Rivet/Projections/ChargedFinalState.hh" 00004 00005 namespace Rivet { 00006 00007 00008 /// Generic analysis looking at various distributions of final state particles 00009 class MC_PDFS : public Analysis { 00010 public: 00011 00012 /// Constructor 00013 MC_PDFS() 00014 : Analysis("MC_PDFS") 00015 { } 00016 00017 00018 public: 00019 00020 /// @name Analysis methods 00021 //@{ 00022 00023 /// Book histograms and initialise projections before the run 00024 void init() { 00025 // Projections 00026 // addProjection(ChargedFinalState(-5.0, 5.0, 500*MeV), "CFS"); 00027 00028 // Histograms 00029 _histPdfX = bookHisto1D("PdfX", logspace(50, 0.000001, 1.0)); 00030 _histPdfXmin = bookHisto1D("PdfXmin", logspace(50, 0.000001, 1.0)); 00031 _histPdfXmax = bookHisto1D("PdfXmax", logspace(50, 0.000001, 1.0)); 00032 _histPdfQ = bookHisto1D("PdfQ", 50, 0.0, 30.0); 00033 _histPdfXQ = bookHisto2D("PdfXQ", logspace(50, 0.000001, 1.0), linspace(50, 0.0, 30.0)); 00034 // _histPdfTrackptVsX = bookProfile1D("PdfTrackptVsX", logspace(50, 0.000001, 1.0)); 00035 // _histPdfTrackptVsQ = bookProfile1D("PdfTrackptVsQ", 50, 0.0, 30.0); 00036 } 00037 00038 00039 /// Perform the per-event analysis 00040 void analyze(const Event& event) { 00041 const double weight = event.weight(); 00042 00043 // This analysis needs a valid HepMC PDF info object to do anything 00044 if (event.genEvent()->pdf_info() == 0) vetoEvent; 00045 HepMC::PdfInfo pdfi = *(event.genEvent()->pdf_info()); 00046 00047 MSG_DEBUG("PDF Q = " << pdfi.scalePDF() << " for (id, x) = " 00048 << "(" << pdfi.id1() << ", " << pdfi.x1() << ") " 00049 << "(" << pdfi.id2() << ", " << pdfi.x2() << ")"); 00050 _histPdfX->fill(pdfi.x1(), weight); 00051 _histPdfX->fill(pdfi.x2(), weight); 00052 _histPdfXmin->fill(std::min(pdfi.x1(), pdfi.x2()), weight); 00053 _histPdfXmax->fill(std::max(pdfi.x1(), pdfi.x2()), weight); 00054 _histPdfQ->fill(pdfi.scalePDF(), weight); // always in GeV? 00055 _histPdfXQ->fill(pdfi.x1(), pdfi.scalePDF(), weight); // always in GeV? 00056 _histPdfXQ->fill(pdfi.x2(), 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.pT() > 10*GeV) { 00061 // _histPdfTrackptVsX->fill(pdfi.x1(), p.pT()/GeV, weight); 00062 // _histPdfTrackptVsX->fill(pdfi.x2(), p.pT()/GeV, weight); 00063 // _histPdfTrackptVsQ->fill(pdfi.scalePDF(), p.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 Histo2DPtr _histPdfXQ; 00088 // Profile1DPtr _histPdfTrackptVsX, _histPdfTrackptVsQ; 00089 //@} 00090 00091 }; 00092 00093 00094 // The hook for the plugin system 00095 DECLARE_RIVET_PLUGIN(MC_PDFS); 00096 00097 } Generated on Mon Jun 2 2014 15:23:02 for The Rivet MC analysis system by ![]() |