rivet is hosted by Hepforge, IPPP Durham
UA5_1982_S875503.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/ChargedFinalState.hh"
00004 #include "Rivet/Projections/TriggerUA5.hh"
00005 
00006 namespace Rivet {
00007 
00008 
00009   /// @brief UA5 multiplicity and \f$ \eta \f$ distributions
00010   class UA5_1982_S875503 : public Analysis {
00011   public:
00012 
00013     /// Default constructor
00014     UA5_1982_S875503() : Analysis("UA5_1982_S875503") {
00015       _sumWTrig = 0;
00016     }
00017 
00018 
00019     /// @name Analysis methods
00020     //@{
00021 
00022     /// Set up projections and book histos
00023     void init() {
00024       addProjection(TriggerUA5(), "Trigger");
00025       addProjection(ChargedFinalState(-3.5, 3.5), "CFS");
00026 
00027       // Book histos based on pp or ppbar beams
00028       if (beamIds().first == beamIds().second) {
00029         _hist_nch = bookHisto1D(2,1,1);
00030         _hist_eta = bookHisto1D(3,1,1);
00031       } else {
00032         _hist_nch = bookHisto1D(2,1,2);
00033         _hist_eta = bookHisto1D(4,1,1);
00034       }
00035     }
00036 
00037 
00038     void analyze(const Event& event) {
00039       // Trigger
00040       const TriggerUA5& trigger = applyProjection<TriggerUA5>(event, "Trigger");
00041       if (!trigger.nsdDecision()) vetoEvent;
00042       const double weight = event.weight();
00043       _sumWTrig += weight;
00044 
00045       // Get tracks
00046       const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFS");
00047 
00048       // Fill mean charged multiplicity histos
00049       _hist_nch->fill(_hist_nch->bin(0).midpoint(), cfs.size()*weight);
00050 
00051       // Iterate over all tracks and fill eta histograms
00052       foreach (const Particle& p, cfs.particles()) {
00053         const double eta = fabs(p.momentum().pseudorapidity());
00054         _hist_eta->fill(eta, weight);
00055       }
00056 
00057     }
00058 
00059 
00060     void finalize() {
00061       /// @todo Why the factor of 2 on Nch for ppbar?
00062       if (beamIds().first == beamIds().second) {
00063         scale(_hist_nch, 1.0/_sumWTrig);
00064       } else {
00065         scale(_hist_nch, 0.5/_sumWTrig);
00066       }
00067       scale(_hist_eta, 0.5/_sumWTrig);
00068     }
00069 
00070     //@}
00071 
00072 
00073   private:
00074 
00075     /// @name Counters
00076     //@{
00077     double _sumWTrig;
00078     //@}
00079 
00080     /// @name Histogram collections
00081     //@{
00082     Histo1DPtr _hist_nch;
00083     Histo1DPtr _hist_eta;
00084     //@}
00085 
00086   };
00087 
00088 
00089 
00090   // The hook for the plugin system
00091   DECLARE_RIVET_PLUGIN(UA5_1982_S875503);
00092 
00093 }