CDF_2008_S7782535.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/Tools/ParticleIdUtils.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/FastJets.hh"
00008 #include "Rivet/Projections/JetShape.hh"
00009 
00010 namespace Rivet {
00011 
00012 
00013   /// @brief CDF Run II b-jet shape paper
00014   class CDF_2008_S7782535 : public Analysis {
00015   public:
00016 
00017     /// Constructor
00018     CDF_2008_S7782535() : Analysis("CDF_2008_S7782535")
00019     {
00020       setBeams(PROTON, ANTIPROTON);
00021     }
00022 
00023 
00024     /// @name Analysis methods
00025     //@{
00026 
00027     void init() {
00028       // Set up projections
00029       const FinalState fs(-3.6, 3.6);
00030       addProjection(fs, "FS");
00031       FastJets jetproj(fs, FastJets::CDFMIDPOINT, 0.7);
00032       jetproj.useInvisibles();
00033       addProjection(jetproj, "Jets");
00034 
00035       // Book histograms and corresponding jet shape projections
00036       _ptedges += 52, 80, 104, 142, 300;
00037       for (size_t i = 0; i < 4; ++i) {
00038         stringstream ss; ss << "JetShape" << i;
00039         const string pname = ss.str();
00040         _jsnames_pT[i] = pname;
00041         const JetShape jsp(jetproj, 0.0, 0.7, 7, _ptedges[i], _ptedges[i+1], 0.0, 0.7, RAPIDITY);
00042         addProjection(jsp, pname);
00043         _h_Psi_pT[i] = bookProfile1D(i+1, 2, 1);
00044       }
00045       _h_OneMinusPsi_vs_pT = bookDataPointSet(5, 1, 1);
00046     }
00047 
00048 
00049     // Do the analysis
00050     void analyze(const Event& event) {
00051       const Jets& jets = applyProjection<FastJets>(event, "Jets").jets(_ptedges.front()*GeV, _ptedges.back()*GeV,
00052                                                                        0.0, 0.7, RAPIDITY);
00053       getLog() << Log::DEBUG << "Jet multiplicity before any pT cut = " << jets.size() << endl;
00054       if (jets.size() == 0) {
00055         MSG_DEBUG("No jets found in required pT range");
00056         vetoEvent;
00057       }
00058 
00059       // Filter to just get a vector of b-jets
00060       Jets bjets;
00061       foreach (const Jet& j, jets) {
00062         if (j.containsBottom()) bjets += j;
00063       }
00064       if (bjets.empty())  {
00065         MSG_DEBUG("No b-jet axes in acceptance");
00066         vetoEvent;
00067       }
00068 
00069       // Bin b-jets in pT
00070       Jets bjets_ptbinned[4];
00071       foreach (const Jet& bj, bjets) {
00072         const FourMomentum pbj = bj.momentum();
00073         const int ipt = index_between(pbj.pT(), _ptedges);
00074         if (ipt == -1) continue; //< Out of pT range (somehow!)
00075         bjets_ptbinned[ipt] += bj;
00076       }
00077 
00078       // Loop over jet pT bins and fill shape profiles
00079       const double weight = event.weight();
00080       for (size_t ipt = 0; ipt < 4; ++ipt) {
00081         if (bjets_ptbinned[ipt].empty()) continue;
00082         // Don't use the cached result: copy construct and calculate for provided b-jets only
00083         JetShape jsipt = applyProjection<JetShape>(event, _jsnames_pT[ipt]);
00084         jsipt.calc(bjets_ptbinned[ipt]);
00085         for (size_t ijet = 0; ijet < jsipt.numJets(); ++ijet) {
00086           for (size_t rbin = 0; rbin < jsipt.numBins(); ++rbin) {
00087             const double r_Psi = jsipt.rBinMax(rbin);
00088             _h_Psi_pT[ipt]->fill(r_Psi/0.7, jsipt.intJetShape(ijet, rbin), weight);
00089           }
00090         }
00091       }
00092 
00093     }
00094 
00095 
00096     /// Finalize
00097     void finalize() {
00098 
00099       // Construct final 1-Psi(0.3/0.7) profile from Psi profiles
00100       vector<double> y, ey;
00101       for (size_t i = 0; i < _ptedges.size()-1; ++i) {
00102         // Get entry for rad_Psi = 0.2 bin
00103         AIDA::IProfile1D* ph_i = _h_Psi_pT[i];
00104         y.push_back(1.0 - ph_i->binHeight(1));
00105         ey.push_back(ph_i->binError(1));
00106       }
00107       _h_OneMinusPsi_vs_pT->setCoordinate(1, y, ey);
00108 
00109     }
00110 
00111     //@}
00112 
00113 
00114   private:
00115 
00116     /// @name Analysis data
00117     //@{
00118 
00119     /// Jet \f$ p_\perp\f$ bins.
00120     vector<double> _ptedges; // This can't be a raw array if we want to initialise it non-painfully
00121 
00122     /// JetShape projection name for each \f$p_\perp\f$ bin.
00123     string _jsnames_pT[4];
00124 
00125     //@}
00126 
00127 
00128     /// @name Histograms
00129     //@{
00130     AIDA::IProfile1D* _h_Psi_pT[4];
00131     AIDA::IDataPointSet* _h_OneMinusPsi_vs_pT;
00132     //@}
00133 
00134   };
00135 
00136 
00137   // This global object acts as a hook for the plugin system
00138   AnalysisBuilder<CDF_2008_S7782535> plugin_CDF_2008_S7782535;
00139 
00140 }