rivet is hosted by Hepforge, IPPP Durham

Rivet analyses reference

MC_IDENTIFIED

MC testing analysis for identified particle distributions
Experiment: ()
Status: VALIDATED
Authors:
  • Andy Buckley
No references listed
Beams: * *
Beam energies: ANY
Run details:
  • Any!

Plotting of distributions of PID codes (all/stable/unstable) and ID-specific distributions such as the $|\eta|$ of $K$, $\pi$ and $\Lambda$ mesons.

Source code: MC_IDENTIFIED.cc
  1// -*- C++ -*-
  2#include "Rivet/Analysis.hh"
  3#include "Rivet/Projections/FinalState.hh"
  4#include "Rivet/Projections/UnstableParticles.hh"
  5
  6namespace Rivet {
  7
  8
  9  /// Generic analysis looking at various distributions of final state particles
 10  /// @todo Rename as MC_HADRONS
 11  class MC_IDENTIFIED : public Analysis {
 12  public:
 13
 14    /// Constructor
 15    MC_IDENTIFIED()
 16      : Analysis("MC_IDENTIFIED")
 17    {    }
 18
 19
 20  public:
 21
 22    /// @name Analysis methods
 23    //@{
 24
 25    /// Book histograms and initialise projections before the run
 26    void init() {
 27
 28      // Projections
 29      const FinalState cnfs(Cuts::abseta < 5.0 && Cuts::pT > 500*MeV);
 30      declare(cnfs, "FS");
 31      declare(UnstableParticles(Cuts::abseta < 5.0 && Cuts::pT > 500*MeV), "UFS");
 32
 33      // Histograms
 34      // @todo Choose E/pT ranged based on input energies... can't do anything about kin. cuts, though
 35
 36      book(_histStablePIDs  ,"MultsStablePIDs", 3335, -0.5, 3334.5);
 37      book(_histDecayedPIDs ,"MultsDecayedPIDs", 3335, -0.5, 3334.5);
 38      book(_histAllPIDs     ,"MultsAllPIDs", 3335, -0.5, 3334.5);
 39
 40      book(_histEtaPi       ,"EtaPi", 25, 0, 5);
 41      book(_histEtaK        ,"EtaK", 25, 0, 5);
 42      book(_histEtaLambda   ,"EtaLambda", 25, 0, 5);
 43    }
 44
 45
 46
 47    /// Perform the per-event analysis
 48    void analyze(const Event& event) {
 49      const double weight = 1.0;
 50
 51      // Unphysical (debug) plotting of all PIDs in the event, physical or otherwise
 52      for(ConstGenParticlePtr gp: HepMCUtils::particles(event.genEvent())) {
 53        _histAllPIDs->fill(abs(gp->pdg_id()), weight);
 54      }
 55
 56      // Charged + neutral final state PIDs
 57      const FinalState& cnfs = apply<FinalState>(event, "FS");
 58      for (const Particle& p : cnfs.particles()) {
 59        _histStablePIDs->fill(p.abspid(), weight);
 60      }
 61
 62      // Unstable PIDs and identified particle eta spectra
 63      const UnstableParticles& ufs = apply<UnstableParticles>(event, "UFS");
 64      for (const Particle& p : ufs.particles()) {
 65        _histDecayedPIDs->fill(p.pid(), weight);
 66        const double eta_abs = p.abseta();
 67        const PdgId pid = p.abspid(); //if (PID::isMeson(pid) && PID::hasStrange()) {
 68        if (pid == 211 || pid == 111) _histEtaPi->fill(eta_abs, weight);
 69        else if (pid == 321 || pid == 130 || pid == 310) _histEtaK->fill(eta_abs, weight);
 70        else if (pid == 3122) _histEtaLambda->fill(eta_abs, weight);
 71      }
 72
 73    }
 74
 75
 76
 77    /// Finalize
 78    void finalize() {
 79      scale(_histStablePIDs, 1/sumOfWeights());
 80      scale(_histDecayedPIDs, 1/sumOfWeights());
 81      scale(_histAllPIDs, 1/sumOfWeights());
 82      scale(_histEtaPi, 1/sumOfWeights());
 83      scale(_histEtaK, 1/sumOfWeights());
 84      scale(_histEtaLambda, 1/sumOfWeights());
 85    }
 86
 87    //@}
 88
 89
 90  private:
 91
 92    /// @name Histograms
 93    //@{
 94    Histo1DPtr _histStablePIDs, _histDecayedPIDs, _histAllPIDs;
 95    Histo1DPtr _histEtaPi, _histEtaK, _histEtaLambda;
 96    //@}
 97
 98  };
 99
100
101  // The hook for the plugin system
102  RIVET_DECLARE_PLUGIN(MC_IDENTIFIED);
103
104}