rivet is hosted by Hepforge, IPPP Durham
CMS_2014_I1298810.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FinalState.hh"
00004 #include "Rivet/Projections/FastJets.hh"
00005 
00006 namespace Rivet {
00007 
00008 
00009   /// Ratios of jet pT spectra, related to ratios of differential jet cross sections
00010   class CMS_2014_I1298810 : public Analysis {
00011   public:
00012 
00013     /// Constructor
00014     CMS_2014_I1298810()
00015       : Analysis("CMS_2014_I1298810")
00016     {    }
00017 
00018 
00019     /// @name Analysis methods
00020     //@{
00021 
00022     void init() {
00023       // Projections
00024       FastJets jetsak5(FinalState(), FastJets::ANTIKT, 0.5);
00025       addProjection(jetsak5, "JetsAK5");
00026       FastJets jetsak7(FinalState(), FastJets::ANTIKT, 0.7);
00027       addProjection(jetsak7, "JetsAK7");
00028 
00029       // Histograms
00030       _h_pt_05_ak5    = bookHisto1D(1, 1, 1);
00031       _h_pt_05_10_ak5 = bookHisto1D(2, 1, 1);
00032       _h_pt_10_15_ak5 = bookHisto1D(3, 1, 1);
00033       _h_pt_15_20_ak5 = bookHisto1D(4, 1, 1);
00034       _h_pt_20_25_ak5 = bookHisto1D(5, 1, 1);
00035       _h_pt_25_30_ak5 = bookHisto1D(6, 1, 1);
00036 
00037       _h_pt_05_ak7    = bookHisto1D(7, 1, 1);
00038       _h_pt_05_10_ak7 = bookHisto1D(8, 1, 1);
00039       _h_pt_10_15_ak7 = bookHisto1D(9, 1, 1);
00040       _h_pt_15_20_ak7 = bookHisto1D(10, 1, 1);
00041       _h_pt_20_25_ak7 = bookHisto1D(11, 1, 1);
00042       _h_pt_25_30_ak7 = bookHisto1D(12, 1, 1);
00043 
00044       _h_pt_05_ratio    = bookScatter2D(13, 1, 1);
00045       _h_pt_05_10_ratio = bookScatter2D(14, 1, 1);
00046       _h_pt_10_15_ratio = bookScatter2D(15, 1, 1);
00047       _h_pt_15_20_ratio = bookScatter2D(16, 1, 1);
00048       _h_pt_20_25_ratio = bookScatter2D(17, 1, 1);
00049       _h_pt_25_30_ratio = bookScatter2D(18, 1, 1);
00050     }
00051 
00052 
00053     /// Perform the per-event analysis
00054     void analyze(const Event& event) {
00055 
00056       const Jets& jetsak5 = applyProjection<FastJets>(event, "JetsAK5").jetsByPt(56*GeV);
00057       const Jets& jetsak7 = applyProjection<FastJets>(event, "JetsAK7").jetsByPt(56*GeV);
00058       if (jetsak5.size() < 1 && jetsak7.size() < 1) vetoEvent;
00059 
00060       const double weight = event.weight();
00061 
00062       // Filling R = 0.5 jets
00063       foreach(const Jet& jet, jetsak5) {
00064         if (jet.absrapidity() < 0.5) {
00065           _h_pt_05_ak5->fill(jet.pT()/GeV, weight);
00066         } else if (jet.absrapidity() < 1.0) {
00067           _h_pt_05_10_ak5->fill(jet.pT()/GeV, weight);
00068         } else if (jet.absrapidity() < 1.5) {
00069           _h_pt_10_15_ak5->fill(jet.pT()/GeV, weight);
00070         } else if (jet.absrapidity() < 2.0) {
00071           _h_pt_15_20_ak5->fill(jet.pT()/GeV, weight);
00072         } else if (jet.absrapidity() < 2.5) {
00073           _h_pt_20_25_ak5->fill(jet.pT()/GeV, weight);
00074         } else if (jet.absrapidity() < 3.0) {
00075           _h_pt_25_30_ak5->fill(jet.pT()/GeV, weight);
00076         }
00077       }
00078 
00079 
00080       // Filling R = 0.7 jets
00081       foreach(const Jet& jet, jetsak7) {
00082         if (jet.absrapidity() < 0.5) {
00083           _h_pt_05_ak7->fill(jet.pT() * GeV, weight);
00084         } else if (jet.absrapidity() < 1.0) {
00085           _h_pt_05_10_ak7->fill(jet.pT() * GeV, weight);
00086         } else if (jet.absrapidity() < 1.5) {
00087           _h_pt_10_15_ak7->fill(jet.pT() * GeV, weight);
00088         } else if (jet.absrapidity() < 2.0) {
00089           _h_pt_15_20_ak7->fill(jet.pT() * GeV, weight);
00090         } else if (jet.absrapidity() < 2.5) {
00091           _h_pt_20_25_ak7->fill(jet.pT() * GeV, weight);
00092         } else if (jet.absrapidity() < 3.0) {
00093           _h_pt_25_30_ak7->fill(jet.pT() * GeV, weight);
00094         }
00095       }
00096 
00097     }
00098 
00099 
00100     /// Normalise histograms etc., after the run
00101     void finalize() {
00102       scale(_h_pt_05_ak5,    crossSection()/sumOfWeights());
00103       scale(_h_pt_05_10_ak5, crossSection()/sumOfWeights());
00104       scale(_h_pt_10_15_ak5, crossSection()/sumOfWeights());
00105       scale(_h_pt_15_20_ak5, crossSection()/sumOfWeights());
00106       scale(_h_pt_20_25_ak5, crossSection()/sumOfWeights());
00107       scale(_h_pt_25_30_ak5, crossSection()/sumOfWeights());
00108 
00109       scale(_h_pt_05_ak7,    crossSection()/sumOfWeights());
00110       scale(_h_pt_05_10_ak7, crossSection()/sumOfWeights());
00111       scale(_h_pt_10_15_ak7, crossSection()/sumOfWeights());
00112       scale(_h_pt_15_20_ak7, crossSection()/sumOfWeights());
00113       scale(_h_pt_20_25_ak7, crossSection()/sumOfWeights());
00114       scale(_h_pt_25_30_ak7, crossSection()/sumOfWeights());
00115 
00116       divide(_h_pt_05_ak5,    _h_pt_05_ak7,    _h_pt_05_ratio);
00117       divide(_h_pt_05_10_ak5, _h_pt_05_10_ak7, _h_pt_05_10_ratio);
00118       divide(_h_pt_10_15_ak5, _h_pt_10_15_ak7, _h_pt_10_15_ratio);
00119       divide(_h_pt_15_20_ak5, _h_pt_15_20_ak7, _h_pt_15_20_ratio);
00120       divide(_h_pt_20_25_ak5, _h_pt_20_25_ak7, _h_pt_20_25_ratio);
00121       divide(_h_pt_25_30_ak5, _h_pt_25_30_ak7, _h_pt_25_30_ratio);
00122     }
00123 
00124     //@}
00125 
00126 
00127   private:
00128 
00129     /// @name Histograms
00130     //@{
00131     Histo1DPtr _h_pt_05_ak5, _h_pt_05_10_ak5, _h_pt_10_15_ak5, _h_pt_15_20_ak5, _h_pt_20_25_ak5, _h_pt_25_30_ak5;
00132     Histo1DPtr _h_pt_05_ak7, _h_pt_05_10_ak7, _h_pt_10_15_ak7, _h_pt_15_20_ak7, _h_pt_20_25_ak7, _h_pt_25_30_ak7;
00133     Scatter2DPtr _h_pt_05_ratio, _h_pt_05_10_ratio, _h_pt_10_15_ratio, _h_pt_15_20_ratio, _h_pt_20_25_ratio, _h_pt_25_30_ratio;
00134     //@}
00135 
00136   };
00137 
00138 
00139   // The hook for the plugin system
00140   DECLARE_RIVET_PLUGIN(CMS_2014_I1298810);
00141 
00142 }