rivet is hosted by Hepforge, IPPP Durham

Rivet analyses reference

BABAR_2008_I776519

Cross section for $e^+e^-\to D^+D^-$ and $D^0\bar{D}^0$ below 5 GeV
Experiment: BABAR (PEP-II)
Inspire ID: 776519
Status: VALIDATED
Authors:
  • Peter Richardson
References: Beams: e+ e-
Beam energies: ANY
Run details:
  • e+e- to hadrons

Cross section for $e^+e^-\to D^+D^-$ and $D^0\bar{D}^0$ below 5 GeV

Source code: BABAR_2008_I776519.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_2008_I776519 : public Analysis {
 11  public:
 12
 13    /// Constructor
 14    RIVET_DEFAULT_ANALYSIS_CTOR(BABAR_2008_I776519);
 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      book(_nD0, "/TMP/nD0");
 27      book(_nDp, "/TMP/nDp");
 28
 29    }
 30
 31    void findChildren(const Particle & p,map<long,int> & nRes, int &ncount) {
 32      for (const Particle &child : p.children()) {
 33	if(child.children().empty()) {
 34	  nRes[child.pid()]-=1;
 35	  --ncount;
 36	}
 37	else
 38	  findChildren(child,nRes,ncount);
 39      }
 40    }
 41
 42    /// Perform the per-event analysis
 43    void analyze(const Event& event) {
 44
 45      const FinalState& fs = apply<FinalState>(event, "FS");
 46
 47      map<long,int> nCount;
 48      int ntotal(0);
 49      for (const Particle& p : fs.particles()) {
 50	nCount[p.pid()] += 1;
 51	++ntotal;
 52      }
 53      const FinalState& ufs = apply<FinalState>(event, "UFS");
 54
 55      for(unsigned int ix=0;ix<ufs.particles().size();++ix) {
 56	const Particle& p1 = ufs.particles()[ix];
 57	if(abs(p1.pid())!=411 && abs(p1.pid())!=421)
 58	  continue;
 59	map<long,int> nRes = nCount;
 60	int ncount = ntotal;
 61	findChildren(p1,nRes,ncount);
 62	bool matched=false;
 63	for(unsigned int iy=0;iy<ufs.particles().size();++iy) {
 64	  if(ix==iy) continue;
 65	  const Particle& p2 = ufs.particles()[iy];
 66	  if(p2.pid()!=-p1.pid()) continue;
 67	  map<long,int> nRes2 = nRes;
 68	  int ncount2 = ncount;
 69	  findChildren(p2,nRes2,ncount2);
 70	  if(ncount2!=0) continue;
 71	  matched=true;
 72	  for(auto const & val : nRes2) {
 73	    if(val.second!=0) {
 74	      matched = false;
 75	      break;
 76	    }
 77	  }
 78	  if(matched) break;
 79	}
 80	if(matched) {
 81	  if(abs(p1.pid())==411)
 82	    _nDp->fill();
 83	  else if(abs(p1.pid())==421)
 84	    _nD0->fill();
 85	}
 86      }
 87    }
 88
 89
 90    /// Normalise histograms etc., after the run
 91    void finalize() {
 92
 93      for(unsigned int ix=1;ix<3;++ix) {
 94        double sigma,error;
 95        if(ix==1) {
 96          sigma = _nD0->val();
 97          error = _nD0->err();
 98        }
 99        else {
100          sigma = _nDp->val();
101          error = _nDp->err();
102        }
103        sigma *= crossSection()/ sumOfWeights() /nanobarn;
104        error *= crossSection()/ sumOfWeights() /nanobarn;
105        Estimate1DPtr  mult;
106        book(mult, 1, 1, ix);
107        for (auto& b : mult->bins()) {
108          if (inRange(sqrtS()/GeV, b.xMin(), b.xMax())) {
109            b.set(sigma, error);
110          }
111        }
112      }
113    }
114
115    /// @}
116
117
118    /// @name Histograms
119    /// @{
120    CounterPtr _nD0,_nDp;
121    /// @}
122
123
124  };
125
126
127  RIVET_DECLARE_PLUGIN(BABAR_2008_I776519);
128
129
130}