STAR_2008_S7869363.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/Projections/ChargedFinalState.hh" 00004 #include "Rivet/Projections/LossyFinalState.hh" 00005 00006 namespace Rivet { 00007 00008 00009 class STARRandomFilter { 00010 public: 00011 00012 STARRandomFilter() { } 00013 00014 // Return true to throw away a particle 00015 bool operator()(const Particle& p) { 00016 /// @todo Use a better RNG? 00017 size_t idx = int(floor(p.pT()/MeV/50)); 00018 if (idx > 11) idx = 11; 00019 return (rand()/static_cast<double>(RAND_MAX) > _trkeff[idx]); 00020 } 00021 00022 int compare(const STARRandomFilter& other) const { 00023 return true; 00024 } 00025 00026 private: 00027 00028 const static double _trkeff[12]; 00029 00030 }; 00031 00032 00033 // Here we have the track reconstruction efficiencies for tracks with pT from 0 to 600 MeV 00034 // in steps of 50 MeV. The efficiency is assumed to be 0.88 for pT >= 600 MeV 00035 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}; 00036 00037 00038 00039 class STAR_2008_S7869363 : public Analysis { 00040 public: 00041 00042 /// @name Constructors etc. 00043 //@{ 00044 00045 /// Constructor 00046 STAR_2008_S7869363() 00047 : Analysis("STAR_2008_S7869363"), 00048 nCutsPassed(0), 00049 nPi(0), nPiPlus(0), nKaon(0), nKaonPlus(0), nProton(0), nAntiProton(0) 00050 { } 00051 00052 //@} 00053 00054 00055 public: 00056 00057 /// @name Analysis methods 00058 //@{ 00059 00060 /// Book histograms and initialise projections before the run 00061 void init() { 00062 const ChargedFinalState cfs(-0.5, 0.5, 0.2*GeV); 00063 const LossyFinalState<STARRandomFilter> lfs(cfs, STARRandomFilter()); 00064 addProjection(lfs, "FS"); 00065 00066 _h_dNch = bookHisto1D(1, 1, 1); 00067 _h_dpT_Pi = bookHisto1D(2, 1, 1); 00068 _h_dpT_Piplus = bookHisto1D(2, 1, 2); 00069 _h_dpT_Kaon = bookHisto1D(2, 1, 3); 00070 _h_dpT_Kaonplus = bookHisto1D(2, 1, 4); 00071 _h_dpT_AntiProton = bookHisto1D(2, 1, 5); 00072 _h_dpT_Proton = bookHisto1D(2, 1, 6); 00073 } 00074 00075 00076 /// Perform the per-event analysis 00077 void analyze(const Event& event) { 00078 const FinalState& charged = applyProjection<FinalState>(event, "FS"); 00079 00080 // Vertex reconstruction efficiencies as a function of charged multiplicity. 00081 // For events with more than 23 reconstructed tracks the efficiency is 100%. 00082 double vtxeffs[24] = { 0.000000,0.512667,0.739365,0.847131,0.906946,0.940922,0.959328,0.96997, 00083 0.975838,0.984432,0.988311,0.990327,0.990758,0.995767,0.99412,0.992271, 00084 0.996631,0.994802,0.99635,0.997384,0.998986,0.996441,0.994513,1.000000 }; 00085 00086 double vtxeff = 1.0; 00087 if (charged.particles().size() < 24) { 00088 vtxeff = vtxeffs[charged.particles().size()]; 00089 } 00090 00091 const double weight = vtxeff * event.weight(); 00092 00093 foreach (const Particle& p, charged.particles()) { 00094 double pT = p.pT()/GeV; 00095 double y = p.rapidity(); 00096 if (fabs(y) < 0.1) { 00097 nCutsPassed += weight; 00098 const PdgId id = p.pid(); 00099 switch (id) { 00100 case -211: 00101 _h_dpT_Pi->fill(pT, weight/(TWOPI*pT*0.2)); 00102 nPi += weight; 00103 break; 00104 case 211: 00105 _h_dpT_Piplus->fill(pT, weight/(TWOPI*pT*0.2)); 00106 nPiPlus += weight; 00107 break; 00108 case -321: 00109 _h_dpT_Kaon->fill(pT, weight/(TWOPI*pT*0.2)); 00110 nKaon += weight; 00111 break; 00112 case 321: 00113 _h_dpT_Kaonplus->fill(pT, weight/(TWOPI*pT*0.2)); 00114 nKaonPlus += weight; 00115 break; 00116 case -2212: 00117 _h_dpT_AntiProton->fill(pT, weight/(TWOPI*pT*0.2)); 00118 nAntiProton += weight; 00119 break; 00120 case 2212: 00121 _h_dpT_Proton->fill(pT, weight/(TWOPI*pT*0.2)); 00122 nProton += weight; 00123 break; 00124 } 00125 } 00126 else { 00127 continue; 00128 } 00129 } 00130 _h_dNch->fill(charged.particles().size(), weight); 00131 } 00132 00133 00134 /// Normalise histograms etc., after the run 00135 void finalize() { 00136 //double nTot = nPi + nPiPlus + nKaon + nKaonPlus + nProton + nAntiProton; 00137 normalize(_h_dNch); 00138 00139 /// @todo Norm to data! 00140 normalize(_h_dpT_Pi , 0.389825 ); 00141 normalize(_h_dpT_Piplus , 0.396025 ); 00142 normalize(_h_dpT_Kaon , 0.03897 ); 00143 normalize(_h_dpT_Kaonplus , 0.04046 ); 00144 normalize(_h_dpT_AntiProton, 0.0187255); 00145 normalize(_h_dpT_Proton , 0.016511 ); 00146 } 00147 00148 00149 private: 00150 00151 00152 Histo1DPtr _h_dNch; 00153 00154 Histo1DPtr _h_dpT_Pi, _h_dpT_Piplus; 00155 Histo1DPtr _h_dpT_Kaon, _h_dpT_Kaonplus; 00156 Histo1DPtr _h_dpT_AntiProton, _h_dpT_Proton; 00157 00158 Profile1DPtr _h_pT_vs_Nch; 00159 double nCutsPassed, nPi, nPiPlus, nKaon, nKaonPlus, nProton, nAntiProton; 00160 }; 00161 00162 00163 00164 // The hook for the plugin system 00165 DECLARE_RIVET_PLUGIN(STAR_2008_S7869363); 00166 00167 } Generated on Wed Oct 7 2015 12:09:15 for The Rivet MC analysis system by ![]() |