rivet is hosted by Hepforge, IPPP Durham
CDF_1996_S3418421.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/Tools/BinnedHistogram.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/FastJets.hh"
00008 
00009 namespace Rivet {
00010 
00011 
00012   /// @brief CDF dijet angular distributions
00013   class CDF_1996_S3418421 : public Analysis {
00014   public:
00015 
00016     /// @name Constructors etc.
00017     //@{
00018 
00019     /// Constructor
00020     CDF_1996_S3418421()
00021       : Analysis("CDF_1996_S3418421")
00022     {
00023     }
00024 
00025     //@}
00026 
00027 
00028   public:
00029 
00030     /// @name Analysis methods
00031     //@{
00032 
00033     /// Book histograms and initialise projections before the run
00034     void init() {
00035       FinalState fs(-4.2, 4.2);
00036       addProjection(FastJets(fs, FastJets::CDFJETCLU, 0.7), "Jets");
00037 
00038       _h_chi.addHistogram(241.0, 300.0, bookHisto1D(1, 1, 1));
00039       _h_chi.addHistogram(300.0, 400.0, bookHisto1D(1, 1, 2));
00040       _h_chi.addHistogram(400.0, 517.0, bookHisto1D(1, 1, 3));
00041       _h_chi.addHistogram(517.0, 625.0, bookHisto1D(1, 1, 4));
00042       _h_chi.addHistogram(625.0, 1800.0, bookHisto1D(1, 1, 5));
00043 
00044       _h_ratio = bookScatter2D(2,1,1,"","","");
00045       _chi_above_25.resize(_h_ratio->numPoints());
00046       _chi_below_25.resize(_h_ratio->numPoints());
00047     }
00048 
00049 
00050     /// Perform the per-event analysis
00051     void analyze(const Event& event) {
00052       const double weight = event.weight();
00053 
00054       Jets jets = applyProjection<FastJets>(event, "Jets").jetsByPt(50.0*GeV);
00055       if (jets.size()<2) {
00056         vetoEvent;
00057       }
00058       FourMomentum jet1 = jets[0].momentum();
00059       FourMomentum jet2 = jets[1].momentum();
00060       double eta1 = jet1.eta();
00061       double eta2 = jet2.eta();
00062       double chi = exp(fabs(eta1-eta2));
00063       if (fabs(eta2)>2.0 || fabs(eta1)>2.0 || chi>5.0) {
00064         vetoEvent;
00065       }
00066 
00067       double m = FourMomentum(jet1+jet2).mass();
00068       _h_chi.fill(m, chi, weight);
00069 
00070       // \todo YODA extents
00071       // // fill ratio counter
00072       // if (m > _h_ratio->lowerExtent(0) && m < _h_ratio->upperExtent(0)) {
00073       //   int bin=-1;
00074       //   for (size_t i=0; i<_h_ratio->numPoints(); ++i) {
00075       //     AIDA::IMeasurement* x = _h_ratio->point(i)->coordinate(0);
00076       //     if (m > x->value()-x->errorMinus() && m < x->value()+x->errorPlus()) {
00077       //       bin=i;
00078       //       break;
00079       //     }
00080       //   }
00081       //   if (bin>-1) {
00082       //     if (chi>2.5) _chi_above_25[bin] += weight;
00083       //     else _chi_below_25[bin] += weight;
00084       //   }
00085       // }
00086     }
00087 
00088 
00089     /// Normalise histograms etc., after the run
00090     void finalize() {
00091 
00092       foreach (Histo1DPtr hist, _h_chi.getHistograms()) {
00093         normalize(hist);
00094       }
00095 
00096       for (size_t bin=0; bin<_h_ratio->numPoints(); ++bin) {
00097         _h_ratio->point(bin).setY(_chi_below_25[bin]/_chi_above_25[bin]);
00098         /// @todo calculate errors while analysing and fill them here as well
00099       }
00100     }
00101 
00102     //@}
00103 
00104 
00105   private:
00106 
00107     // Data members like post-cuts event weight counters go here
00108     std::vector<double> _chi_above_25;
00109     std::vector<double> _chi_below_25;
00110 
00111   private:
00112 
00113     /// @name Histograms
00114     //@{
00115     BinnedHistogram<double> _h_chi;
00116     Scatter2DPtr _h_ratio;
00117     //@}
00118 
00119   };
00120 
00121 
00122 
00123   // The hook for the plugin system
00124   DECLARE_RIVET_PLUGIN(CDF_1996_S3418421);
00125 
00126 }