CDF_2005_S6217184.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.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       setBeams(PROTON, ANTIPROTON);
00023     }
00024 
00025 
00026     /// @name Analysis methods
00027     //@{
00028 
00029     void init() {
00030       // Set up projections
00031       const FinalState fs(-2.0, 2.0);
00032       addProjection(fs, "FS");
00033       FastJets fj(fs, FastJets::CDFMIDPOINT, 0.7);
00034       fj.useInvisibles();
00035       addProjection(fj, "Jets");
00036 
00037       // Specify pT bins
00038       _ptedges += 37.0, 45.0, 55.0, 63.0, 73.0, 84.0, 97.0, 112.0, 128.0,
00039         148.0, 166.0, 186.0, 208.0, 229.0, 250.0, 277.0, 304.0, 340.0, 380.0;
00040 
00041       // Register a jet shape projection and histogram for each pT bin
00042       for (size_t i = 0; i < 6; ++i) {
00043         for (size_t j = 0; j < 3; ++j) {
00044           const size_t k = i*3 + j;
00045           stringstream ss; ss << "JetShape" << k;
00046           const string pname = ss.str();
00047           _jsnames_pT[k] = pname;
00048           const JetShape jsp(fj, 0.0, 0.7, 7, _ptedges[k], _ptedges[k+1], 0.1, 0.7, RAPIDITY);
00049           addProjection(jsp, pname);
00050           _profhistRho_pT[k] = bookProfile1D(i+1, 1, j+1);
00051           _profhistPsi_pT[k] = bookProfile1D(6+i+1, 1, j+1);
00052         }
00053       }
00054 
00055       // Final histo
00056       _profhistPsi_vs_pT = bookDataPointSet(13, 1, 1);
00057     }
00058 
00059 
00060 
00061     /// Do the analysis
00062     void analyze(const Event& evt) {
00063 
00064       // Get jets and require at least one to pass pT and y cuts
00065       const Jets jets = applyProjection<FastJets>(evt, "Jets").jetsByPt(_ptedges.front()*GeV, _ptedges.back()*GeV,
00066                                                                         -0.7, 0.7, RAPIDITY);
00067       MSG_DEBUG("Jet multiplicity before cuts = " << jets.size());
00068       if (jets.size() == 0) {
00069         MSG_DEBUG("No jets found in required pT & rapidity range");
00070         vetoEvent;
00071       }
00072 
00073       // Calculate and histogram jet shapes
00074       const double weight = evt.weight();
00075 
00076       for (size_t ipt = 0; ipt < 18; ++ipt) {
00077         const JetShape& jsipt = applyProjection<JetShape>(evt, _jsnames_pT[ipt]);
00078         for (size_t ijet = 0; ijet < jsipt.numJets(); ++ijet) {
00079           for (size_t rbin = 0; rbin < jsipt.numBins(); ++rbin) {
00080             const double r_rho = jsipt.rBinMid(rbin);
00081             // cout << ipt << " " << rbin << " (" << r_rho << ") " << jsipt.diffJetShape(ijet, rbin) << endl;
00082             /// Bin width Jacobian factor of 0.7/0.1 = 7 in the differential shapes plot
00083             _profhistRho_pT[ipt]->fill(r_rho/0.7, (0.7/0.1)*jsipt.diffJetShape(ijet, rbin), weight);
00084             const double r_Psi = jsipt.rBinMax(rbin);
00085             _profhistPsi_pT[ipt]->fill(r_Psi/0.7, jsipt.intJetShape(ijet, rbin), weight);
00086           }
00087         }
00088       }
00089 
00090     }
00091 
00092 
00093     // Finalize
00094     void finalize() {
00095 
00096       // Construct final 1-Psi(0.3/0.7) profile from Psi profiles
00097       vector<double> y, ey;
00098       for (size_t i = 0; i < _ptedges.size()-1; ++i) {
00099         // Get entry for rad_Psi = 0.2 bin
00100         AIDA::IProfile1D* ph_i = _profhistPsi_pT[i];
00101         y.push_back(ph_i->binHeight(2));
00102         ey.push_back(ph_i->binError(1));
00103       }
00104       _profhistPsi_vs_pT->setCoordinate(1, y, 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     AIDA::IProfile1D* _profhistRho_pT[18];
00128     AIDA::IProfile1D* _profhistPsi_pT[18];
00129     AIDA::IDataPointSet* _profhistPsi_vs_pT;
00130     //@}
00131 
00132   };
00133 
00134 
00135   // This global object acts as a hook for the plugin system
00136   AnalysisBuilder<CDF_2005_S6217184> plugin_CDF_2005_S6217184;
00137 
00138 }