CDF_1996_S3418421.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/BinnedHistogram.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/FastJets.hh"
00008 
00009 namespace Rivet {
00010 
00011 
00012   class CDF_1996_S3418421 : public Analysis {
00013   public:
00014 
00015     /// @name Constructors etc.
00016     //@{
00017 
00018     /// Constructor
00019     CDF_1996_S3418421()
00020       : Analysis("CDF_1996_S3418421")
00021     {
00022       setBeams(PROTON, ANTIPROTON);
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, bookHistogram1D(1, 1, 1));
00039       _h_chi.addHistogram(300.0, 400.0, bookHistogram1D(1, 1, 2));
00040       _h_chi.addHistogram(400.0, 517.0, bookHistogram1D(1, 1, 3));
00041       _h_chi.addHistogram(517.0, 625.0, bookHistogram1D(1, 1, 4));
00042       _h_chi.addHistogram(625.0, 1800.0, bookHistogram1D(1, 1, 5));
00043    
00044       _h_ratio = bookDataPointSet(2,1,1,"","","");
00045       _chi_above_25.resize(_h_ratio->size());
00046       _chi_below_25.resize(_h_ratio->size());
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       // fill ratio counter
00071       if (m > _h_ratio->lowerExtent(0) && m < _h_ratio->upperExtent(0)) {
00072         int bin=-1;
00073         for (int i=0; i<_h_ratio->size(); ++i) {
00074           AIDA::IMeasurement* x = _h_ratio->point(i)->coordinate(0);
00075           if (m > x->value()-x->errorMinus() && m < x->value()+x->errorPlus()) {
00076             bin=i;
00077             break;
00078           }
00079         }
00080         if (bin>-1) {
00081           if (chi>2.5) _chi_above_25[bin] += weight;
00082           else _chi_below_25[bin] += weight;
00083         }
00084       }
00085     }
00086 
00087 
00088     /// Normalise histograms etc., after the run
00089     void finalize() {
00090    
00091       foreach (AIDA::IHistogram1D* hist, _h_chi.getHistograms()) {
00092         normalize(hist);
00093       }
00094 
00095       for (int bin=0; bin<_h_ratio->size(); ++bin) {
00096         _h_ratio->point(bin)->coordinate(1)->setValue(_chi_below_25[bin]/_chi_above_25[bin]);
00097         /// @todo calculate errors while analysing and fill them here as well
00098       }
00099     }
00100 
00101     //@}
00102 
00103 
00104   private:
00105 
00106     // Data members like post-cuts event weight counters go here
00107     std::vector<double> _chi_above_25;
00108     std::vector<double> _chi_below_25;
00109 
00110   private:
00111 
00112     /// @name Histograms
00113     //@{
00114     BinnedHistogram<double> _h_chi;
00115     AIDA::IDataPointSet* _h_ratio;
00116     //@}
00117 
00118   };
00119 
00120 
00121 
00122   // This global object acts as a hook for the plugin system
00123   AnalysisBuilder<CDF_1996_S3418421> plugin_CDF_1996_S3418421;
00124 
00125 
00126 }