CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/GeneratorInterface/RivetInterface/src/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 #include "Rivet/Projections/Beam.hh"
00007 
00008 namespace Rivet {
00009 
00012   class CMS_2011_S8978280 : public Analysis {
00013   public:
00014 
00016     CMS_2011_S8978280()
00017       : Analysis("CMS_2011_S8978280"),
00018         _Nevt_after_cuts(0.0)
00019     {
00020       setBeams(PROTON, PROTON);
00021       setNeedsCrossSection(false);
00022     }
00023 
00024 
00025     void init() {
00026 
00027       addProjection(Beam(), "Beam");
00028 
00029       // Need wide range of eta because cut on rapidity not pseudorapidity
00030       UnstableFinalState ufs(-8.0, 8.0, 0.0*GeV);
00031       addProjection(ufs, "UFS");
00032 
00033       // Particle distributions versus rapidity and transverse momentum
00034       // Only make histograms if the correct energy is used.
00035       if (fuzzyEquals(sqrtS(), 900*GeV, 1E-3)){
00036         _h_dNKshort_dy = bookHistogram1D(1, 1, 1);
00037         _h_dNKshort_dpT = bookHistogram1D(2, 1, 1);
00038         _h_dNLambda_dy = bookHistogram1D(3, 1, 1);
00039         _h_dNLambda_dpT = bookHistogram1D(4, 1, 1);
00040         _h_dNXi_dy = bookHistogram1D(5, 1, 1);
00041         _h_dNXi_dpT = bookHistogram1D(6, 1, 1);
00042       } else if (fuzzyEquals(sqrtS(), 7000*GeV, 1E-3)){
00043         _h_dNKshort_dy = bookHistogram1D(1, 1, 2);
00044         _h_dNKshort_dpT = bookHistogram1D(2, 1, 2);
00045         _h_dNLambda_dy = bookHistogram1D(3, 1, 2);
00046         _h_dNLambda_dpT = bookHistogram1D(4, 1, 2);
00047         _h_dNXi_dy = bookHistogram1D(5, 1, 2);
00048         _h_dNXi_dpT = bookHistogram1D(6, 1, 2);
00049       }
00050       return;
00051     }
00052 
00053 
00055     void analyze(const Event& event) {
00056       if (!fuzzyEquals(sqrtS(), 900*GeV, 1E-3) && !fuzzyEquals(sqrtS(), 7000*GeV, 1E-3) ){
00057         return;
00058       }
00059       const double weight = event.weight();
00060 
00061       _Nevt_after_cuts += weight;
00062 
00063       // This works as long as the KShort, Lambda, and Cascade are not decayed in the generator.
00064       const UnstableFinalState& parts = applyProjection<UnstableFinalState>(event, "UFS");
00065 
00066       foreach (const Particle& p, parts.particles()) {
00067         const double pT = p.momentum().pT();
00068         const double y = fabs(p.momentum().rapidity());
00069         const PdgId pid = abs(p.pdgId());
00070 
00071         if (y < 2.0) {
00072 
00073           switch (pid) {
00074           case K0S:
00075               _h_dNKshort_dy->fill(y, weight);
00076               _h_dNKshort_dpT->fill(pT, weight);
00077             break;
00078           case LAMBDA:
00079             // Lambda should not have Cascade or Omega ancestors since they should not decay. But just in case...
00080             if ( !( p.hasAncestor(3322) || p.hasAncestor(-3322) || p.hasAncestor(3312) || p.hasAncestor(-3312) || p.hasAncestor(3334) || p.hasAncestor(-3334) ) ) {
00081               _h_dNLambda_dy->fill(y, weight);
00082               _h_dNLambda_dpT->fill(pT, weight);
00083                  }
00084             break;
00085           case XIMINUS:
00086             // Cascade should not have Omega ancestors since it should not decay.  But just in case...
00087             if ( !( p.hasAncestor(3334) || p.hasAncestor(-3334) ) ) {
00088               _h_dNXi_dy->fill(y, weight);
00089               _h_dNXi_dpT->fill(pT, weight);
00090             }
00091             break;
00092           }
00093         }
00094       }
00095       return;
00096     }
00097 
00098 
00099     void finalize() {
00100       if (!fuzzyEquals(sqrtS(), 900*GeV, 1E-3) && !fuzzyEquals(sqrtS(), 7000*GeV, 1E-3) ){
00101         return;
00102       }
00103       AIDA::IHistogramFactory& hf = histogramFactory();
00104       const string dir = histoDir();
00105 
00106       // Making the Lambda/Kshort and Xi/Lambda ratios vs pT and y
00107       if (fuzzyEquals(sqrtS(), 900*GeV, 1E-3)){
00108         hf.divide(dir + "/d07-x01-y01",*_h_dNLambda_dpT, *_h_dNKshort_dpT);
00109         hf.divide(dir + "/d08-x01-y01",*_h_dNXi_dpT, *_h_dNLambda_dpT);
00110         hf.divide(dir + "/d09-x01-y01",*_h_dNLambda_dy, *_h_dNKshort_dy);
00111         hf.divide(dir + "/d10-x01-y01",*_h_dNXi_dy, *_h_dNLambda_dy);
00112       } else if (fuzzyEquals(sqrtS(), 7000*GeV, 1E-3)){
00113         hf.divide(dir + "/d07-x01-y02",*_h_dNLambda_dpT, *_h_dNKshort_dpT);
00114         hf.divide(dir + "/d08-x01-y02",*_h_dNXi_dpT, *_h_dNLambda_dpT);
00115         hf.divide(dir + "/d09-x01-y02",*_h_dNLambda_dy, *_h_dNKshort_dy);
00116         hf.divide(dir + "/d10-x01-y02",*_h_dNXi_dy, *_h_dNLambda_dy);
00117       }
00118 
00119       double normpT = 1.0/_Nevt_after_cuts;
00120       double normy = 0.5*normpT; // Accounts for using |y| instead of y
00121       scale(_h_dNKshort_dy, normy);
00122       scale(_h_dNKshort_dpT, normpT);
00123       scale(_h_dNLambda_dy, normy);
00124       scale(_h_dNLambda_dpT, normpT);
00125       scale(_h_dNXi_dy, normy);
00126       scale(_h_dNXi_dpT, normpT);
00127 
00128       return;
00129     }
00130 
00131 
00132   private:
00133 
00134   double _Nevt_after_cuts;
00135 
00136     // Particle distributions versus rapidity and transverse momentum
00137     AIDA::IHistogram1D *_h_dNKshort_dy;
00138     AIDA::IHistogram1D *_h_dNKshort_dpT;
00139     AIDA::IHistogram1D *_h_dNLambda_dy;
00140     AIDA::IHistogram1D *_h_dNLambda_dpT;
00141     AIDA::IHistogram1D *_h_dNXi_dy;
00142     AIDA::IHistogram1D *_h_dNXi_dpT;
00143 
00144   };
00145 
00146 
00147   // This global object acts as a hook for the plugin system
00148   AnalysisBuilder<CMS_2011_S8978280> plugin_CMS_2011_S8978280;
00149 
00150 
00151 }