rivet is hosted by Hepforge, IPPP Durham

Rivet analyses reference

MC_PDFS

Analysis to study PDF sampling in any MC run
Experiment: ()
Status: VALIDATED
Authors:
  • Andy Buckley
No references listed
Beams: * *
Beam energies: ANY
Run details:
  • Any!

Plotting of PDF sampling info, such as the $Q^2$ and both $x$ values of the sampling (aggregated and distinguished as max/min, and some correlations with event properties.

Source code: MC_PDFS.cc
  1// -*- C++ -*-
  2#include "Rivet/Analysis.hh"
  3// #include "Rivet/Projections/ChargedFinalState.hh"
  4
  5namespace Rivet {
  6
  7  /// Generic analysis looking at various distributions of final state particles
  8  class MC_PDFS : public Analysis {
  9  public:
 10
 11    /// Constructor
 12    MC_PDFS()
 13      : Analysis("MC_PDFS")
 14    {    }
 15
 16
 17  public:
 18
 19    /// @name Analysis methods
 20    //@{
 21
 22    /// Book histograms and initialise projections before the run
 23    void init() {
 24      // Projections
 25      // declare(ChargedFinalState((Cuts::etaIn(-5.0, 5.0) && Cuts::pT >=  500*MeV)), "CFS");
 26
 27      // Histograms
 28      book(_histPdfX ,"PdfX", logspace(50, 0.000001, 1.0));
 29      book(_histPdfXmin ,"PdfXmin", logspace(50, 0.000001, 1.0));
 30      book(_histPdfXmax ,"PdfXmax", logspace(50, 0.000001, 1.0));
 31      book(_histPdfQ ,"PdfQ", 50, 0.0, 30.0);
 32      book(_histPdfXQ,"PdfXQ", logspace(50, 0.000001, 1.0), linspace(50, 0.0, 30.0));
 33      //book( _histPdfTrackptVsX ,"PdfTrackptVsX", logspace(50, 0.000001, 1.0));
 34      //book( _histPdfTrackptVsQ ,"PdfTrackptVsQ", 50, 0.0, 30.0);
 35    }
 36
 37
 38    /// Perform the per-event analysis
 39    void analyze(const Event& event) {
 40      const double weight = 1.0;
 41
 42      // This analysis needs a valid HepMC PDF info object to do anything
 43      if (event.genEvent()->pdf_info() == 0) vetoEvent;
 44      PdfInfo pdfi = *(event.genEvent()->pdf_info());
 45
 46#ifdef RIVET_ENABLE_HEPMC_3
 47      MSG_DEBUG("PDF Q = " << pdfi.scale<< " for (id, x) = "
 48                << "(" << pdfi.pdf_id[0] << ", " << pdfi.x[0] << ") "
 49                << "(" << pdfi.pdf_id[1] << ", " << pdfi.x[1] << ")");
 50      _histPdfX->fill(pdfi.x[0], weight);
 51      _histPdfX->fill(pdfi.x[1], weight);
 52      _histPdfXmin->fill(std::min(pdfi.x[0], pdfi.x[1]), weight);
 53      _histPdfXmax->fill(std::max(pdfi.x[0], pdfi.x[1]), weight);
 54      _histPdfQ->fill(pdfi.scale, weight); // always in GeV?
 55      _histPdfXQ->fill(pdfi.x[0], pdfi.scale, weight); // always in GeV?
 56      _histPdfXQ->fill(pdfi.x[1], pdfi.scale, weight); // always in GeV?
 57      
 58#else
 59      MSG_DEBUG("PDF Q = " << pdfi.scalePDF() << " for (id, x) = "
 60                << "(" << pdfi.id1() << ", " << pdfi.x1() << ") "
 61                << "(" << pdfi.id2() << ", " << pdfi.x2() << ")");
 62      _histPdfX->fill(pdfi.x1(), weight);
 63      _histPdfX->fill(pdfi.x2(), weight);
 64      _histPdfXmin->fill(std::min(pdfi.x1(), pdfi.x2()), weight);
 65      _histPdfXmax->fill(std::max(pdfi.x1(), pdfi.x2()), weight);
 66      _histPdfQ->fill(pdfi.scalePDF(), weight); // always in GeV?
 67      _histPdfXQ->fill(pdfi.x1(), pdfi.scalePDF(), weight); // always in GeV?
 68      _histPdfXQ->fill(pdfi.x2(), pdfi.scalePDF(), weight); // always in GeV?
 69#endif
 70      // const FinalState& cfs = apply<FinalState>(event, "CFS");
 71      // for (const Particle& p : cfs.particles()) {
 72      //   if (fabs(eta) < 2.5 && p.pT() > 10*GeV) {
 73      //     _histPdfTrackptVsX->fill(pdfi.x1(), p.pT()/GeV, weight);
 74      //     _histPdfTrackptVsX->fill(pdfi.x2(), p.pT()/GeV, weight);
 75      //     _histPdfTrackptVsQ->fill(pdfi.scalePDF(), p.pT()/GeV, weight);
 76      //   }
 77      // }
 78
 79    }
 80
 81
 82
 83    /// Finalize
 84    void finalize() {
 85      scale(_histPdfX, 1/sumOfWeights());
 86      scale(_histPdfXmin, 1/sumOfWeights());
 87      scale(_histPdfXmax, 1/sumOfWeights());
 88      scale(_histPdfQ, 1/sumOfWeights());
 89    }
 90
 91    //@}
 92
 93
 94  private:
 95
 96    /// @name Histograms
 97    //@{
 98    Histo1DPtr _histPdfX, _histPdfXmin, _histPdfXmax, _histPdfQ;
 99    Histo2DPtr _histPdfXQ;
100    // Profile1DPtr   _histPdfTrackptVsX, _histPdfTrackptVsQ;
101    //@}
102
103  };
104
105
106  // The hook for the plugin system
107  RIVET_DECLARE_PLUGIN(MC_PDFS);
108
109}