rivet is hosted by Hepforge, IPPP Durham
E735_1998_S3905616.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/ChargedFinalState.hh"
00004 
00005 #include "Rivet/Projections/TriggerCDFRun0Run1.hh"
00006 #include "Rivet/Projections/TriggerUA5.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief E735 charged multiplicity in NSD-triggered events
00012   class E735_1998_S3905616 : public Analysis {
00013   public:
00014 
00015     /// Constructor
00016     E735_1998_S3905616() : Analysis("E735_1998_S3905616") {
00017       _sumWTrig = 0;
00018     }
00019 
00020 
00021     /// @name Analysis methods
00022     //@{
00023 
00024     void init() {
00025       // Projections
00026       addProjection(TriggerUA5(), "Trigger");
00027       addProjection(ChargedFinalState(), "FS");
00028 
00029       // Histo
00030       _hist_multiplicity = bookHisto1D(1, 1, 1);
00031     }
00032 
00033 
00034     void analyze(const Event& event) {
00035       const bool trigger = applyProjection<TriggerUA5>(event, "Trigger").nsdDecision();
00036       if (!trigger) vetoEvent;
00037       const double weight = event.weight();
00038       _sumWTrig += weight;
00039 
00040       const ChargedFinalState& fs = applyProjection<ChargedFinalState>(event, "FS");
00041       const size_t numParticles = fs.particles().size();
00042       _hist_multiplicity->fill(numParticles, weight);
00043     }
00044 
00045 
00046     void finalize() {
00047       scale(_hist_multiplicity, 1/_sumWTrig);
00048     }
00049 
00050     //@}
00051 
00052 
00053   private:
00054 
00055     /// @name Weight counter
00056     //@{
00057     double _sumWTrig;
00058     //@}
00059 
00060     /// @name Histograms
00061     //@{
00062     Histo1DPtr _hist_multiplicity;
00063     //@}
00064 
00065   };
00066 
00067 
00068 
00069   // The hook for the plugin system
00070   DECLARE_RIVET_PLUGIN(E735_1998_S3905616);
00071 
00072 }