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     }
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 = bookDataPointSet(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<double> y, ey;
00097       for (size_t i = 0; i < _ptedges.size()-1; ++i) {
00098         // Get entry for rad_Psi = 0.2 bin
00099         AIDA::IProfile1D* ph_i = _profhistPsi_pT[i];
00100         y.push_back(ph_i->binHeight(2));
00101         ey.push_back(ph_i->binError(1));
00102       }
00103       _profhistPsi_vs_pT->setCoordinate(1, y, ey);
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[18];
00120 
00121     //@}
00122 
00123 
00124     /// @name Histograms
00125     //@{
00126     AIDA::IProfile1D* _profhistRho_pT[18];
00127     AIDA::IProfile1D* _profhistPsi_pT[18];
00128     AIDA::IDataPointSet* _profhistPsi_vs_pT;
00129     //@}
00130 
00131   };
00132 
00133 
00134 
00135   // The hook for the plugin system
00136   DECLARE_RIVET_PLUGIN(CDF_2005_S6217184);
00137 
00138 }