CDF_2007_S7057202.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Tools/BinnedHistogram.hh"
00004 #include "Rivet/RivetAIDA.hh"
00005 #include "Rivet/Tools/Logging.hh"
00006 #include "Rivet/Projections/FastJets.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief CDF Run II inclusive jet cross-section using the kT algorithm.
00012   /// @author James Monk
00013   class CDF_2007_S7057202 : public Analysis {
00014   public:
00015 
00016     /// Constructor
00017     CDF_2007_S7057202()
00018       : Analysis("CDF_2007_S7057202"),
00019         _minY(0.1), _maxY(0.7), _jetMinPT(54.0*GeV)
00020     {
00021       setBeams(PROTON, ANTIPROTON);
00022       //setSqrtS(1960*GeV);
00023       setNeedsCrossSection(true);
00024     }
00025 
00026  
00027     /// @name Analysis methods
00028     //@{
00029 
00030     /// Book histos and set counters for number of events passed in each one
00031     void init() {
00032       // Set up projections
00033       const FinalState fs;
00034       addProjection(FastJets(fs, FastJets::KT, 0.5), "JetsD05");
00035       addProjection(FastJets(fs, FastJets::KT, 0.7), "JetsD07");
00036       addProjection(FastJets(fs, FastJets::KT, 1.0), "JetsD10");
00037 
00038       // Book histos
00039       _histoD05 = bookHistogram1D(6, 1, 1);
00040       _histoD10 = bookHistogram1D(7, 1, 1);
00041       _binnedHistosD07.addHistogram(  0, 0.1, bookHistogram1D(1, 1, 1));
00042       _binnedHistosD07.addHistogram(0.1, 0.7, bookHistogram1D(2, 1, 1));
00043       _binnedHistosD07.addHistogram(0.7, 1.1, bookHistogram1D(3, 1, 1));
00044       _binnedHistosD07.addHistogram(1.1, 1.6, bookHistogram1D(4, 1, 1));
00045       _binnedHistosD07.addHistogram(1.6, 2.1, bookHistogram1D(5, 1, 1));
00046    
00047       size_t yind = 0;
00048       for (vector<AIDA::IHistogram1D*>::const_iterator histIt = _binnedHistosD07.getHistograms().begin();
00049            histIt != _binnedHistosD07.getHistograms().end(); ++histIt){
00050         _eventsPassed[*histIt] = 0.0;
00051         _yBinWidths[*histIt] = 2.0 * (_ybins[yind+1]-_ybins[yind]);
00052         ++yind;
00053       }
00054       _eventsPassed[_histoD05] = 0.0;
00055       _yBinWidths[_histoD05] = 2.0*(-_ybins[1]+_ybins[2]);
00056       _eventsPassed[_histoD10] = 0.0;
00057       _yBinWidths[_histoD10] = 2.0*(-_ybins[1]+_ybins[2]);
00058     }
00059  
00060  
00061     /// Do the analysis
00062     void analyze(const Event& event) {
00063       const double weight = event.weight();
00064    
00065       const PseudoJets jetListD07 = applyProjection<FastJets>(event, "JetsD07").pseudoJets();
00066       set< IHistogram1D*> passed;
00067       /// @todo Use Jet interface rather than FastJet:PseudoJet
00068       for (PseudoJets::const_iterator jet = jetListD07.begin(); jet != jetListD07.end(); ++jet) {
00069         const double pt = jet->perp();
00070         if (pt > _jetMinPT) {
00071           AIDA::IHistogram1D* histo = _binnedHistosD07.fill(fabs(jet->rapidity()), pt, weight);
00072           if (histo != 0) {
00073             if (histo->coordToIndex(pt) != IAxis::OVERFLOW_BIN) {
00074               passed.insert(histo);
00075               _eventsPassed[histo] += weight;
00076             }
00077           }
00078         }
00079       }
00080    
00081       /// @todo Use Jet interface rather than FastJet:PseudoJet
00082       const PseudoJets jetListD05 = applyProjection<FastJets>(event, "JetsD05").pseudoJets();
00083       for (PseudoJets::const_iterator jet = jetListD05.begin(); jet != jetListD05.end(); ++jet) {
00084         const double pt = jet->perp();
00085         if (pt > _jetMinPT) {
00086           double rap = fabs(jet->rapidity());
00087           if (rap >= _minY && rap < _maxY){
00088             _histoD05->fill(pt, weight);
00089             if (_histoD05->coordToIndex(pt) != IAxis::OVERFLOW_BIN){
00090               passed.insert(_histoD05);
00091               _eventsPassed[_histoD05] += weight;
00092             }
00093           }
00094         }
00095       }
00096    
00097       /// @todo Use Jet interface rather than FastJet:PseudoJet
00098       const PseudoJets jetListD10 = applyProjection<FastJets>(event, "JetsD10").pseudoJets();
00099       for (PseudoJets::const_iterator jet = jetListD10.begin(); jet != jetListD10.end(); ++jet){
00100         const double pt = jet->perp();
00101         if (pt > _jetMinPT) {
00102           double rap = fabs(jet->rapidity());
00103           if (rap >= _minY && rap < _maxY){
00104             _histoD10->fill(pt, weight);
00105             if (_histoD10->coordToIndex(pt) != IAxis::OVERFLOW_BIN){
00106               passed.insert(_histoD10);
00107               _eventsPassed[_histoD10] += weight;
00108             }
00109           }
00110         }
00111       }
00112     }
00113  
00114  
00115     // Normalise histograms to cross-section
00116     void finalize() {
00117       const double xSecPerEvent = crossSectionPerEvent()/nanobarn;
00118       getLog() << Log::INFO << "Cross-section = " << crossSection()/nanobarn << " nb" << endl;
00119    
00120       for (map<IHistogram1D*,double>::iterator histIt = _eventsPassed.begin(),
00121              histJt = _yBinWidths.begin(); histIt != _eventsPassed.end(); ++histIt, ++histJt) {
00122         IHistogram1D* hist = histIt->first;
00123         const double xSec = xSecPerEvent * histIt->second / histJt->second;
00124         normalize(hist, xSec);
00125       }
00126     }
00127  
00128         //@}
00129  
00130   private:
00131 
00132     /// Rapidity range of histograms for R=0.05 and R=1 kt jets
00133     const double _minY, _maxY;
00134      
00135     /// Min jet \f$ p_T \f$ cut.
00136     /// @todo Make static const and UPPERCASE?
00137     const double _jetMinPT;
00138  
00139     /// Counter for the number of events analysed (actually the sum of weights, hence double).
00140     double _eventsTried;
00141 
00142     /// @name Histograms
00143     //@{
00144     /// The number of events in each histogram
00145     map<AIDA::IHistogram1D*, double> _eventsPassed;
00146 
00147     /// The y bin width of each histogram
00148     map<AIDA::IHistogram1D*, double> _yBinWidths;
00149 
00150     /// The y bin edge values
00151     static const double _ybins[6];
00152 
00153     /// Histograms in different eta regions
00154     BinnedHistogram<double> _binnedHistosD07;
00155 
00156     // Single histogram for the \f$R=0.5\f$ \f$k_\perp\f$ jets
00157     AIDA::IHistogram1D* _histoD05;
00158 
00159     // Single histogram for the \f$R=1.0\f$ \f$k_\perp\f$ jets
00160     AIDA::IHistogram1D* _histoD10;
00161     //@}
00162 
00163   };
00164 
00165 
00166   // Initialise static
00167   const double CDF_2007_S7057202::_ybins[] = { 0.0, 0.1, 0.7, 1.1, 1.6, 2.1 };
00168 
00169 
00170   // This global object acts as a hook for the plugin system
00171   AnalysisBuilder<CDF_2007_S7057202> plugin_CDF_2007_S7057202;
00172 
00173 }