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/Tools/Logging.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 #include "Rivet/Projections/IdentifiedFinalState.hh"
00006 #include "Rivet/RivetYODA.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief STAR identified hadron spectra in pp at 200 GeV
00012   class STAR_2006_S6500200 : public Analysis {
00013   public:
00014 
00015     /// Constructor
00016     STAR_2006_S6500200()
00017       : Analysis("STAR_2006_S6500200"),
00018         _sumWeightSelected(0.0)
00019     {  }
00020 
00021 
00022     /// Book projections and histograms
00023     void init() {
00024       ChargedFinalState bbc1(-5.0,-3.3, 0.0*GeV); // beam-beam-counter trigger
00025       ChargedFinalState bbc2( 3.3, 5.0, 0.0*GeV); // beam-beam-counter trigger
00026       addProjection(bbc1, "BBC1");
00027       addProjection(bbc2, "BBC2");
00028 
00029       IdentifiedFinalState pionfs(-2.5, 2.5, 0.3*GeV);
00030       IdentifiedFinalState protonfs(-2.5, 2.5, 0.4*GeV);
00031       pionfs.acceptIdPair(PIPLUS);
00032       protonfs.acceptIdPair(PROTON);
00033       addProjection(pionfs, "PIONFS");
00034       addProjection(protonfs, "PROTONFS");
00035 
00036       _h_pT_piplus     = bookHisto1D(1, 1, 1);
00037       _h_pT_piminus    = bookHisto1D(1, 2, 1);
00038       _h_pT_proton     = bookHisto1D(1, 3, 1);
00039       _h_pT_antiproton = bookHisto1D(1, 4, 1);
00040 
00041       _h_piminus_piplus = bookScatter2D(2, 1, 1);
00042       _h_antipr_pr      = bookScatter2D(2, 2, 1);
00043       _h_pr_piplus      = bookScatter2D(2, 3, 1);
00044       _h_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.momentum().rapidity()) < 0.5) {
00062           const double pT = p.momentum().pT() / GeV;
00063           if (p.pdgId()>0) {
00064             _h_pT_piplus->fill(pT, weight/pT);
00065           }
00066           else {
00067             _h_pT_piminus->fill(pT, weight/pT);
00068           }
00069         }
00070       }
00071 
00072       const IdentifiedFinalState& protonfs = applyProjection<IdentifiedFinalState>(event, "PROTONFS");
00073       foreach (const Particle& p, protonfs.particles()) {
00074         if (fabs(p.momentum().rapidity()) < 0.5) {
00075           const double pT = p.momentum().pT() / GeV;
00076           if (p.pdgId()>0) {
00077             _h_pT_proton->fill(pT, weight/pT);
00078           }
00079           else {
00080             _h_pT_antiproton->fill(pT, weight/pT);
00081           }
00082         }
00083       }
00084       _sumWeightSelected += event.weight();
00085     }
00086 
00087 
00088     /// Finalize
00089     void finalize() {
00090       divide(_h_pT_piminus, _h_pT_piplus, _h_piminus_piplus);
00091 
00092       divide(_h_pT_antiproton, _h_pT_proton, _h_antipr_pr);
00093 
00094       divide(_h_pT_proton, _h_pT_piplus, _h_pr_piplus);
00095 
00096       divide(_h_pT_antiproton, _h_pT_piminus, _h_antipr_piminus);
00097 
00098       scale(_h_pT_piplus,     1./(2*M_PI*_sumWeightSelected));
00099       scale(_h_pT_piminus,    1./(2*M_PI*_sumWeightSelected));
00100       scale(_h_pT_proton,     1./(2*M_PI*_sumWeightSelected));
00101       scale(_h_pT_antiproton, 1./(2*M_PI*_sumWeightSelected));
00102       MSG_DEBUG("sumOfWeights()     = " << sumOfWeights());
00103       MSG_DEBUG("_sumWeightSelected = " << _sumWeightSelected);
00104     }
00105 
00106 
00107   private:
00108 
00109     double _sumWeightSelected;
00110 
00111     Histo1DPtr _h_pT_piplus;
00112     Histo1DPtr _h_pT_piminus;
00113     Histo1DPtr _h_pT_proton;
00114     Histo1DPtr _h_pT_antiproton;
00115 
00116     Scatter2DPtr _h_piminus_piplus;
00117     Scatter2DPtr _h_antipr_pr;
00118     Scatter2DPtr _h_pr_piplus;
00119     Scatter2DPtr _h_antipr_piminus;
00120 
00121   };
00122 
00123 
00124 
00125   // The hook for the plugin system
00126   DECLARE_RIVET_PLUGIN(STAR_2006_S6500200);
00127 
00128 }