CDF_2009_NOTE_9936.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/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Projections/TriggerCDFRun2.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   class CDF_2009_NOTE_9936 : public Analysis {
00012   public:
00013 
00014     /// @name Constructors etc.
00015     //@{
00016 
00017     /// Constructor
00018     CDF_2009_NOTE_9936()
00019       : Analysis("CDF_2009_NOTE_9936") 
00020         //_sumWPassed(0.0)
00021     {
00022       /// @todo Set approriate for your analysis
00023       setBeams(PROTON, ANTIPROTON);
00024       
00025       /// @todo Set whether your finalize method needs the generator cross section
00026       setNeedsCrossSection(false);
00027     }
00028 
00029     //@}
00030 
00031 
00032   public:
00033 
00034     /// @name Analysis methods
00035     //@{
00036 
00037     /// Book histograms and initialise projections before the run
00038     void init() {
00039 
00040       addProjection(TriggerCDFRun2(), "Trigger");
00041       
00042       addProjection(ChargedFinalState(-1.0, 1.0, 0.4*GeV), "CFS");
00043 
00044       _hist_nch = bookHistogram1D(1, 1, 1);
00045     }
00046 
00047 
00048     /// Perform the per-event analysis
00049     void analyze(const Event& event) {
00050       // MinBias Trigger
00051       const bool trigger = applyProjection<TriggerCDFRun2>(event, "Trigger").minBiasDecision();
00052       if (!trigger) vetoEvent;
00053       //_sumWPassed += event.weight();
00054       const double weight = event.weight();
00055 
00056       // Get events charged multiplicity and fill histogram
00057       const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFS");
00058       _hist_nch->fill(cfs.size(), weight);
00059 
00060     }
00061 
00062 
00063     /// Normalise histograms etc., after the run
00064     void finalize() {
00065       normalize(_hist_nch);
00066     }
00067 
00068     //@}
00069 
00070   private:
00071 
00072     AIDA::IHistogram1D *_hist_nch;
00073 
00074   };
00075 
00076 
00077 
00078   // This global object acts as a hook for the plugin system
00079   AnalysisBuilder<CDF_2009_NOTE_9936> plugin_CDF_2009_NOTE_9936;
00080 
00081 
00082 }