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