rivet is hosted by Hepforge, IPPP Durham
CDF_2005_S6217184.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FastJets.hh"
00004 #include "Rivet/Projections/VetoedFinalState.hh"
00005 #include "Rivet/Projections/VisibleFinalState.hh"
00006 #include "Rivet/Projections/JetShape.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief CDF Run II jet shape analysis
00012   /// @author Andy Buckley
00013   class CDF_2005_S6217184 : public Analysis {
00014   public:
00015 
00016     /// Constructor
00017     CDF_2005_S6217184()
00018       : Analysis("CDF_2005_S6217184")
00019     {    }
00020 
00021 
00022     /// @name Analysis methods
00023     //@{
00024 
00025     void init() {
00026       // Set up projections
00027       const FinalState fs(-2.0, 2.0);
00028       addProjection(fs, "FS");
00029       FastJets fj(fs, FastJets::CDFMIDPOINT, 0.7);
00030       fj.useInvisibles();
00031       addProjection(fj, "Jets");
00032 
00033       // Specify pT bins
00034       _ptedges += 37.0, 45.0, 55.0, 63.0, 73.0, 84.0, 97.0, 112.0, 128.0,
00035         148.0, 166.0, 186.0, 208.0, 229.0, 250.0, 277.0, 304.0, 340.0, 380.0;
00036 
00037       // Register a jet shape projection and histogram for each pT bin
00038       for (size_t i = 0; i < 6; ++i) {
00039         for (size_t j = 0; j < 3; ++j) {
00040           const size_t k = i*3 + j;
00041           stringstream ss; ss << "JetShape" << k;
00042           const string pname = ss.str();
00043           _jsnames_pT[k] = pname;
00044           const JetShape jsp(fj, 0.0, 0.7, 7, _ptedges[k], _ptedges[k+1], 0.1, 0.7, RAPIDITY);
00045           addProjection(jsp, pname);
00046           _profhistRho_pT[k] = bookProfile1D(i+1, 1, j+1);
00047           _profhistPsi_pT[k] = bookProfile1D(6+i+1, 1, j+1);
00048         }
00049       }
00050 
00051       // Final histo
00052       _profhistPsi_vs_pT = bookScatter2D(13, 1, 1, true);
00053     }
00054 
00055 
00056 
00057     /// Do the analysis
00058     void analyze(const Event& evt) {
00059 
00060       // Get jets and require at least one to pass pT and y cuts
00061       const Jets jets = applyProjection<FastJets>(evt, "Jets")
00062         .jetsByPt(_ptedges.front()*GeV, _ptedges.back()*GeV, -0.7, 0.7, RAPIDITY);
00063       MSG_DEBUG("Jet multiplicity before cuts = " << jets.size());
00064       if (jets.size() == 0) {
00065         MSG_DEBUG("No jets found in required pT & rapidity range");
00066         vetoEvent;
00067       }
00068 
00069       // Calculate and histogram jet shapes
00070       const double weight = evt.weight();
00071       for (size_t ipt = 0; ipt < 18; ++ipt) {
00072         const JetShape& jsipt = applyProjection<JetShape>(evt, _jsnames_pT[ipt]);
00073         for (size_t ijet = 0; ijet < jsipt.numJets(); ++ijet) {
00074           for (size_t rbin = 0; rbin < jsipt.numBins(); ++rbin) {
00075             const double r_rho = jsipt.rBinMid(rbin);
00076             MSG_DEBUG(ipt << " " << rbin << " (" << r_rho << ") " << jsipt.diffJetShape(ijet, rbin));
00077             /// @note Bin width Jacobian factor of 0.7/0.1 = 7 in the differential shapes plot
00078             _profhistRho_pT[ipt]->fill(r_rho/0.7, (0.7/0.1)*jsipt.diffJetShape(ijet, rbin), weight);
00079             const double r_Psi = jsipt.rBinMax(rbin);
00080             _profhistPsi_pT[ipt]->fill(r_Psi/0.7, jsipt.intJetShape(ijet, rbin), weight);
00081           }
00082         }
00083       }
00084 
00085     }
00086 
00087 
00088     // Finalize
00089     void finalize() {
00090       // Construct final 1-Psi(0.3/0.7) profile from Psi profiles
00091       for (size_t i = 0; i < _ptedges.size()-1; ++i) {
00092         // Get entry for rad_Psi = 0.2 bin
00093         /// @note Not a great handling of empty bins!
00094         Profile1DPtr ph_i = _profhistPsi_pT[i];
00095         const double y  = (ph_i->bin(2).effNumEntries() > 0) ? ph_i->bin(2).mean() : 0;
00096         const double ey = (ph_i->bin(2).effNumEntries() > 1) ? ph_i->bin(2).stdErr() : 0;
00097         _profhistPsi_vs_pT->point(i).setY(y, ey);
00098       }
00099     }
00100 
00101     //@}
00102 
00103 
00104   private:
00105 
00106     /// @name Analysis data
00107     //@{
00108 
00109     /// Jet \f$ p_\perp\f$ bins.
00110     vector<double> _ptedges; // This can't be a raw array if we want to initialise it non-painfully
00111 
00112     /// JetShape projection name for each \f$p_\perp\f$ bin.
00113     string _jsnames_pT[18];
00114 
00115     //@}
00116 
00117 
00118     /// @name Histograms
00119     //@{
00120     Profile1DPtr _profhistRho_pT[18];
00121     Profile1DPtr _profhistPsi_pT[18];
00122     Scatter2DPtr _profhistPsi_vs_pT;
00123     //@}
00124 
00125   };
00126 
00127 
00128 
00129   // The hook for the plugin system
00130   DECLARE_RIVET_PLUGIN(CDF_2005_S6217184);
00131 
00132 }