CMS_2010_S8547297.cc
Go to the documentation of this file.00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 #include "Rivet/Tools/ParticleIdUtils.hh"
00006
00007 namespace Rivet {
00008
00009
00010 class CMS_2010_S8547297 : public Analysis {
00011 public:
00012
00013 CMS_2010_S8547297() : Analysis("CMS_2010_S8547297") {}
00014
00015
00016 void init() {
00017 ChargedFinalState cfs(-2.5, 2.5, 0.0*GeV);
00018 addProjection(cfs, "CFS");
00019
00020 if (fuzzyEquals(sqrtS()/GeV, 900)) {
00021 for (int d=1; d<=3; d++) {
00022 for (int y=1; y<=4; y++) {
00023 _h_dNch_dpT.push_back(bookHistogram1D(d, 1, y));
00024 }
00025 }
00026 _h_dNch_dpT_all = bookHistogram1D(7, 1, 1);
00027 _h_dNch_dEta = bookHistogram1D(8, 1, 1);
00028 } else if (fuzzyEquals(sqrtS()/GeV, 2360)) {
00029 for (int d=4; d<=6; d++) {
00030 for (int y=1; y<=4; y++) {
00031 _h_dNch_dpT.push_back(bookHistogram1D(d, 1, y));
00032 }
00033 }
00034 _h_dNch_dpT_all = bookHistogram1D(7, 1, 2);
00035 _h_dNch_dEta = bookHistogram1D(8, 1, 2);
00036 }
00037 }
00038
00039
00040 void analyze(const Event& event) {
00041 const double weight = event.weight();
00042
00043
00044 const ChargedFinalState& charged = applyProjection<ChargedFinalState>(event, "CFS");
00045
00046 foreach (const Particle& p, charged.particles()) {
00047
00048 if (! PID::isHadron(p.pdgId())) continue;
00049
00050 const double pT = p.momentum().pT();
00051 const double eta = p.momentum().eta();
00052
00053
00054 _h_dNch_dEta->fill(eta, 0.5*weight);
00055 _h_dNch_dEta->fill(-eta, 0.5*weight);
00056 if (fabs(eta) < 2.4 && pT > 0.1*GeV) {
00057 if (pT < 4.0*GeV) {
00058 _h_dNch_dpT_all->fill(pT/GeV, weight/(pT/GeV));
00059 if (pT < 2.0*GeV) {
00060 int ietabin = int(fabs(eta)/0.2);
00061 _h_dNch_dpT[ietabin]->fill(pT/GeV, weight);
00062 }
00063 }
00064 }
00065 }
00066 }
00067
00068
00069 void finalize() {
00070 const double normfac = 1.0/sumOfWeights();
00071
00072
00073
00074
00075 const double normpT = normfac/(2.0*0.2);
00076 const double normpTall = normfac/(2.0*M_PI*2.0*2.4);
00077
00078 for (size_t ietabin=0; ietabin < _h_dNch_dpT.size(); ietabin++){
00079 scale(_h_dNch_dpT[ietabin], normpT);
00080 }
00081 scale(_h_dNch_dpT_all, normpTall);
00082 scale(_h_dNch_dEta, normfac);
00083 }
00084
00085
00086 private:
00087
00088 std::vector<AIDA::IHistogram1D*> _h_dNch_dpT;
00089 AIDA::IHistogram1D* _h_dNch_dpT_all;
00090 AIDA::IHistogram1D* _h_dNch_dEta;
00091
00092 };
00093
00094
00095
00096
00097 DECLARE_RIVET_PLUGIN(CMS_2010_S8547297);
00098
00099 }