CDF_1990_S2089246.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/RivetAIDA.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Projections/TriggerCDFRun0Run1.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /* @brief CDF pseudorapidity analysis
00012    * @author Andy Buckley
00013    */
00014   class CDF_1990_S2089246 : public Analysis {
00015   public:
00016 
00017     /// Constructor
00018     CDF_1990_S2089246()
00019       : Analysis("CDF_1990_S2089246")
00020     {
00021       setBeams(PROTON, ANTIPROTON);
00022       _sumWTrig = 0;
00023     }
00024 
00025 
00026     /// @name Analysis methods
00027     //@{
00028 
00029     void init() {
00030       // Setup projections
00031       addProjection(TriggerCDFRun0Run1(), "Trigger");
00032       addProjection(ChargedFinalState(-3.5, 3.5), "CFS");
00033 
00034       // Book histo
00035       if (fuzzyEquals(sqrtS()/GeV, 1800, 1E-3)) {
00036         _hist_eta = bookHistogram1D(3, 1, 1);
00037       } else if (fuzzyEquals(sqrtS()/GeV, 630, 1E-3)) {
00038         _hist_eta = bookHistogram1D(4, 1, 1);
00039       }
00040     }
00041 
00042 
00043     /// Do the analysis
00044     void analyze(const Event& event) {
00045       // Trigger
00046       const bool trigger = applyProjection<TriggerCDFRun0Run1>(event, "Trigger").minBiasDecision();
00047       if (!trigger) vetoEvent;
00048       const double weight = event.weight();
00049       _sumWTrig += weight;
00050 
00051       // Loop over final state charged particles to fill eta histos
00052       const FinalState& fs = applyProjection<FinalState>(event, "CFS");
00053       foreach (const Particle& p, fs.particles()) {
00054         const double eta = p.momentum().pseudorapidity();
00055         _hist_eta->fill(fabs(eta), weight);
00056       }
00057     }
00058   
00059  
00060     /// Finalize
00061     void finalize() {
00062       // Divide through by num events to get d<N>/d(eta) in bins
00063       // Factor of 1/2 for |eta| -> eta
00064       scale(_hist_eta, 0.5/_sumWTrig);
00065     }
00066 
00067     //@}
00068 
00069 
00070   private:
00071 
00072     /// @name Weight counter
00073     //@{
00074     double _sumWTrig;
00075     //@}
00076 
00077     /// @name Histogram collections
00078     //@{
00079     AIDA::IHistogram1D* _hist_eta;
00080     //@}
00081 
00082   };
00083 
00084  
00085 
00086   // This global object acts as a hook for the plugin system
00087   AnalysisBuilder<CDF_1990_S2089246> plugin_CDF_1990_S2089246;
00088 
00089 }