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/RivetYODA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/FastJets.hh"
00006 #include "Rivet/Projections/VetoedFinalState.hh"
00007 #include "Rivet/Projections/VisibleFinalState.hh"
00008 #include "Rivet/Projections/JetShape.hh"
00009 
00010 namespace Rivet {
00011 
00012 
00013   /// @brief CDF Run II jet shape analysis
00014   /// @author Andy Buckley
00015   class CDF_2005_S6217184 : public Analysis {
00016   public:
00017 
00018     /// Constructor
00019     CDF_2005_S6217184()
00020       : Analysis("CDF_2005_S6217184")
00021     {
00022     }
00023 
00024 
00025     /// @name Analysis methods
00026     //@{
00027 
00028     void init() {
00029       // Set up projections
00030       const FinalState fs(-2.0, 2.0);
00031       addProjection(fs, "FS");
00032       FastJets fj(fs, FastJets::CDFMIDPOINT, 0.7);
00033       fj.useInvisibles();
00034       addProjection(fj, "Jets");
00035 
00036       // Specify pT bins
00037       _ptedges += 37.0, 45.0, 55.0, 63.0, 73.0, 84.0, 97.0, 112.0, 128.0,
00038         148.0, 166.0, 186.0, 208.0, 229.0, 250.0, 277.0, 304.0, 340.0, 380.0;
00039 
00040       // Register a jet shape projection and histogram for each pT bin
00041       for (size_t i = 0; i < 6; ++i) {
00042         for (size_t j = 0; j < 3; ++j) {
00043           const size_t k = i*3 + j;
00044           stringstream ss; ss << "JetShape" << k;
00045           const string pname = ss.str();
00046           _jsnames_pT[k] = pname;
00047           const JetShape jsp(fj, 0.0, 0.7, 7, _ptedges[k], _ptedges[k+1], 0.1, 0.7, RAPIDITY);
00048           addProjection(jsp, pname);
00049           _profhistRho_pT[k] = bookProfile1D(i+1, 1, j+1);
00050           _profhistPsi_pT[k] = bookProfile1D(6+i+1, 1, j+1);
00051         }
00052       }
00053 
00054       // Final histo
00055       _profhistPsi_vs_pT = bookScatter2D(13, 1, 1);
00056     }
00057 
00058 
00059 
00060     /// Do the analysis
00061     void analyze(const Event& evt) {
00062 
00063       // Get jets and require at least one to pass pT and y cuts
00064       const Jets jets = applyProjection<FastJets>(evt, "Jets").jetsByPt(_ptedges.front()*GeV, _ptedges.back()*GeV,
00065                                                                         -0.7, 0.7, RAPIDITY);
00066       MSG_DEBUG("Jet multiplicity before cuts = " << jets.size());
00067       if (jets.size() == 0) {
00068         MSG_DEBUG("No jets found in required pT & rapidity range");
00069         vetoEvent;
00070       }
00071 
00072       // Calculate and histogram jet shapes
00073       const double weight = evt.weight();
00074 
00075       for (size_t ipt = 0; ipt < 18; ++ipt) {
00076         const JetShape& jsipt = applyProjection<JetShape>(evt, _jsnames_pT[ipt]);
00077         for (size_t ijet = 0; ijet < jsipt.numJets(); ++ijet) {
00078           for (size_t rbin = 0; rbin < jsipt.numBins(); ++rbin) {
00079             const double r_rho = jsipt.rBinMid(rbin);
00080             MSG_DEBUG(ipt << " " << rbin << " (" << r_rho << ") " << jsipt.diffJetShape(ijet, rbin));
00081             /// Bin width Jacobian factor of 0.7/0.1 = 7 in the differential shapes plot
00082             _profhistRho_pT[ipt]->fill(r_rho/0.7, (0.7/0.1)*jsipt.diffJetShape(ijet, rbin), weight);
00083             const double r_Psi = jsipt.rBinMax(rbin);
00084             _profhistPsi_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       vector<Point2D> points;
00097       for (size_t i = 0; i < _ptedges.size()-1; ++i) {
00098         // Get entry for rad_Psi = 0.2 bin
00099         Profile1DPtr ph_i = _profhistPsi_pT[i];
00100         const double ex = 0.5*(_ptedges[i+1] - _ptedges[i]);
00101         const double x  = _ptedges[i] + ex;
00102         const double y  = ph_i->bin(2).mean();
00103         const double ey = ph_i->bin(2).stdErr();
00104         _profhistPsi_vs_pT->addPoint(x, y, ex, ey);
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[18];
00121 
00122     //@}
00123 
00124 
00125     /// @name Histograms
00126     //@{
00127     Profile1DPtr _profhistRho_pT[18];
00128     Profile1DPtr _profhistPsi_pT[18];
00129     Scatter2DPtr _profhistPsi_vs_pT;
00130     //@}
00131 
00132   };
00133 
00134 
00135 
00136   // The hook for the plugin system
00137   DECLARE_RIVET_PLUGIN(CDF_2005_S6217184);
00138 
00139 }