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