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       setBeams(PROTON, PROTON);
00021     }
00022 
00023     /// Book projections and histograms
00024     void init() {
00025       ChargedFinalState bbc1(-5.0,-3.3, 0.0*GeV); // beam-beam-counter trigger
00026       ChargedFinalState bbc2( 3.3, 5.0, 0.0*GeV); // beam-beam-counter trigger
00027       addProjection(bbc1, "BBC1");
00028       addProjection(bbc2, "BBC2");
00029 
00030       IdentifiedFinalState pionfs(-2.5, 2.5, 0.3*GeV);
00031       IdentifiedFinalState protonfs(-2.5, 2.5, 0.4*GeV);
00032       pionfs.acceptIdPair(PIPLUS);
00033       protonfs.acceptIdPair(PROTON);
00034       addProjection(pionfs, "PIONFS");
00035       addProjection(protonfs, "PROTONFS");
00036 
00037       _h_pT_piplus     = bookHistogram1D(1, 1, 1);
00038       _h_pT_piminus    = bookHistogram1D(1, 2, 1);
00039       _h_pT_proton     = bookHistogram1D(1, 3, 1);
00040       _h_pT_antiproton = bookHistogram1D(1, 4, 1);
00041     }
00042 
00043 
00044     /// Do the analysis
00045     void analyze(const Event& event) {
00046       const ChargedFinalState& bbc1 = applyProjection<ChargedFinalState>(event, "BBC1");
00047       const ChargedFinalState& bbc2 = applyProjection<ChargedFinalState>(event, "BBC2");
00048       if (bbc1.size()<1 || bbc2.size()<1) {
00049         getLog() << Log::DEBUG << "Failed beam-beam-counter trigger" << std::endl;
00050         vetoEvent;
00051       }
00052 
00053       const double weight = event.weight();
00054 
00055       const IdentifiedFinalState& pionfs = applyProjection<IdentifiedFinalState>(event, "PIONFS");
00056       foreach (const Particle& p, pionfs.particles()) {
00057         if (fabs(p.momentum().rapidity()) < 0.5) {
00058           const double pT = p.momentum().pT() / GeV;
00059           if (p.pdgId()>0) {
00060             _h_pT_piplus->fill(pT, weight/pT);
00061           }
00062           else {
00063             _h_pT_piminus->fill(pT, weight/pT);
00064           }
00065         }
00066       }
00067 
00068       const IdentifiedFinalState& protonfs = applyProjection<IdentifiedFinalState>(event, "PROTONFS");
00069       foreach (const Particle& p, protonfs.particles()) {
00070         if (fabs(p.momentum().rapidity()) < 0.5) {
00071           const double pT = p.momentum().pT() / GeV;
00072           if (p.pdgId()>0) {
00073             _h_pT_proton->fill(pT, weight/pT);
00074           }
00075           else {
00076             _h_pT_antiproton->fill(pT, weight/pT);
00077           }
00078         }
00079       }
00080       _sumWeightSelected += event.weight();
00081     }
00082 
00083 
00084     /// Finalize
00085     void finalize() {
00086       AIDA::IHistogramFactory& hf = histogramFactory();
00087       const string dir = histoDir();
00088 
00089       hf.divide(dir + "/d02-x01-y01", *_h_pT_piminus, *_h_pT_piplus);
00090       hf.divide(dir + "/d02-x02-y01", *_h_pT_antiproton, *_h_pT_proton);
00091       hf.divide(dir + "/d02-x03-y01", *_h_pT_proton, *_h_pT_piplus);
00092       hf.divide(dir + "/d02-x04-y01", *_h_pT_antiproton, *_h_pT_piminus);
00093 
00094       scale(_h_pT_piplus,     1./(2*M_PI*_sumWeightSelected));
00095       scale(_h_pT_piminus,    1./(2*M_PI*_sumWeightSelected));
00096       scale(_h_pT_proton,     1./(2*M_PI*_sumWeightSelected));
00097       scale(_h_pT_antiproton, 1./(2*M_PI*_sumWeightSelected));
00098       getLog() << Log::DEBUG << "sumOfWeights()     = " << sumOfWeights() << std::endl;
00099       getLog() << Log::DEBUG << "_sumWeightSelected = " << _sumWeightSelected << std::endl;
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   // This global object acts as a hook for the plugin system
00115   AnalysisBuilder<STAR_2006_S6500200> plugin_STAR_2006_S6500200;
00116 
00117 }