00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Projections/LossyFinalState.hh"
00007 #include "Rivet/Tools/ParticleIdUtils.hh"
00008
00009 namespace Rivet {
00010
00011
00012 class STARRandomFilter {
00013 public:
00014
00015 STARRandomFilter() { }
00016
00017
00018 bool operator()(const Particle& p) {
00019
00020 size_t idx = floor(p.momentum().pT()/MeV/50);
00021 if (idx > 11) idx = 11;
00022 return (rand()/static_cast<double>(RAND_MAX) > _trkeff[idx]);
00023 }
00024
00025 int compare(const STARRandomFilter& other) const {
00026 return true;
00027 }
00028
00029 private:
00030
00031 const static double _trkeff[12];
00032
00033 };
00034
00035
00036
00037
00038 const double STARRandomFilter::_trkeff[12] = {0,0,0.38,0.72,0.78,0.81,0.82,0.84,0.85,0.86,0.87,0.88};
00039
00040
00041
00042 class STAR_2008_S7869363 : public Analysis {
00043 public:
00044
00045
00046
00047
00048
00049 STAR_2008_S7869363()
00050 : Analysis("STAR_2008_S7869363"),
00051 nCutsPassed(0),
00052 nPi(0), nPiPlus(0), nKaon(0), nKaonPlus(0), nProton(0), nAntiProton(0)
00053 {
00054 setBeams(PROTON, PROTON);
00055 setNeedsCrossSection(false);
00056 }
00057
00058
00059
00060
00061 public:
00062
00063
00064
00065
00066
00067 void init() {
00068 const ChargedFinalState cfs(-0.5, 0.5, 0.2*GeV);
00069 const LossyFinalState<STARRandomFilter> lfs(cfs, STARRandomFilter());
00070 addProjection(lfs, "FS");
00071
00072 _h_dNch = bookHistogram1D(1, 1, 1);
00073 _h_dpT_Pi = bookHistogram1D(2, 1, 1);
00074 _h_dpT_Piplus = bookHistogram1D(2, 1, 2);
00075 _h_dpT_Kaon = bookHistogram1D(2, 1, 3);
00076 _h_dpT_Kaonplus = bookHistogram1D(2, 1, 4);
00077 _h_dpT_AntiProton = bookHistogram1D(2, 1, 5);
00078 _h_dpT_Proton = bookHistogram1D(2, 1, 6);
00079 }
00080
00081
00082
00083 void analyze(const Event& event) {
00084 const FinalState& charged = applyProjection<FinalState>(event, "FS");
00085
00086
00087
00088 double vtxeffs[24] = { 0.000000,0.512667,0.739365,0.847131,0.906946,0.940922,0.959328,0.96997,
00089 0.975838,0.984432,0.988311,0.990327,0.990758,0.995767,0.99412,0.992271,
00090 0.996631,0.994802,0.99635,0.997384,0.998986,0.996441,0.994513,1.000000 };
00091
00092 double vtxeff = 1.0;
00093 if (charged.particles().size() < 24) {
00094 vtxeff = vtxeffs[charged.particles().size()];
00095 }
00096
00097 const double weight = vtxeff * event.weight();
00098
00099 foreach (const Particle& p, charged.particles()) {
00100 double pT = p.momentum().pT()/GeV;
00101 double y = p.momentum().rapidity();
00102 if (fabs(y) < 0.1) {
00103 nCutsPassed += weight;
00104 const PdgId id = p.pdgId();
00105 switch (id) {
00106 case -211:
00107 _h_dpT_Pi->fill(pT, weight/(TWOPI*pT*0.2));
00108 nPi += weight;
00109 break;
00110 case 211:
00111 _h_dpT_Piplus->fill(pT, weight/(TWOPI*pT*0.2));
00112 nPiPlus += weight;
00113 break;
00114 case -321:
00115 _h_dpT_Kaon->fill(pT, weight/(TWOPI*pT*0.2));
00116 nKaon += weight;
00117 break;
00118 case 321:
00119 _h_dpT_Kaonplus->fill(pT, weight/(TWOPI*pT*0.2));
00120 nKaonPlus += weight;
00121 break;
00122 case -2212:
00123 _h_dpT_AntiProton->fill(pT, weight/(TWOPI*pT*0.2));
00124 nAntiProton += weight;
00125 break;
00126 case 2212:
00127 _h_dpT_Proton->fill(pT, weight/(TWOPI*pT*0.2));
00128 nProton += weight;
00129 break;
00130 }
00131 }
00132 else {
00133 continue;
00134 }
00135 }
00136 _h_dNch->fill(charged.particles().size(), weight);
00137 }
00138
00139
00140
00141 void finalize() {
00142
00143 normalize(_h_dNch);
00144
00145
00146 normalize(_h_dpT_Pi , 0.389825 );
00147 normalize(_h_dpT_Piplus , 0.396025 );
00148 normalize(_h_dpT_Kaon , 0.03897 );
00149 normalize(_h_dpT_Kaonplus , 0.04046 );
00150 normalize(_h_dpT_AntiProton, 0.0187255);
00151 normalize(_h_dpT_Proton , 0.016511 );
00152 }
00153
00154
00155 private:
00156
00157
00158 AIDA::IHistogram1D *_h_dNch;
00159
00160 AIDA::IHistogram1D *_h_dpT_Pi, *_h_dpT_Piplus;
00161 AIDA::IHistogram1D *_h_dpT_Kaon, *_h_dpT_Kaonplus;
00162 AIDA::IHistogram1D *_h_dpT_AntiProton, *_h_dpT_Proton;
00163
00164 AIDA::IProfile1D *_h_pT_vs_Nch;
00165 double nCutsPassed, nPi, nPiPlus, nKaon, nKaonPlus, nProton, nAntiProton;
00166 };
00167
00168
00169
00170
00171 AnalysisBuilder<STAR_2008_S7869363> plugin_STAR_2008_S7869363;
00172
00173
00174 }