Rivet analyses referenceCMS_2021_I1876550Prompt $D^0$, $D^{*\pm}$ and $D^\pm$ meson production at 7 TeVExperiment: CMS (LHC) Inspire ID: 1876550 Status: VALIDATED NOHEPDATA Authors:
Beam energies: (6500.0, 6500.0) GeV Run details:
Measurement of the transverse momentum spectra and rapidity distributions for prompt $D^0$, $D^{*\pm}$ and $D^\pm$ meson production at 13 TeV by the CMS collaboration. Source code: CMS_2021_I1876550.cc 1// -*- C++ -*-
2#include "Rivet/Analysis.hh"
3#include "Rivet/Projections/UnstableParticles.hh"
4
5namespace Rivet {
6
7
8 /// @brief D meson production at 13 TeV
9 class CMS_2021_I1876550 : public Analysis {
10 public:
11
12 /// Constructor
13 RIVET_DEFAULT_ANALYSIS_CTOR(CMS_2021_I1876550);
14
15
16 /// @name Analysis methods
17 /// @{
18
19 /// Book histograms and initialise projections before the run
20 void init() {
21 // projections
22 declare(UnstableParticles(), "UFS");
23 // histograms
24 for (unsigned int ix=0; ix<3; ++ix) {
25 book(_h_pT [ix], 1, 1, 1+ix);
26 book(_h_eta[ix], 2, 1, 1+ix);
27 }
28 }
29
30
31 /// Perform the per-event analysis
32 void analyze(const Event& event) {
33 // Final state of unstable particles to get particle spectra
34 const UnstableParticles& ufs = apply<UnstableParticles>(event, "UFS");
35 for (const Particle& p : ufs.particles(Cuts::abspid==411 or Cuts::abspid==421 or Cuts::abspid==413)) {
36 // no mixing and |y|<2.1
37 if (p.children().size()==1) continue;
38 const double eta = p.abseta();
39 const double pT=p.perp();
40 if (eta>2.1 || pT<4. || pT>100.) continue;
41 if (p.fromBottom()) continue;
42 unsigned int imeson=0;
43 if (p.abspid()==421) imeson=1;
44 else if (p.abspid()==411) imeson=2;
45 _h_pT[imeson]->fill(pT);
46 _h_eta[imeson]->fill(eta);
47 }
48 }
49
50
51 /// Normalise histograms etc., after the run
52 void finalize() {
53 const double factor = crossSection()/microbarn/sumOfWeights();
54 for (unsigned int ix=0; ix<3; ++ix) {
55 scale(_h_pT[ix], factor);
56 scale(_h_eta[ix], 0.5*factor);
57 }
58 }
59
60 /// @}
61
62
63 /// @name Histograms
64 /// @{
65 Histo1DPtr _h_pT[3], _h_eta[3];
66 /// @}
67
68
69 };
70
71
72 RIVET_DECLARE_PLUGIN(CMS_2021_I1876550);
73
74}
|