rivet is hosted by Hepforge, IPPP Durham
STAR_2006_S6500200.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/ChargedFinalState.hh"
00004 #include "Rivet/Projections/IdentifiedFinalState.hh"
00005 
00006 namespace Rivet {
00007 
00008 
00009   /// @brief STAR identified hadron spectra in pp at 200 GeV
00010   class STAR_2006_S6500200 : public Analysis {
00011   public:
00012 
00013     /// Constructor
00014     STAR_2006_S6500200()
00015       : Analysis("STAR_2006_S6500200"),
00016         _sumWeightSelected(0.0)
00017     {  }
00018 
00019 
00020     /// Book projections and histograms
00021     void init() {
00022       ChargedFinalState bbc1(-5.0,-3.3, 0.0*GeV); // beam-beam-counter trigger
00023       ChargedFinalState bbc2( 3.3, 5.0, 0.0*GeV); // beam-beam-counter trigger
00024       addProjection(bbc1, "BBC1");
00025       addProjection(bbc2, "BBC2");
00026 
00027       IdentifiedFinalState pionfs(-2.5, 2.5, 0.3*GeV);
00028       IdentifiedFinalState protonfs(-2.5, 2.5, 0.4*GeV);
00029       pionfs.acceptIdPair(PID::PIPLUS);
00030       protonfs.acceptIdPair(PID::PROTON);
00031       addProjection(pionfs, "PionFS");
00032       addProjection(protonfs, "ProtonFS");
00033 
00034       _h_pT_piplus     = bookHisto1D(1, 1, 1); // full range pion binning
00035       _h_pT_piminus    = bookHisto1D(1, 2, 1); // full range pion binning
00036       _tmp_pT_piplus   = bookHisto1D("TMP/pT_piplus", refData(2, 3, 1)); // pi histo compatible with more restricted proton binning
00037       _tmp_pT_piminus  = bookHisto1D("TMP/pT_piminus", refData(2, 4, 1)); // pi histo compatible with more restricted proton binning
00038       _h_pT_proton     = bookHisto1D(1, 3, 1);
00039       _h_pT_antiproton = bookHisto1D(1, 4, 1);
00040 
00041       _s_piminus_piplus = bookScatter2D(2, 1, 1);
00042       _s_antipr_pr      = bookScatter2D(2, 2, 1);
00043       _s_pr_piplus      = bookScatter2D(2, 3, 1);
00044       _s_antipr_piminus = bookScatter2D(2, 4, 1);
00045     }
00046 
00047 
00048     /// Do the analysis
00049     void analyze(const Event& event) {
00050       const ChargedFinalState& bbc1 = applyProjection<ChargedFinalState>(event, "BBC1");
00051       const ChargedFinalState& bbc2 = applyProjection<ChargedFinalState>(event, "BBC2");
00052       if (bbc1.size() < 1 || bbc2.size() < 1) {
00053         MSG_DEBUG("Failed beam-beam-counter trigger");
00054         vetoEvent;
00055       }
00056 
00057       const double weight = event.weight();
00058 
00059       const IdentifiedFinalState& pionfs = applyProjection<IdentifiedFinalState>(event, "PionFS");
00060       foreach (const Particle& p, pionfs.particles()) {
00061         if (fabs(p.rapidity()) < 0.5) {
00062           /// @todo Use a binned counter to avoid this bin width cancellation hack
00063           const double pT = p.pT() / GeV;
00064           ((p.pdgId() > 0) ? _h_pT_piplus : _h_pT_piminus)->fill(pT, weight/pT);
00065           ((p.pdgId() > 0) ? _tmp_pT_piplus : _tmp_pT_piminus)->fill(pT, weight/pT);
00066         }
00067       }
00068 
00069       const IdentifiedFinalState& protonfs = applyProjection<IdentifiedFinalState>(event, "ProtonFS");
00070       foreach (const Particle& p, protonfs.particles()) {
00071         if (fabs(p.rapidity()) < 0.5) {
00072           /// @todo Use a binned counter to avoid this bin width cancellation hack
00073           const double pT = p.pT() / GeV;
00074           ((p.pdgId() > 0) ? _h_pT_proton : _h_pT_antiproton)->fill(pT, weight/pT);
00075         }
00076       }
00077       _sumWeightSelected += event.weight();
00078     }
00079 
00080 
00081     /// Finalize
00082     void finalize() {
00083       divide(_h_pT_piminus, _h_pT_piplus, _s_piminus_piplus);
00084       divide(_h_pT_antiproton, _h_pT_proton, _s_antipr_pr);
00085       divide(_h_pT_proton, _tmp_pT_piplus, _s_pr_piplus);
00086       divide(_h_pT_antiproton, _tmp_pT_piminus, _s_antipr_piminus);
00087       scale(_h_pT_piplus,     1/(2*M_PI*_sumWeightSelected));
00088       scale(_h_pT_piminus,    1/(2*M_PI*_sumWeightSelected));
00089       scale(_h_pT_proton,     1/(2*M_PI*_sumWeightSelected));
00090       scale(_h_pT_antiproton, 1/(2*M_PI*_sumWeightSelected));
00091     }
00092 
00093 
00094   private:
00095 
00096     double _sumWeightSelected;
00097     Histo1DPtr _h_pT_piplus, _h_pT_piminus, _h_pT_proton, _h_pT_antiproton;
00098     Histo1DPtr _tmp_pT_piplus, _tmp_pT_piminus;
00099     Scatter2DPtr _s_piminus_piplus, _s_antipr_pr, _s_pr_piplus, _s_antipr_piminus;
00100 
00101   };
00102 
00103 
00104 
00105   // The hook for the plugin system
00106   DECLARE_RIVET_PLUGIN(STAR_2006_S6500200);
00107 
00108 }