CMS_2011_S9088458.cc
Go to the documentation of this file.00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/Tools/BinnedHistogram.hh"
00005 #include "Rivet/Projections/FinalState.hh"
00006 #include "Rivet/Projections/FastJets.hh"
00007 #include "Rivet/RivetAIDA.hh"
00008 #include "LWH/Histogram1D.h"
00009
00010 namespace Rivet {
00011
00012
00013
00014 class CMS_2011_S9088458 : public Analysis {
00015 public:
00016
00017 CMS_2011_S9088458() : Analysis("CMS_2011_S9088458") {}
00018
00019
00020 void init() {
00021 FinalState fs;
00022 FastJets akt(fs, FastJets::ANTIKT, 0.5);
00023 addProjection(akt, "antikT");
00024
00025 _h_dijet = bookHistogram1D("dijet", binEdges(1, 1, 1));
00026 _h_trijet = bookHistogram1D("trijet", binEdges(1, 1, 1));
00027 _h_r32 = bookDataPointSet(1, 1, 1);
00028 }
00029
00030
00031 void analyze(const Event & event) {
00032 const double weight = event.weight();
00033
00034 Jets highpT_jets;
00035 double HT = 0;
00036 foreach(const Jet & jet, applyProjection<JetAlg>(event, "antikT").jetsByPt(50.0*GeV)) {
00037 if (fabs(jet.momentum().eta()) < 2.5) {
00038 highpT_jets.push_back(jet);
00039 HT += jet.momentum().pT();
00040 }
00041 }
00042 if (highpT_jets.size() < 2) vetoEvent;
00043
00044 if (highpT_jets.size() >= 2) _h_dijet->fill(HT/TeV, weight) ;
00045 if (highpT_jets.size() >= 3) _h_trijet->fill(HT/TeV, weight) ;
00046 }
00047
00048
00049 void finalize() {
00050 vector<double> yval_R32, yerr_R32;
00051 for (size_t i = 0; i < 30; ++i) {
00052 double yval, yerr;
00053 if (_h_dijet->binHeight(i)==0.0 || _h_trijet->binHeight(i)==0.0) {
00054 yval = 0.0;
00055 yerr = 0.0;
00056 }
00057 else {
00058 yval = _h_trijet->binHeight(i)/_h_dijet->binHeight(i);
00059 yerr = sqrt(_h_dijet->binError(i)*_h_dijet->binError(i)/(_h_dijet->binHeight(i) * _h_dijet->binHeight(i)) +
00060 _h_trijet->binError(i)*_h_trijet->binError(i)/(_h_trijet->binHeight(i) * _h_trijet->binHeight(i))) * yval;
00061 }
00062 yval_R32.push_back(yval);
00063 yerr_R32.push_back(yerr);
00064 }
00065 _h_r32->setCoordinate(1, yval_R32, yerr_R32);
00066 histogramFactory().destroy(_h_dijet);
00067 histogramFactory().destroy(_h_trijet);
00068 }
00069
00070
00071 private:
00072
00073 AIDA::IHistogram1D *_h_dijet, *_h_trijet;
00074 AIDA::IDataPointSet *_h_r32;
00075
00076 };
00077
00078
00079 DECLARE_RIVET_PLUGIN(CMS_2011_S9088458);
00080
00081 }
00082
00083