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