CMS_2010_S8547297.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
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     void init() {
00016       ChargedFinalState cfs(-2.5, 2.5, 0.0*GeV);
00017       addProjection(cfs, "CFS");
00018 
00019       if(fuzzyEquals(sqrtS()/GeV, 900)){
00020         for (int d=1; d<=3; d++) {
00021           for (int y=1; y<=4; y++) {
00022             _h_dNch_dpT.push_back(bookHistogram1D(d, 1, y));
00023           }
00024         }
00025         _h_dNch_dpT_all = bookHistogram1D(7, 1, 1);
00026         _h_dNch_dEta = bookHistogram1D(8, 1, 1);
00027       } else if (fuzzyEquals(sqrtS()/GeV, 2360)){
00028         for (int d=4; d<=6; d++) {
00029           for (int y=1; y<=4; y++) {
00030             _h_dNch_dpT.push_back(bookHistogram1D(d, 1, y));
00031           }
00032         }
00033         _h_dNch_dpT_all = bookHistogram1D(7, 1, 2);
00034         _h_dNch_dEta = bookHistogram1D(8, 1, 2);
00035       }
00036     }
00037 
00038 
00039     void analyze(const Event& event) {
00040       const double weight = event.weight();
00041 
00042       //charged particles
00043       const ChargedFinalState& charged = applyProjection<ChargedFinalState>(event, "CFS");
00044 
00045       foreach (const Particle& p, charged.particles()) {
00046         //selecting only charged hadrons
00047         if(! PID::isHadron(p.pdgId())) continue;
00048 
00049         const double pT = p.momentum().pT();
00050         const double eta = p.momentum().eta();
00051 
00052         // The data is actually a duplicated folded distribution.  This should mimic it.
00053         _h_dNch_dEta->fill(eta, 0.5*weight);
00054         _h_dNch_dEta->fill(-eta, 0.5*weight);
00055         if (fabs(eta)<2.4 && pT>0.1) {
00056           if (pT<4.0) {
00057             _h_dNch_dpT_all->fill(pT, weight/pT);
00058             if (pT<2.0) {
00059               int ietabin = fabs(eta)/0.2;
00060               _h_dNch_dpT[ietabin]->fill(pT, weight);
00061             }
00062           }
00063         }
00064       }
00065     }
00066 
00067     void finalize() {
00068       const double normfac = 1.0/sumOfWeights(); // Normalizing to unit eta is automatic
00069       // The pT distributions in bins of eta must be normalized to unit eta.  This is a factor of 2
00070       // for the |eta| times 0.2 (eta range).
00071       // The pT distributions over all eta are normalized to unit eta (2.0*2.4) and by 1/2*pi*pT.
00072       // The 1/pT part is taken care of in the filling.  The 1/2pi is taken care of here.
00073       const double normpT = normfac/(2.0*0.2);
00074       const double normpTall = normfac/(2.0*M_PI*2.0*2.4);
00075 
00076       for (size_t ietabin=0; ietabin < _h_dNch_dpT.size(); ietabin++){
00077         scale(_h_dNch_dpT[ietabin], normpT);
00078       }
00079       scale(_h_dNch_dpT_all, normpTall);
00080       scale(_h_dNch_dEta, normfac);
00081     }
00082 
00083 
00084   private:
00085     std::vector<AIDA::IHistogram1D*> _h_dNch_dpT;
00086     AIDA::IHistogram1D* _h_dNch_dpT_all;
00087     AIDA::IHistogram1D* _h_dNch_dEta;
00088    };
00089 
00090   // This global object acts as a hook for the plugin system
00091   AnalysisBuilder<CMS_2010_S8547297> plugin_CMS_2010_S8547297;
00092 }
00093