Rivet analyses referenceBESII_2008_I802372Cross section for $D\bar{D}$ production near the $\psi(3770)$ resonanceExperiment: BESII (BEPC) Inspire ID: 802372 Status: VALIDATED NOHEPDATA SINGLEWEIGHT Authors:
Beam energies: (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9); (1.9, 1.9) GeV Run details:
Measurement of the cross section for $D\bar{D}$ production near the $\psi(3770)$ resonance by BESII. Beam energy must be specified as analysis option "ENERGY" when rivet-merging samples. Source code: BESII_2008_I802372.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 e+ e- > D Dbar
10 class BESII_2008_I802372 : public Analysis {
11 public:
12
13 /// Constructor
14 RIVET_DEFAULT_ANALYSIS_CTOR(BESII_2008_I802372);
15
16
17 /// @name Analysis methods
18 /// @{
19
20 /// Book histograms and initialise projections before the run
21 void init() {
22 // Initialise and register projections
23 declare(FinalState(), "FS");
24 declare(UnstableParticles(Cuts::abspid==411 || Cuts::abspid==421), "UFS");
25 // histos
26 for (unsigned int ix=0; ix<3; ++ix) {
27 book(_sigma[ix], 1, 1, 1+ix);
28 }
29
30 for (const string& en : _sigma[0].binning().edges<0>()) {
31 const double end = std::stod(en)*GeV;
32 if (isCompatibleWithSqrtS(end)) {
33 _ecms = en;
34 break;
35 }
36 }
37 if (_ecms.empty()) {
38 MSG_ERROR("Beam energy incompatible with analysis.");
39 }
40 }
41
42 void findChildren(const Particle & p,map<long,int> & nRes, int &ncount) {
43 for (const Particle &child : p.children()) {
44 if (child.children().empty()) {
45 nRes[child.pid()]-=1;
46 --ncount;
47 }
48 else {
49 findChildren(child,nRes,ncount);
50 }
51 }
52 }
53
54 /// Perform the per-event analysis
55 void analyze(const Event& event) {
56 const FinalState& fs = apply<FinalState>(event, "FS");
57
58 map<long,int> nCount;
59 int ntotal(0);
60 for (const Particle& p : fs.particles()) {
61 nCount[p.pid()] += 1;
62 ++ntotal;
63 }
64 const FinalState& ufs = apply<FinalState>(event, "UFS");
65 for (const Particle & p1 : ufs.particles()) {
66 if(p1.pid()<0) continue;
67 map<long,int> nRes = nCount;
68 int ncount = ntotal;
69 findChildren(p1,nRes,ncount);
70 bool matched=false;
71 for (const Particle & p2 : ufs.particles()) {
72 if (p2.pid()!=-p1.pid()) continue;
73 map<long,int> nRes2 = nRes;
74 int ncount2 = ncount;
75 findChildren(p2,nRes2,ncount2);
76 if (ncount2!=0) continue;
77 matched=true;
78 for (const auto& val : nRes2) {
79 if (val.second!=0) {
80 matched = false;
81 break;
82 }
83 }
84 if (matched) break;
85 }
86 if (matched) {
87 _sigma[2]->fill(_ecms);
88 if (p1.abspid()==421) _sigma[0]->fill(_ecms);
89 else if (p1.abspid()==411) _sigma[1]->fill(_ecms);
90 break;
91 }
92 }
93 }
94
95
96 /// Normalise histograms etc., after the run
97 void finalize() {
98 scale(_sigma, crossSection()/ sumOfWeights() /nanobarn);
99 }
100
101 /// @}
102
103
104 /// @name Histograms
105 /// @{
106 BinnedHistoPtr<string> _sigma[3];
107 string _ecms;
108 /// @}
109
110
111 };
112
113
114 RIVET_DECLARE_PLUGIN(BESII_2008_I802372);
115
116}
|