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 
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     const double sqrts = sqrtS() ? sqrtS() : 14000.*GeV;
00023 
00024     for (size_t i = 0; i < m_njet; ++i) {
00025       string dname = "log10_d_" + to_str(i) + to_str(i+1);
00026       _h_log10_d[i] = bookHisto1D(dname, 100, 0.2, log10(0.5*sqrts/GeV));
00027       string Rname = "log10_R_" + to_str(i);
00028       _h_log10_R[i] = bookScatter2D(Rname, 50, 0.2, log10(0.5*sqrts/GeV));
00029     }
00030     string Rname = "log10_R_" + to_str(m_njet);
00031     _h_log10_R[m_njet] = bookScatter2D(Rname, 50, 0.2, log10(0.5*sqrts/GeV));
00032   }
00033 
00034 
00035 
00036   // Do the analysis
00037   void MC_JetSplittings::analyze(const Event & e) {
00038     const double weight = e.weight();
00039 
00040     const FastJets& jetpro = apply<FastJets>(e, m_jetpro_name);
00041     const auto seq = jetpro.clusterSeq();
00042     if (!seq) vetoEvent; //< the cseq is the whole point in this sort of analysis!!
00043 
00044     // Jet resolutions and integrated jet rates
00045     double previous_dij = 10.0;
00046     for (size_t i = 0; i < min(m_njet,(size_t)seq->n_particles()); ++i) {
00047       const double d_ij2 = seq->exclusive_dmerge_max(i);
00048       if (d_ij2 <= 0) continue; ///< @todo Is < 0 possible? Feels like no; I should check ;-)
00049       // Jet resolution i -> j
00050       const double d_ij = log10(sqrt(d_ij2));
00051 
00052       // Fill differential jet resolution
00053       _h_log10_d[i]->fill(d_ij, weight);
00054 
00055       // Fill integrated jet resolution
00056       for (size_t ibin = 0; ibin < _h_log10_R[i]->numPoints(); ++ibin) {
00057         Point2D& dp = _h_log10_R[i]->point(ibin);
00058         if (dp.x() > d_ij && dp.x() < previous_dij) {
00059           dp.setY(dp.y() + weight);
00060         }
00061       }
00062       previous_dij = d_ij;
00063     }
00064     // One remaining integrated jet resolution
00065     for (size_t ibin = 0; ibin<_h_log10_R[m_njet]->numPoints(); ++ibin) {
00066       Point2D & dp = _h_log10_R[m_njet]->point(ibin);
00067       if (dp.x() < previous_dij) {
00068         dp.setY(dp.y() + weight);
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 }