STAR_2006_S6860818.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/Projections/UnstableFinalState.hh"
00007 #include "Rivet/RivetAIDA.hh"
00008 
00009 namespace Rivet {
00010 
00011   /// @brief strange particle spectra in pp at 200 GeV
00012   class STAR_2006_S6860818 : public Analysis {
00013   public:
00014 
00015     /// Constructor
00016     STAR_2006_S6860818()
00017       : Analysis("STAR_2006_S6860818"),
00018         _sumWeightSelected(0.0)
00019     {
00020       setBeams(PROTON, PROTON);
00021       for (size_t i=0 ; i<4 ; i++) {
00022         _nBaryon[i]=0;
00023         _nAntiBaryon[i]=0;
00024         _nWeightedBaryon[i]=0.;
00025         _nWeightedAntiBaryon[i]=0.;
00026       }
00027     }
00028 
00029     /// Book projections and histograms
00030     void init() {
00031       ChargedFinalState bbc1(-5.0,-3.5, 0.0*GeV); // beam-beam-counter trigger
00032       ChargedFinalState bbc2( 3.5, 5.0, 0.0*GeV); // beam-beam-counter trigger
00033       addProjection(bbc1, "BBC1");
00034       addProjection(bbc2, "BBC2");
00035 
00036       UnstableFinalState ufs(-2.5, 2.5, 0.0*GeV);
00037       addProjection(ufs, "UFS");
00038 
00039       _h_pT_k0s        = bookHistogram1D(1, 1, 1);
00040       _h_pT_kminus     = bookHistogram1D(1, 2, 1);
00041       _h_pT_kplus      = bookHistogram1D(1, 3, 1);
00042       _h_pT_lambda     = bookHistogram1D(1, 4, 1);
00043       _h_pT_lambdabar  = bookHistogram1D(1, 5, 1);
00044       _h_pT_ximinus    = bookHistogram1D(1, 6, 1);
00045       _h_pT_xiplus     = bookHistogram1D(1, 7, 1);
00046       //_h_pT_omega      = bookHistogram1D(1, 8, 1);
00047       _h_antibaryon_baryon_ratio = bookDataPointSet(2, 1, 1);
00048       _h_pT_vs_mass    = bookProfile1D(3, 1, 1);
00049     }
00050 
00051 
00052     /// Do the analysis
00053     void analyze(const Event& event) {
00054       const ChargedFinalState& bbc1 = applyProjection<ChargedFinalState>(event, "BBC1");
00055       const ChargedFinalState& bbc2 = applyProjection<ChargedFinalState>(event, "BBC2");
00056       if (bbc1.size()<1 || bbc2.size()<1) {
00057         getLog() << Log::DEBUG << "Failed beam-beam-counter trigger" << std::endl;
00058         vetoEvent;
00059       }
00060 
00061       const double weight = event.weight();
00062 
00063       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(event, "UFS");
00064       foreach (const Particle& p, ufs.particles()) {
00065         if (fabs(p.momentum().rapidity()) < 0.5) {
00066           const PdgId pid = p.pdgId();
00067           const double pT = p.momentum().pT() / GeV;
00068           switch (abs(pid)) {
00069             case PIPLUS:
00070               if (pid < 0) _h_pT_vs_mass->fill(0.1396, pT, weight);
00071               break;
00072             case PROTON:
00073               if (pid < 0) _h_pT_vs_mass->fill(0.9383, pT, weight);
00074               if (pT > 0.4) {
00075                 pid > 0 ? _nBaryon[0]++ : _nAntiBaryon[0]++;
00076                 pid > 0 ? _nWeightedBaryon[0]+=weight : _nWeightedAntiBaryon[0]+=weight;
00077               }
00078               break;
00079             case K0S:
00080               if (pT > 0.2) {
00081                 _h_pT_k0s->fill(pT, weight/pT);
00082               }
00083               _h_pT_vs_mass->fill(0.5056, pT, weight);
00084               break;
00085             case K0L:
00086               _h_pT_vs_mass->fill(0.5056, pT, weight);
00087               break;
00088             case 113: // rho0(770)
00089               _h_pT_vs_mass->fill(0.7755, pT, weight);
00090               break;
00091             case 313: // K0*(892)
00092               _h_pT_vs_mass->fill(0.8960, pT, weight);
00093               break;
00094             case 333: // phi(1020)
00095               _h_pT_vs_mass->fill(1.0190, pT, weight);
00096               break;
00097             case 3214: // Sigma(1385)
00098               _h_pT_vs_mass->fill(1.3840, pT, weight);
00099               break;
00100             case 3124: // Lambda(1520)
00101               _h_pT_vs_mass->fill(1.5200, pT, weight);
00102               break;
00103             case KPLUS:
00104               if (pid < 0) _h_pT_vs_mass->fill(0.4856, pT, weight);
00105               if (pT > 0.2) {
00106                 pid > 0 ? _h_pT_kplus->fill(pT, weight/pT) : _h_pT_kminus->fill(pT, weight/pT);
00107               }
00108               break;
00109             case LAMBDA:
00110               pid > 0 ? _h_pT_vs_mass->fill(1.1050, pT, weight) : _h_pT_vs_mass->fill(1.1250, pT, weight);
00111               if (pT > 0.3) {
00112                 pid > 0 ? _h_pT_lambda->fill(pT, weight/pT) : _h_pT_lambdabar->fill(pT, weight/pT);
00113                 pid > 0 ? _nBaryon[1]++ : _nAntiBaryon[1]++;
00114                 pid > 0 ? _nWeightedBaryon[1]+=weight : _nWeightedAntiBaryon[1]+=weight;
00115               }
00116               break;
00117             case XIMINUS:
00118               pid > 0 ? _h_pT_vs_mass->fill(1.3120, pT, weight) : _h_pT_vs_mass->fill(1.3320, pT, weight);
00119               if (pT > 0.5) {
00120                 pid > 0 ? _h_pT_ximinus->fill(pT, weight/pT) : _h_pT_xiplus->fill(pT, weight/pT);
00121                 pid > 0 ? _nBaryon[2]++ : _nAntiBaryon[2]++;
00122                 pid > 0 ? _nWeightedBaryon[2]+=weight : _nWeightedAntiBaryon[2]+=weight;
00123               }
00124               break;
00125             case OMEGAMINUS:
00126               _h_pT_vs_mass->fill(1.6720, pT, weight);
00127               if (pT > 0.5) {
00128                 //_h_pT_omega->fill(pT, weight/pT);
00129                 pid > 0 ? _nBaryon[3]++ : _nAntiBaryon[3]++;
00130                 pid > 0 ? _nWeightedBaryon[3]+=weight : _nWeightedAntiBaryon[3]+=weight;
00131               }
00132               break;
00133           }
00134 
00135         }
00136       }
00137 
00138       _sumWeightSelected += event.weight();
00139     }
00140 
00141 
00142     /// Finalize
00143     void finalize() {
00144       std::vector<double> xval;
00145       std::vector<double> xerr;
00146       std::vector<double> yval;
00147       std::vector<double> yerr;
00148       for (size_t i=0 ; i<4 ; i++) {
00149         xval.push_back(i);
00150         xerr.push_back(0.5);
00151         if (_nWeightedBaryon[i]==0 || _nWeightedAntiBaryon[i]==0) {
00152           yval.push_back(0);
00153           yerr.push_back(0);
00154         }
00155         else {
00156           double y  = _nWeightedAntiBaryon[i]/_nWeightedBaryon[i];
00157           double dy = sqrt( 1./_nAntiBaryon[i] + 1./_nBaryon[i] );
00158           yval.push_back(y);
00159           yerr.push_back(y*dy);
00160         }
00161       }
00162       _h_antibaryon_baryon_ratio->setCoordinate(0, xval, xerr);
00163       _h_antibaryon_baryon_ratio->setCoordinate(1, yval, yerr);
00164 
00165       AIDA::IHistogramFactory& hf = histogramFactory();
00166       const string dir = histoDir();
00167       hf.divide(dir + "/d02-x02-y01", *_h_pT_lambdabar, *_h_pT_lambda);
00168       hf.divide(dir + "/d02-x03-y01", *_h_pT_xiplus, *_h_pT_ximinus);
00169 
00170       scale(_h_pT_k0s,       1./(2*M_PI*_sumWeightSelected));
00171       scale(_h_pT_kminus,    1./(2*M_PI*_sumWeightSelected));
00172       scale(_h_pT_kplus,     1./(2*M_PI*_sumWeightSelected));
00173       scale(_h_pT_lambda,    1./(2*M_PI*_sumWeightSelected));
00174       scale(_h_pT_lambdabar, 1./(2*M_PI*_sumWeightSelected));
00175       scale(_h_pT_ximinus,   1./(2*M_PI*_sumWeightSelected));
00176       scale(_h_pT_xiplus,    1./(2*M_PI*_sumWeightSelected));
00177       //scale(_h_pT_omega,     1./(2*M_PI*_sumWeightSelected));
00178       getLog() << Log::DEBUG << "sumOfWeights()     = " << sumOfWeights() << std::endl;
00179       getLog() << Log::DEBUG << "_sumWeightSelected = " << _sumWeightSelected << std::endl;
00180     }
00181 
00182   private:
00183 
00184     double _sumWeightSelected;
00185     int _nBaryon[4];
00186     int _nAntiBaryon[4];
00187     double _nWeightedBaryon[4];
00188     double _nWeightedAntiBaryon[4];
00189 
00190     AIDA::IHistogram1D * _h_pT_k0s;
00191     AIDA::IHistogram1D * _h_pT_kminus;
00192     AIDA::IHistogram1D * _h_pT_kplus;
00193     AIDA::IHistogram1D * _h_pT_lambda;
00194     AIDA::IHistogram1D * _h_pT_lambdabar;
00195     AIDA::IHistogram1D * _h_pT_ximinus;
00196     AIDA::IHistogram1D * _h_pT_xiplus;
00197     //AIDA::IHistogram1D * _h_pT_omega;
00198     AIDA::IDataPointSet* _h_antibaryon_baryon_ratio;
00199     AIDA::IProfile1D*    _h_pT_vs_mass;
00200   };
00201 
00202 
00203 
00204   // This global object acts as a hook for the plugin system
00205   AnalysisBuilder<STAR_2006_S6860818> plugin_STAR_2006_S6860818;
00206 
00207 }