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/RivetAIDA.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     = bookHistogram1D(1, 1, 1);
00037       _h_pT_piminus    = bookHistogram1D(1, 2, 1);
00038       _h_pT_proton     = bookHistogram1D(1, 3, 1);
00039       _h_pT_antiproton = bookHistogram1D(1, 4, 1);
00040     }
00041 
00042 
00043     /// Do the analysis
00044     void analyze(const Event& event) {
00045       const ChargedFinalState& bbc1 = applyProjection<ChargedFinalState>(event, "BBC1");
00046       const ChargedFinalState& bbc2 = applyProjection<ChargedFinalState>(event, "BBC2");
00047       if (bbc1.size()<1 || bbc2.size()<1) {
00048         MSG_DEBUG("Failed beam-beam-counter trigger");
00049         vetoEvent;
00050       }
00051 
00052       const double weight = event.weight();
00053 
00054       const IdentifiedFinalState& pionfs = applyProjection<IdentifiedFinalState>(event, "PIONFS");
00055       foreach (const Particle& p, pionfs.particles()) {
00056         if (fabs(p.momentum().rapidity()) < 0.5) {
00057           const double pT = p.momentum().pT() / GeV;
00058           if (p.pdgId()>0) {
00059             _h_pT_piplus->fill(pT, weight/pT);
00060           }
00061           else {
00062             _h_pT_piminus->fill(pT, weight/pT);
00063           }
00064         }
00065       }
00066 
00067       const IdentifiedFinalState& protonfs = applyProjection<IdentifiedFinalState>(event, "PROTONFS");
00068       foreach (const Particle& p, protonfs.particles()) {
00069         if (fabs(p.momentum().rapidity()) < 0.5) {
00070           const double pT = p.momentum().pT() / GeV;
00071           if (p.pdgId()>0) {
00072             _h_pT_proton->fill(pT, weight/pT);
00073           }
00074           else {
00075             _h_pT_antiproton->fill(pT, weight/pT);
00076           }
00077         }
00078       }
00079       _sumWeightSelected += event.weight();
00080     }
00081 
00082 
00083     /// Finalize
00084     void finalize() {
00085       AIDA::IHistogramFactory& hf = histogramFactory();
00086       const string dir = histoDir();
00087 
00088       hf.divide(dir + "/d02-x01-y01", *_h_pT_piminus, *_h_pT_piplus);
00089       hf.divide(dir + "/d02-x02-y01", *_h_pT_antiproton, *_h_pT_proton);
00090       hf.divide(dir + "/d02-x03-y01", *_h_pT_proton, *_h_pT_piplus);
00091       hf.divide(dir + "/d02-x04-y01", *_h_pT_antiproton, *_h_pT_piminus);
00092 
00093       scale(_h_pT_piplus,     1./(2*M_PI*_sumWeightSelected));
00094       scale(_h_pT_piminus,    1./(2*M_PI*_sumWeightSelected));
00095       scale(_h_pT_proton,     1./(2*M_PI*_sumWeightSelected));
00096       scale(_h_pT_antiproton, 1./(2*M_PI*_sumWeightSelected));
00097       MSG_DEBUG("sumOfWeights()     = " << sumOfWeights());
00098       MSG_DEBUG("_sumWeightSelected = " << _sumWeightSelected);
00099     }
00100 
00101 
00102   private:
00103 
00104     double _sumWeightSelected;
00105 
00106     AIDA::IHistogram1D * _h_pT_piplus;
00107     AIDA::IHistogram1D * _h_pT_piminus;
00108     AIDA::IHistogram1D * _h_pT_proton;
00109     AIDA::IHistogram1D * _h_pT_antiproton;
00110   };
00111 
00112 
00113 
00114   // The hook for the plugin system
00115   DECLARE_RIVET_PLUGIN(STAR_2006_S6500200);
00116 
00117 }