Rivet analyses referencePDG_RPDG Compilation of $R$ measurementsExperiment: PDG (Various) Inspire ID: 1688995 Status: VALIDATED Authors:
Beam energies: ANY Run details:
PDG compilation of measurements of the $R$ ratio in $e^+e^-$ collisions Source code: PDG_R.cc 1// -*- C++ -*-
2#include "Rivet/Analysis.hh"
3#include "Rivet/Projections/FinalState.hh"
4
5namespace Rivet {
6
7
8 /// @brief Measurement of R
9 class PDG_R : public Analysis {
10 public:
11
12 /// Constructor
13 RIVET_DEFAULT_ANALYSIS_CTOR(PDG_R);
14
15
16 /// @name Analysis methods
17 /// @{
18
19 /// Book histograms and initialise projections before the run
20 void init() {
21 // Initialise and register projections
22 declare(FinalState(), "FS");
23
24 // Book histograms
25 book(_c_hadrons, "/TMP/sigma_hadrons",refData<YODA::BinnedEstimate<string>>(1,1,1));
26 book(_c_muons , "/TMP/sigma_muons" ,refData<YODA::BinnedEstimate<string>>(1,1,1));
27 for (const string& en : _c_hadrons.binning().edges<0>()) {
28 const size_t idx1 = en.find("_");
29 const string en2 = idx1!=std::string::npos ? en.substr(0,idx1) : en;
30 const size_t idx2 = en.find("-");
31 if(idx2!=std::string::npos) {
32 const double emin = std::stod(en.substr(0,idx2));
33 const double emax = std::stod(en.substr(idx2+1,string::npos));
34 if(inRange(sqrtS()/GeV, emin, emax)) {
35 _ecms.push_back(en);
36 break;
37 }
38 }
39 else {
40 const double end = std::stod(en)*GeV;
41 if (isCompatibleWithSqrtS(end)) {
42 _ecms.push_back(en);
43 break;
44 }
45 }
46 }
47 if(_ecms.empty()) MSG_ERROR("Beam energy incompatible with analysis.");
48 }
49
50
51 /// Perform the per-event analysis
52 void analyze(const Event& event) {
53 const FinalState& fs = apply<FinalState>(event, "FS");
54
55 map<long,int> nCount;
56 int ntotal(0);
57 for (const Particle& p : fs.particles()) {
58 nCount[p.pid()] += 1;
59 ++ntotal;
60 }
61 // mu+mu- + photons
62 if(nCount[-13]==1 and nCount[13]==1 &&
63 ntotal==2+nCount[22]) {
64 for(const string & en : _ecms)
65 _c_muons->fill(en);
66 }
67 // everything else
68 else {
69 for(const string & en : _ecms)
70 _c_hadrons->fill(en);
71 }
72 }
73
74
75 /// Normalise histograms etc., after the run
76 void finalize() {
77 BinnedEstimatePtr<string> mult;
78 book(mult, 1, 1, 1);
79 divide(_c_hadrons, _c_muons,mult);
80 }
81
82 /// @}
83
84
85 /// @name Histograms
86 /// @{
87 BinnedHistoPtr<string> _c_hadrons, _c_muons;
88 vector<string> _ecms;
89 /// @}
90
91
92 };
93
94
95 RIVET_DECLARE_PLUGIN(PDG_R);
96
97}
|