rivet is hosted by Hepforge, IPPP Durham
CDF_2008_S7782535.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetYODA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Tools/ParticleIdUtils.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/FastJets.hh"
00008 #include "Rivet/Projections/JetShape.hh"
00009 
00010 namespace Rivet {
00011 
00012 
00013   /// @brief CDF Run II b-jet shape paper
00014   class CDF_2008_S7782535 : public Analysis {
00015   public:
00016 
00017     /// Constructor
00018     CDF_2008_S7782535() : Analysis("CDF_2008_S7782535")
00019     {
00020     }
00021 
00022 
00023     /// @name Analysis methods
00024     //@{
00025 
00026     void init() {
00027       // Set up projections
00028       const FinalState fs(-3.6, 3.6);
00029       addProjection(fs, "FS");
00030       FastJets jetproj(fs, FastJets::CDFMIDPOINT, 0.7);
00031       jetproj.useInvisibles();
00032       addProjection(jetproj, "Jets");
00033 
00034       // Book histograms and corresponding jet shape projections
00035       _ptedges += 52, 80, 104, 142, 300;
00036       for (size_t i = 0; i < 4; ++i) {
00037         stringstream ss; ss << "JetShape" << i;
00038         const string pname = ss.str();
00039         _jsnames_pT[i] = pname;
00040         const JetShape jsp(jetproj, 0.0, 0.7, 7, _ptedges[i], _ptedges[i+1], 0.0, 0.7, RAPIDITY);
00041         addProjection(jsp, pname);
00042         _h_Psi_pT[i] = bookProfile1D(i+1, 2, 1);
00043       }
00044       _h_OneMinusPsi_vs_pT = bookScatter2D(5, 1, 1);
00045     }
00046 
00047 
00048     // Do the analysis
00049     void analyze(const Event& event) {
00050       const Jets& jets = applyProjection<FastJets>(event, "Jets").jets(_ptedges.front()*GeV, _ptedges.back()*GeV,
00051                                                                        0.0, 0.7, RAPIDITY);
00052       MSG_DEBUG("Jet multiplicity before any pT cut = " << jets.size());
00053       if (jets.size() == 0) {
00054         MSG_DEBUG("No jets found in required pT range");
00055         vetoEvent;
00056       }
00057 
00058       // Filter to just get a vector of b-jets
00059       Jets bjets;
00060       foreach (const Jet& j, jets) {
00061         if (j.containsBottom()) bjets += j;
00062       }
00063       if (bjets.empty())  {
00064         MSG_DEBUG("No b-jet axes in acceptance");
00065         vetoEvent;
00066       }
00067 
00068       // Bin b-jets in pT
00069       Jets bjets_ptbinned[4];
00070       foreach (const Jet& bj, bjets) {
00071         const FourMomentum pbj = bj.momentum();
00072         const int ipt = index_between(pbj.pT(), _ptedges);
00073         if (ipt == -1) continue; //< Out of pT range (somehow!)
00074         bjets_ptbinned[ipt] += bj;
00075       }
00076 
00077       // Loop over jet pT bins and fill shape profiles
00078       const double weight = event.weight();
00079       for (size_t ipt = 0; ipt < 4; ++ipt) {
00080         if (bjets_ptbinned[ipt].empty()) continue;
00081         // Don't use the cached result: copy construct and calculate for provided b-jets only
00082         JetShape jsipt = applyProjection<JetShape>(event, _jsnames_pT[ipt]);
00083         jsipt.calc(bjets_ptbinned[ipt]);
00084         for (size_t ijet = 0; ijet < jsipt.numJets(); ++ijet) {
00085           for (size_t rbin = 0; rbin < jsipt.numBins(); ++rbin) {
00086             const double r_Psi = jsipt.rBinMax(rbin);
00087             _h_Psi_pT[ipt]->fill(r_Psi/0.7, jsipt.intJetShape(ijet, rbin), weight);
00088           }
00089         }
00090       }
00091 
00092     }
00093 
00094 
00095     /// Finalize
00096     void finalize() {
00097 
00098       // Construct final 1-Psi(0.3/0.7) profile from Psi profiles
00099       for (size_t i = 0; i < _ptedges.size()-1; ++i) {
00100         // Get entry for rad_Psi = 0.2 bin
00101         Profile1DPtr ph_i = _h_Psi_pT[i];
00102         const double ex = 0.5*(_ptedges[i+1] - _ptedges[i]);
00103         const double x  = _ptedges[i] + ex;
00104         const double y  = 1.0 - ph_i->bin(1).mean();
00105         const double ey = ph_i->bin(1).stdErr();
00106         _h_OneMinusPsi_vs_pT->addPoint(x, y, ex, ey);
00107       }
00108 
00109     }
00110 
00111     //@}
00112 
00113 
00114   private:
00115 
00116     /// @name Analysis data
00117     //@{
00118 
00119     /// Jet \f$ p_\perp\f$ bins.
00120     vector<double> _ptedges; // This can't be a raw array if we want to initialise it non-painfully
00121 
00122     /// JetShape projection name for each \f$p_\perp\f$ bin.
00123     string _jsnames_pT[4];
00124 
00125     //@}
00126 
00127 
00128     /// @name Histograms
00129     //@{
00130     Profile1DPtr _h_Psi_pT[4];
00131     Scatter2DPtr _h_OneMinusPsi_vs_pT;
00132     //@}
00133 
00134   };
00135 
00136 
00137 
00138   // The hook for the plugin system
00139   DECLARE_RIVET_PLUGIN(CDF_2008_S7782535);
00140 
00141 }