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 FastJets& fjs = applyProjection<FastJets>(event, "Jets");
00048       const Jets& jets = fjs.jets(Cuts::ptIn(_ptedges.front()*GeV, _ptedges.back()*GeV) && Cuts::absrap < 0.7);
00049       if (jets.size() == 0) {
00050         MSG_DEBUG("No jets found in required pT range");
00051         vetoEvent;
00052       }
00053 
00054       // Filter to just get a vector of b-jets
00055       Jets bjets;
00056       foreach (const Jet& j, jets) {
00057         if (j.bTagged()) bjets += j;
00058       }
00059       if (bjets.empty())  {
00060         MSG_DEBUG("No b-jet axes in acceptance");
00061         vetoEvent;
00062       }
00063 
00064       // Bin b-jets in pT
00065       Jets bjets_ptbinned[4];
00066       foreach (const Jet& bj, bjets) {
00067         const FourMomentum pbj = bj.momentum();
00068         const int ipt = binIndex(pbj.pT(), _ptedges);
00069         if (ipt == -1) continue; ///< Out of pT range (somehow!)
00070         bjets_ptbinned[ipt] += bj;
00071       }
00072 
00073       // Loop over jet pT bins and fill shape profiles
00074       const double weight = event.weight();
00075       for (size_t ipt = 0; ipt < 4; ++ipt) {
00076         if (bjets_ptbinned[ipt].empty()) continue;
00077         // Don't use the cached result: copy construct and calculate for provided b-jets only
00078         JetShape jsipt = applyProjection<JetShape>(event, _jsnames_pT[ipt]);
00079         jsipt.calc(bjets_ptbinned[ipt]);
00080         for (size_t ijet = 0; ijet < jsipt.numJets(); ++ijet) {
00081           for (size_t rbin = 0; rbin < jsipt.numBins(); ++rbin) {
00082             const double r_Psi = jsipt.rBinMax(rbin);
00083             _h_Psi_pT[ipt]->fill(r_Psi/0.7, jsipt.intJetShape(ijet, rbin), weight);
00084           }
00085         }
00086       }
00087 
00088     }
00089 
00090 
00091     /// Finalize
00092     void finalize() {
00093 
00094       // Construct final 1-Psi(0.3/0.7) profile from Psi profiles
00095       for (size_t i = 0; i < _ptedges.size()-1; ++i) {
00096         // Get entry for rad_Psi = 0.2 bin
00097         Profile1DPtr ph_i = _h_Psi_pT[i];
00098         const double ex = 0.5*(_ptedges[i+1] - _ptedges[i]);
00099         const double x  = _ptedges[i] + ex;
00100         const double y  = 1.0 - ph_i->bin(1).mean();
00101         const double ey = ph_i->bin(1).stdErr();
00102         _h_OneMinusPsi_vs_pT->addPoint(x, y, ex, ey);
00103       }
00104 
00105     }
00106 
00107     //@}
00108 
00109 
00110   private:
00111 
00112     /// @name Analysis data
00113     //@{
00114 
00115     /// Jet \f$ p_\perp\f$ bins.
00116     vector<double> _ptedges; // This can't be a raw array if we want to initialise it non-painfully
00117 
00118     /// JetShape projection name for each \f$p_\perp\f$ bin.
00119     string _jsnames_pT[4];
00120 
00121     //@}
00122 
00123 
00124     /// @name Histograms
00125     //@{
00126     Profile1DPtr _h_Psi_pT[4];
00127     Scatter2DPtr _h_OneMinusPsi_vs_pT;
00128     //@}
00129 
00130   };
00131 
00132 
00133 
00134   // The hook for the plugin system
00135   DECLARE_RIVET_PLUGIN(CDF_2008_S7782535);
00136 
00137 }