rivet is hosted by Hepforge, IPPP Durham
CMS_2012_I1184941.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FastJets.hh"
00004 #include "Rivet/Projections/FinalState.hh"
00005 
00006 namespace Rivet {
00007 
00008 
00009   class CMS_2012_I1184941 : public Analysis {
00010   public:
00011 
00012     CMS_2012_I1184941()
00013       : Analysis("CMS_2012_I1184941")
00014     {   }
00015 
00016 
00017     void init() {
00018       FinalState fs;
00019       addProjection(fs, "FS");
00020 
00021       const FastJets jets(FinalState(-4.9, 4.9, 0.0*GeV), FastJets::ANTIKT, 0.5);
00022       addProjection(jets, "AntiKtJets05");
00023 
00024       _h_xi = bookHisto1D(1, 1, 1);
00025     }
00026 
00027 
00028     void analyze(const Event& event) {
00029       double xiM = 0.;
00030       double xiP = 0.;
00031 
00032       const Jets jets = applyProjection<FastJets>(event, "AntiKtJets05").jetsByPt(20.*GeV);
00033       if (jets.size() < 2) vetoEvent;  // require a dijet system with a 20 GeV cut on both jets
00034       if (fabs(jets[0].eta()) > 4.4 || fabs(jets[1].eta()) > 4.4) vetoEvent;
00035 
00036       const FinalState& fsp = applyProjection<FinalState>(event, "FS");
00037 
00038       foreach (const Particle& p, fsp.particles(cmpMomByEta)) {
00039         const double eta = p.eta();
00040         const double energy = p.E();
00041         const double costheta = cos(p.theta());
00042         // Yes, they really correct to +/- infinity, using Pythia 8 ...
00043         if (eta < 4.9)  xiP += (energy + energy*costheta);
00044         if (eta > -4.9 ) xiM += (energy - energy*costheta);
00045       }
00046 
00047       xiP = xiP / (sqrtS()/GeV);
00048       xiM = xiM / (sqrtS()/GeV);
00049 
00050       const double weight = event.weight();
00051       _h_xi->fill( xiM, weight ); // Fill the histogram both with xiP and xiM, and get the average in the endjob.
00052       _h_xi->fill( xiP, weight );
00053     }
00054 
00055 
00056     void finalize() {
00057       scale( _h_xi, crossSection()/microbarn/sumOfWeights() / 2.);
00058     }
00059 
00060 
00061   private:
00062 
00063     Histo1DPtr _h_xi;
00064 
00065   };
00066 
00067   // The hook for the plugin system
00068   DECLARE_RIVET_PLUGIN(CMS_2012_I1184941);
00069 
00070 }