Rivet analyses referenceNA49_2009_I818217Inclusive production of protons, anti-protons and neutrons in p+p collisions at 158 GeV/c beam momentumExperiment: NA49 (SPS) Inspire ID: 818217 Status: UNVALIDATED Authors:
Beam energies: (8.7, 8.7) GeV Run details:
Production of $p$, $\bar{p}$ and neutrons in fixed target, $p_{\mathrm{lab}} = $158 GeV/c. The elastic trigger is implemented by looking for elastic final states with only 2 particles, instead of attempting to reproduce the experimental trigger, which cannot be directly unfolded. Source code: NA49_2009_I818217.cc 1// -*- C++ -*-
2#include "Rivet/Analysis.hh"
3#include "Rivet/Projections/FinalState.hh"
4#include "Rivet/Particle.hh"
5
6namespace Rivet {
7
8
9 class NA49_2009_I818217 : public Analysis {
10 public:
11
12 /// @name Constructors etc.
13 //@{
14 /// Constructor
15 NA49_2009_I818217() : Analysis("NA49_2009_I818217"){}
16
17 void init() {
18 declare(FinalState(), "FS");
19 book(_h_dndxf, 1,1,1);
20 book(_p_mptxf, 2,1,1);
21 book(_h_dndy, 3,1,1);
22 book(_c_ninel, "nInelastic");
23 }
24
25 void analyze(const Event& event) {
26 const FinalState& fs = apply<FinalState>(event, "FS");
27 const size_t numParticles = fs.particles().size();
28 const float SRT = event.sqrtS();
29
30 // Inelastic events selection
31 if (numParticles <= 2) {
32 MSG_DEBUG("Elastic event");
33 vetoEvent;
34 }
35 _c_ninel -> fill();
36
37 // Plot distributions
38 for(const Particle& p : fs.particles()) {
39 if(p.pid() == PID::PROTON){
40 double xF = p.pz() / (SRT/2.);
41 _h_dndxf -> fill(xF);
42 _h_dndy -> fill(p.rapidity());
43 _p_mptxf -> fill(xF, p.pt());
44 }
45 }
46 }
47
48 void finalize() {
49 scale(_h_dndxf, 1./ *_c_ninel); // Scale by the number of inelastic events
50 vector<YODA::HistoBin1D>& bins = _h_dndxf -> bins(); // Get histogram bins
51 for (auto b : bins) b.scaleW(1./b.xWidth()); // Scale by the bin width (dxF)
52
53 scale(_h_dndy, 1./ *_c_ninel);
54 vector<YODA::HistoBin1D>& binsy = _h_dndy -> bins();
55 for (auto by : binsy) by.scaleW(1./by.xWidth());
56 }
57
58 private:
59 CounterPtr _c_ninel; // Counter of inelastic events
60 Histo1DPtr _h_dndxf; // dn/dxf histogram
61 Histo1DPtr _h_dndy; // dn/dy histogram
62 Profile1DPtr _p_mptxf; // mean pT vs xF profile
63 };
64
65 RIVET_DECLARE_PLUGIN(NA49_2009_I818217);
66}
|