Rivet analyses referenceBABAR_2006_I731865Cross section for $\phi\eta$ at 10.58 GeVExperiment: BABAR (PEP-II) Inspire ID: 731865 Status: VALIDATED Authors:
Beam energies: ANY Run details:
Measurement of the cross section for $\phi\eta$ at 10.58 GeV Source code: BABAR_2006_I731865.cc 1// -*- C++ -*-
2#include "Rivet/Analysis.hh"
3#include "Rivet/Projections/FinalState.hh"
4#include "Rivet/Projections/UnstableParticles.hh"
5
6namespace Rivet {
7
8
9 /// @brief Add a short analysis description here
10 class BABAR_2006_I731865 : public Analysis {
11 public:
12
13 /// Constructor
14 RIVET_DEFAULT_ANALYSIS_CTOR(BABAR_2006_I731865);
15
16
17 /// @name Analysis methods
18 //@{
19
20 /// Book histograms and initialise projections before the run
21 void init() {
22
23 // Initialise and register projections
24 declare(FinalState(), "FS");
25 declare(UnstableParticles(), "UFS");
26
27 book(_nPhiEta, "TMP/phieta");
28 }
29
30 void findChildren(const Particle & p,map<long,int> & nRes, int &ncount) {
31 for(const Particle &child : p.children()) {
32 if(child.children().empty()) {
33 nRes[child.pid()]-=1;
34 --ncount;
35 }
36 else
37 findChildren(child,nRes,ncount);
38 }
39 }
40
41 /// Perform the per-event analysis
42 void analyze(const Event& event) {
43 const FinalState& fs = apply<FinalState>(event, "FS");
44
45 map<long,int> nCount;
46 int ntotal(0);
47 for (const Particle& p : fs.particles()) {
48 nCount[p.pid()] += 1;
49 ++ntotal;
50 }
51 const FinalState& ufs = apply<FinalState>(event, "UFS");
52 for (const Particle& p : ufs.particles()) {
53 if(p.children().empty()) continue;
54 if(p.pid()!=333) continue;
55 map<long,int> nRes=nCount;
56 int ncount = ntotal;
57 findChildren(p,nRes,ncount);
58 for (const Particle& p2 : ufs.particles()) {
59 if(p2.pid()!=221) continue;
60 if(p2.parents()[0].isSame(p)) continue;
61 map<long,int> nResB = nRes;
62 int ncountB = ncount;
63 findChildren(p2,nResB,ncountB);
64 if(ncountB!=0) continue;
65 bool matched2 = true;
66 for(auto const & val : nResB) {
67 if(val.second!=0) {
68 matched2 = false;
69 break;
70 }
71 }
72 if(matched2) {
73 _nPhiEta->fill();
74 }
75 }
76 }
77 }
78
79
80 /// Normalise histograms etc., after the run
81 void finalize() {
82 double sigma = _nPhiEta->val();
83 double error = _nPhiEta->err();
84 sigma *= crossSection()/ sumOfWeights() /femtobarn;
85 error *= crossSection()/ sumOfWeights() /femtobarn;
86
87 Scatter2D temphisto(refData(1, 1, 2));
88 Scatter2DPtr mult;
89 book(mult, 1, 1, 2);
90 for (size_t b = 0; b < temphisto.numPoints(); b++) {
91 const double x = temphisto.point(b).x();
92 pair<double,double> ex = temphisto.point(b).xErrs();
93 pair<double,double> ex2 = ex;
94 if(ex2.first ==0.) ex2. first=0.0001;
95 if(ex2.second==0.) ex2.second=0.0001;
96 if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) {
97 mult->addPoint(x, sigma, ex, make_pair(error,error));
98 }
99 else {
100 mult->addPoint(x, 0., ex, make_pair(0.,.0));
101 }
102 }
103 }
104
105 //@}
106
107 /// @name Histograms
108 //@{
109 CounterPtr _nPhiEta;
110 //@}
111
112 };
113
114
115 // The hook for the plugin system
116 RIVET_DECLARE_PLUGIN(BABAR_2006_I731865);
117
118}
|