Rivet analyses referenceBABAR_2009_I829441Cross section for $e^+e^-\to \pi^+\pi^-$ below 3 GeVExperiment: BABAR (PEP-II) Inspire ID: 829441 Status: VALIDATED Authors:
Beam energies: ANY Run details:
1// -*- C++ -*-
2#include "Rivet/Analysis.hh"
3#include "Rivet/Projections/FinalState.hh"
4
5namespace Rivet {
6
7
8 /// @brief Add a short analysis description here
9 class BABAR_2009_I829441 : public Analysis {
10 public:
11
12 /// Constructor
13 RIVET_DEFAULT_ANALYSIS_CTOR(BABAR_2009_I829441);
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(_npion, "TMP/pion");
26 }
27
28
29 /// Perform the per-event analysis
30 void analyze(const Event& event) {
31 const FinalState& fs = apply<FinalState>(event, "FS");
32 if(fs.particles().size()!=2) vetoEvent;
33 for (const Particle& p : fs.particles()) {
34 if(abs(p.pid())!=PID::PIPLUS) vetoEvent;
35 }
36 _npion->fill();
37 }
38
39
40 /// Normalise histograms etc., after the run
41 void finalize() {
42 double sigma = _npion->val();
43 double error = _npion->err();
44 sigma *= crossSection()/ sumOfWeights() /nanobarn;
45 error *= crossSection()/ sumOfWeights() /nanobarn;
46 Scatter2D temphisto(refData(1, 1, 1));
47 Scatter2DPtr mult;
48 book(mult, 1, 1, 1);
49 for (size_t b = 0; b < temphisto.numPoints(); b++) {
50 const double x = temphisto.point(b).x();
51 pair<double,double> ex = temphisto.point(b).xErrs();
52 pair<double,double> ex2 = ex;
53 if(ex2.first ==0.) ex2. first=0.0001;
54 if(ex2.second==0.) ex2.second=0.0001;
55 if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) {
56 mult->addPoint(x, sigma, ex, make_pair(error,error));
57 }
58 else {
59 mult->addPoint(x, 0., ex, make_pair(0.,.0));
60 }
61 }
62
63 }
64
65 //@}
66
67
68 /// @name Histograms
69 //@{
70 CounterPtr _npion;
71 //@}
72
73
74 };
75
76
77 // The hook for the plugin system
78 RIVET_DECLARE_PLUGIN(BABAR_2009_I829441);
79
80
81}
|