Rivet analyses referenceDELPHI_1995_I394052$K^\pm$ and $p,\bar{p}$ spectra in hadronic $Z^0$ decaysExperiment: DELPHI (LEP) Inspire ID: 394052 Status: VALIDATED Authors:
Beam energies: (45.6, 45.6) GeV Run details:
DELPHI results for the spectra for $K^\pm$ and $p,\bar{p}$ production in hadronic $Z^0$ decays. Source code: DELPHI_1995_I394052.cc 1// -*- C++ -*-
2#include "Rivet/Analysis.hh"
3#include "Rivet/Projections/FinalState.hh"
4#include "Rivet/Projections/ChargedFinalState.hh"
5#include "Rivet/Projections/Beam.hh"
6
7namespace Rivet {
8
9
10 /// @brief K+/- and protno spectra
11 class DELPHI_1995_I394052 : public Analysis {
12 public:
13
14 /// Constructor
15 RIVET_DEFAULT_ANALYSIS_CTOR(DELPHI_1995_I394052);
16
17
18 /// @name Analysis methods
19 /// @{
20
21 /// Book histograms and initialise projections before the run
22 void init() {
23 declare(Beam(), "Beams");
24 declare(ChargedFinalState(), "FS");
25
26 // Book histograms
27 book(_h_kaon_p , 3, 1, 1);
28 book(_h_kaon_x , 5, 1, 1);
29 book(_h_proton_p , 4, 1, 1);
30 book(_h_proton_x , 6, 1, 1);
31
32 _axis[0] = YODA::Axis<double>({0.017543859649122806, 0.024122807017543862, 0.03070175438596491,
33 0.03728070175438596, 0.043859649122807015, 0.05482456140350877,
34 0.06578947368421052, 0.07675438596491228, 0.08771929824561403,
35 0.21929824561403508, 0.2631578947368421, 0.30701754385964913,
36 0.3508771929824561, 0.39473684210526316, 0.43859649122807015,
37 0.5043859649122807});
38 _axis[1] = YODA::Axis<double>({0.03070175438596491, 0.03728070175438596, 0.043859649122807015,
39 0.05482456140350877, 0.06578947368421052, 0.07675438596491228,
40 0.08771929824561403, 0.09868421052631579, 0.10964912280701754});
41 }
42
43
44 /// Perform the per-event analysis
45 void analyze(const Event& event) {
46
47 if (_edges[0].empty()) _edges[0] = _h_kaon_x->xEdges();
48 if (_edges[1].empty()) _edges[1] = _h_proton_x->xEdges();
49
50 // First, veto on leptonic events by requiring at least 4 charged FS particles
51 const FinalState& fs = apply<FinalState>(event, "FS");
52 const size_t numParticles = fs.particles().size();
53
54 // Even if we only generate hadronic events, we still need a cut on numCharged >= 2.
55 if (numParticles < 2) {
56 MSG_DEBUG("Failed leptonic event cut");
57 vetoEvent;
58 }
59 MSG_DEBUG("Passed leptonic event cut");
60
61 // Get beams and average beam momentum
62 const ParticlePair& beams = apply<Beam>(event, "Beams").beams();
63 const double meanBeamMom = ( beams.first.p3().mod() + beams.second.p3().mod() ) / 2.0;
64 MSG_DEBUG("Avg beam momentum = " << meanBeamMom);
65 for (const Particle& p : fs.particles(Cuts::abspid==321 or Cuts::abspid==2212)) {
66 double modp = p.p3().mod();
67 double xp = modp/meanBeamMom;
68 if(abs(p.pid())==321) {
69 _h_kaon_p->fill(modp);
70 _h_kaon_x->fill(map2string(xp, 0));
71 }
72 else {
73 _h_proton_p->fill(modp);
74 _h_proton_x->fill(map2string(xp, 1));
75 }
76 }
77 }
78
79
80 /// Normalise histograms etc., after the run
81 void finalize() {
82 scale(_h_kaon_p ,1./sumOfWeights());
83 scale(_h_kaon_x ,1./sumOfWeights());
84 for(auto & b: _h_kaon_x->bins()) {
85 size_t idx = b.index();
86 if(idx>=9) idx+=1;
87 b.scaleW(1./_axis[0].width(idx));
88 }
89 scale(_h_proton_p,1./sumOfWeights());
90 scale(_h_proton_x,1./sumOfWeights());
91 for(auto & b: _h_proton_x->bins()) {
92 const size_t idx = b.index();
93 b.scaleW(1./_axis[1].width(idx));
94 }
95 }
96
97 /// @}
98
99 string map2string(const double value, const size_t type) const {
100 const size_t idx = _axis[type].index(value);
101 if (idx && idx < 9) return _edges[type][idx-1];
102 if (idx > 9 && idx <= _edges[type].size()+1) return _edges[type][idx-2];
103 return "OTHER";
104 }
105
106
107 /// @name Histograms
108 /// @{
109 Histo1DPtr _h_kaon_p, _h_proton_p;
110 BinnedHistoPtr<string> _h_kaon_x, _h_proton_x;
111 vector<string> _edges[2];
112 YODA::Axis<double> _axis[2];
113 /// @}
114
115
116 };
117
118
119 RIVET_DECLARE_PLUGIN(DELPHI_1995_I394052);
120
121
122}
|