rivet is hosted by Hepforge, IPPP Durham
MC_JetSplittings.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analyses/MC_JetSplittings.hh"
00003 #include "Rivet/Projections/FastJets.hh"
00004 
00005 namespace Rivet {
00006 
00007   using namespace Cuts;
00008 
00009 
00010   MC_JetSplittings::MC_JetSplittings(const string& name,
00011                                      size_t njet,
00012                                      const string& jetpro_name)
00013     : Analysis(name), m_njet(njet), m_jetpro_name(jetpro_name),
00014       _h_log10_d(njet), _h_log10_R(njet+1)
00015   {
00016     setNeedsCrossSection(true); // legitimate use, since a base class has no .info file!
00017   }
00018 
00019 
00020   // Book histograms
00021   void MC_JetSplittings::init() {
00022     for (size_t i = 0; i < m_njet; ++i) {
00023       string dname = "log10_d_" + to_str(i) + to_str(i+1);
00024       _h_log10_d[i] = bookHisto1D(dname, 100, 0.2, log10(0.5*sqrtS()/GeV));
00025       string Rname = "log10_R_" + to_str(i);
00026       _h_log10_R[i] = bookScatter2D(Rname, 50, 0.2, log10(0.5*sqrtS()/GeV));
00027     }
00028     string Rname = "log10_R_" + to_str(m_njet);
00029     _h_log10_R[m_njet] = bookScatter2D(Rname, 50, 0.2, log10(0.5*sqrtS()/GeV));
00030   }
00031 
00032 
00033 
00034   // Do the analysis
00035   void MC_JetSplittings::analyze(const Event & e) {
00036     const double weight = e.weight();
00037 
00038     const FastJets& jetpro = applyProjection<FastJets>(e, m_jetpro_name);
00039 
00040     // Jet resolutions and integrated jet rates
00041     const fastjet::ClusterSequence* seq = jetpro.clusterSeq();
00042     if (seq != NULL) {
00043       double previous_dij = 10.0;
00044       for (size_t i = 0; i < min(m_njet,(size_t)seq->n_particles()); ++i) {
00045         double d_ij2 = seq->exclusive_dmerge_max(i);
00046         if (d_ij2>0.0) {
00047           // Jet resolution i -> j
00048           double d_ij = log10(sqrt(d_ij2));
00049 
00050           // Fill differential jet resolution
00051           _h_log10_d[i]->fill(d_ij, weight);
00052 
00053           // Fill integrated jet resolution
00054           for (size_t ibin = 0; ibin < _h_log10_R[i]->numPoints(); ++ibin) {
00055             Point2D& dp = _h_log10_R[i]->point(ibin);
00056             if (dp.x() > d_ij && dp.x() < previous_dij) {
00057               dp.setY(dp.y() + weight);
00058             }
00059           }
00060           previous_dij = d_ij;
00061         }
00062       }
00063       // One remaining integrated jet resolution
00064       for (size_t ibin = 0; ibin<_h_log10_R[m_njet]->numPoints(); ++ibin) {
00065         Point2D & dp = _h_log10_R[m_njet]->point(ibin);
00066         if (dp.x() < previous_dij) {
00067           dp.setY(dp.y() + weight);
00068         }
00069       }
00070     }
00071 
00072   }
00073 
00074 
00075   // Finalize
00076   void MC_JetSplittings::finalize() {
00077     const double xsec_unitw = crossSection()/picobarn/sumOfWeights();
00078     for (size_t i = 0; i < m_njet; ++i) {
00079       scale(_h_log10_d[i], xsec_unitw);
00080       for (size_t ibin = 0; ibin<_h_log10_R[i]->numPoints(); ++ibin) {
00081         Point2D& dp = _h_log10_R[i]->point(ibin);
00082         dp.setY(dp.y()*xsec_unitw);
00083       }
00084     }
00085 
00086     for (size_t ibin = 0; ibin < _h_log10_R[m_njet]->numPoints(); ++ibin) {
00087       Point2D& dp =_h_log10_R[m_njet]->point(ibin);
00088       dp.setY(dp.y()*xsec_unitw);
00089     }
00090   }
00091 
00092 
00093 }