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 = applyProjection<FastJets>(e, m_jetpro_name);
00041 
00042     // Jet resolutions and integrated jet rates
00043     const fastjet::ClusterSequence* seq = jetpro.clusterSeq();
00044     if (seq != NULL) {
00045       double previous_dij = 10.0;
00046       for (size_t i = 0; i < min(m_njet,(size_t)seq->n_particles()); ++i) {
00047         double d_ij2 = seq->exclusive_dmerge_max(i);
00048         if (d_ij2>0.0) {
00049           // Jet resolution i -> j
00050           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       }
00065       // One remaining integrated jet resolution
00066       for (size_t ibin = 0; ibin<_h_log10_R[m_njet]->numPoints(); ++ibin) {
00067         Point2D & dp = _h_log10_R[m_njet]->point(ibin);
00068         if (dp.x() < previous_dij) {
00069           dp.setY(dp.y() + weight);
00070         }
00071       }
00072     }
00073 
00074   }
00075 
00076 
00077   // Finalize
00078   void MC_JetSplittings::finalize() {
00079     const double xsec_unitw = crossSection()/picobarn/sumOfWeights();
00080     for (size_t i = 0; i < m_njet; ++i) {
00081       scale(_h_log10_d[i], xsec_unitw);
00082       for (size_t ibin = 0; ibin<_h_log10_R[i]->numPoints(); ++ibin) {
00083         Point2D& dp = _h_log10_R[i]->point(ibin);
00084         dp.setY(dp.y()*xsec_unitw);
00085       }
00086     }
00087 
00088     for (size_t ibin = 0; ibin < _h_log10_R[m_njet]->numPoints(); ++ibin) {
00089       Point2D& dp =_h_log10_R[m_njet]->point(ibin);
00090       dp.setY(dp.y()*xsec_unitw);
00091     }
00092   }
00093 
00094 
00095 }