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