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