Rivet analyses

π± and K± spectra for $\sqrt{s}=2\to3.671\,$GeV

Experiment: BESIII (BEPC)

Inspire ID: 2893764

Status: VALIDATED NOHEPDATA

Authors: - Peter Richardson

References: - Phys.Rev.Lett. 135 (2025) 151901 - arXiv: 2502.16084

Beams: e+ e-

Beam energies: (1.0, 1.0); (1.1, 1.1); (1.2, 1.2); (1.3, 1.3); (1.4, 1.4); (1.5, 1.5); (1.8, 1.8); (1.8, 1.8)GeV

Run details: - e+e- to hadrons

Charged pion and kaon momentum spectra for a range centre-of-mass energies between 2 and 3.671 GeV.

Source code:BESIII_2026_I2893764.cc

// -*- C++ -*-
#include "Rivet/Analysis.hh"
#include "Rivet/Projections/FinalState.hh"

namespace Rivet {


  /// @brief pi+- and K+- spectra
  class BESIII_2026_I2893764 : public Analysis {
  public:

    /// Constructor
    RIVET_DEFAULT_ANALYSIS_CTOR(BESIII_2026_I2893764);


    /// @name Analysis methods
    /// @{

    /// Book histograms and initialise projections before the run
    void init() {
      // projection
      declare(FinalState(Cuts::abspid == PID::PIPLUS || Cuts::abspid == PID::KPLUS), "FS");
      // find beam energy
      size_t ih = 1;
      for (double eVal : allowedEnergies()) {

        const string en = toString(round(eVal / MeV));
        if (isCompatibleWithSqrtS(eVal)) _sqs = en;

        book(_h[en + "_1"], 1, 1, ih);
        book(_h[en + "_2"], 2, 1, ih);
        book(_h[en + "_3"], 3, 1, ih);
        book(_h[en + "_4"], 4, 1, ih);
        book(_c[en], "_aux_sigma_" + en);
        ++ih;
      }
      raiseBeamErrorIf(_sqs.empty());
    }


    /// Perform the per-event analysis
    void analyze(const Event& event) {
      _c[_sqs]->fill();
      for (const Particle& p : apply<FinalState>(event, "FS").particles()) {
        const double pp = p.p3().mod();
        if (p.pid() == PID::PIPLUS)
          _h[_sqs + "_1"]->fill(pp);
        else if (p.pid() == PID::PIMINUS)
          _h[_sqs + "_2"]->fill(pp);
        else if (p.pid() == PID::KPLUS)
          _h[_sqs + "_3"]->fill(pp);
        else if (p.pid() == PID::KMINUS)
          _h[_sqs + "_4"]->fill(pp);
      }
    }


    /// Normalise histograms etc., after the run
    void finalize() {
      scale(_h, crossSectionPerEvent());
      scale(_c, crossSectionPerEvent());
      for (const auto& item : _c) {
        scale(_h[item.first + "_1"s], 1.0 / item.second->sumW());
        scale(_h[item.first + "_2"s], 1.0 / item.second->sumW());
        scale(_h[item.first + "_3"s], 1.0 / item.second->sumW());
        scale(_h[item.first + "_4"s], 1.0 / item.second->sumW());
      }
    }

    /// @}


    /// @name Histograms
    /// @{
    map<string, Histo1DPtr> _h;
    map<string, CounterPtr> _c;
    string _sqs = "";
    /// @}
  };


  RIVET_DECLARE_PLUGIN(BESIII_2026_I2893764);

}