CMS_2011_S8978280.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/UnstableFinalState.hh"
00006 
00007 namespace Rivet {
00008 
00009   /// @brief CMS strange particle spectra (Ks, Lambda, Cascade) in pp at 900 and 7000 GeV
00010   /// @author Kevin Stenson
00011   class CMS_2011_S8978280 : public Analysis {
00012   public:
00013 
00014     /// Constructor
00015     CMS_2011_S8978280() : Analysis("CMS_2011_S8978280") {}
00016 
00017 
00018     void init() {
00019       // Need wide range of eta because cut on rapidity not pseudorapidity
00020       UnstableFinalState ufs(-8.0, 8.0, 0.0*GeV);
00021       addProjection(ufs, "UFS");
00022 
00023       // Particle distributions versus rapidity and transverse momentum
00024       // Only make histograms if the correct energy is used.
00025       if (fuzzyEquals(sqrtS()/GeV, 900)){
00026         _h_dNKshort_dy  = bookHistogram1D(1, 1, 1);
00027         _h_dNKshort_dpT = bookHistogram1D(2, 1, 1);
00028         _h_dNLambda_dy  = bookHistogram1D(3, 1, 1);
00029         _h_dNLambda_dpT = bookHistogram1D(4, 1, 1);
00030         _h_dNXi_dy      = bookHistogram1D(5, 1, 1);
00031         _h_dNXi_dpT     = bookHistogram1D(6, 1, 1);
00032       } else if (fuzzyEquals(sqrtS()/GeV, 7000)){
00033         _h_dNKshort_dy  = bookHistogram1D(1, 1, 2);
00034         _h_dNKshort_dpT = bookHistogram1D(2, 1, 2);
00035         _h_dNLambda_dy  = bookHistogram1D(3, 1, 2);
00036         _h_dNLambda_dpT = bookHistogram1D(4, 1, 2);
00037         _h_dNXi_dy      = bookHistogram1D(5, 1, 2);
00038         _h_dNXi_dpT     = bookHistogram1D(6, 1, 2);
00039       }
00040     }
00041 
00042 
00043     void analyze(const Event& event) {
00044       const double weight = event.weight();
00045 
00046       const UnstableFinalState& parts = applyProjection<UnstableFinalState>(event, "UFS");
00047 
00048       foreach (const Particle& p, parts.particles()) {
00049         const double pT = p.momentum().pT();
00050         const double y = fabs(p.momentum().rapidity());
00051         const PdgId pid = abs(p.pdgId());
00052 
00053         if (y < 2.0) {
00054           switch (pid) {
00055           case K0S:
00056               _h_dNKshort_dy->fill(y, weight);
00057               _h_dNKshort_dpT->fill(pT, weight);
00058             break;
00059           case LAMBDA:
00060             // Lambda should not have Cascade or Omega ancestors since they should not decay. But just in case...
00061             if ( !( p.hasAncestor(3322) || p.hasAncestor(-3322) || p.hasAncestor(3312) || p.hasAncestor(-3312) || p.hasAncestor(3334) || p.hasAncestor(-3334) ) ) {
00062               _h_dNLambda_dy->fill(y, weight);
00063               _h_dNLambda_dpT->fill(pT, weight);
00064             }
00065             break;
00066           case XIMINUS:
00067             // Cascade should not have Omega ancestors since it should not decay.  But just in case...
00068             if ( !( p.hasAncestor(3334) || p.hasAncestor(-3334) ) ) {
00069               _h_dNXi_dy->fill(y, weight);
00070               _h_dNXi_dpT->fill(pT, weight);
00071             }
00072             break;
00073           }
00074         }
00075       }
00076     }
00077 
00078 
00079     void finalize() {
00080       AIDA::IHistogramFactory& hf = histogramFactory();
00081       const string dir = histoDir();
00082 
00083       // Making the Lambda/Kshort and Xi/Lambda ratios vs pT and y
00084       if (fuzzyEquals(sqrtS()/GeV, 900)) {
00085         hf.divide(dir + "/d07-x01-y01",*_h_dNLambda_dpT, *_h_dNKshort_dpT);
00086         hf.divide(dir + "/d08-x01-y01",*_h_dNXi_dpT, *_h_dNLambda_dpT);
00087         hf.divide(dir + "/d09-x01-y01",*_h_dNLambda_dy, *_h_dNKshort_dy);
00088         hf.divide(dir + "/d10-x01-y01",*_h_dNXi_dy, *_h_dNLambda_dy);
00089       } else if (fuzzyEquals(sqrtS()/GeV, 7000)) {
00090         hf.divide(dir + "/d07-x01-y02",*_h_dNLambda_dpT, *_h_dNKshort_dpT);
00091         hf.divide(dir + "/d08-x01-y02",*_h_dNXi_dpT, *_h_dNLambda_dpT);
00092         hf.divide(dir + "/d09-x01-y02",*_h_dNLambda_dy, *_h_dNKshort_dy);
00093         hf.divide(dir + "/d10-x01-y02",*_h_dNXi_dy, *_h_dNLambda_dy);
00094       }
00095 
00096       double normpT = 1.0/sumOfWeights();
00097       double normy = 0.5*normpT; // Accounts for using |y| instead of y
00098       scale(_h_dNKshort_dy, normy);
00099       scale(_h_dNKshort_dpT, normpT);
00100       scale(_h_dNLambda_dy, normy);
00101       scale(_h_dNLambda_dpT, normpT);
00102       scale(_h_dNXi_dy, normy);
00103       scale(_h_dNXi_dpT, normpT);
00104     }
00105 
00106 
00107   private:
00108     // Particle distributions versus rapidity and transverse momentum
00109     AIDA::IHistogram1D *_h_dNKshort_dy;
00110     AIDA::IHistogram1D *_h_dNKshort_dpT;
00111     AIDA::IHistogram1D *_h_dNLambda_dy;
00112     AIDA::IHistogram1D *_h_dNLambda_dpT;
00113     AIDA::IHistogram1D *_h_dNXi_dy;
00114     AIDA::IHistogram1D *_h_dNXi_dpT;
00115   };
00116 
00117 
00118   // This global object acts as a hook for the plugin system
00119   AnalysisBuilder<CMS_2011_S8978280> plugin_CMS_2011_S8978280;
00120 
00121 }