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 00056 // const FinalState& cfs = applyProjection<FinalState>(event, "CFS"); 00057 // foreach (const Particle& p, cfs.particles()) { 00058 // if (fabs(eta) < 2.5 && p.pT() > 10*GeV) { 00059 // _histPdfTrackptVsX->fill(pdfi.x1(), p.pT()/GeV, weight); 00060 // _histPdfTrackptVsX->fill(pdfi.x2(), p.pT()/GeV, weight); 00061 // _histPdfTrackptVsQ->fill(pdfi.scalePDF(), p.pT()/GeV, weight); 00062 // } 00063 // } 00064 00065 } 00066 00067 00068 00069 /// Finalize 00070 void finalize() { 00071 scale(_histPdfX, 1/sumOfWeights()); 00072 scale(_histPdfXmin, 1/sumOfWeights()); 00073 scale(_histPdfXmax, 1/sumOfWeights()); 00074 scale(_histPdfQ, 1/sumOfWeights()); 00075 } 00076 00077 //@} 00078 00079 00080 private: 00081 00082 /// @name Histograms 00083 //@{ 00084 Histo1DPtr _histPdfX, _histPdfXmin, _histPdfXmax, _histPdfQ; 00085 // Profile1DPtr _histPdfTrackptVsX, _histPdfTrackptVsQ; 00086 //@} 00087 00088 }; 00089 00090 00091 // The hook for the plugin system 00092 DECLARE_RIVET_PLUGIN(MC_PDFS); 00093 00094 } Generated on Thu Feb 6 2014 17:38:45 for The Rivet MC analysis system by ![]() |