CDF_2009_S8436959.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/FinalState.hh"
00006 #include "Rivet/Projections/IdentifiedFinalState.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   class CDF_2009_S8436959 : public Analysis {
00012   public:
00013 
00014     /// @name Constructors etc.
00015     //@{
00016 
00017     /// Constructor
00018     CDF_2009_S8436959()
00019       : Analysis("CDF_2009_S8436959")
00020     {
00021       setBeams(PROTON, ANTIPROTON);
00022       setNeedsCrossSection(true);
00023     }
00024 
00025     //@}
00026 
00027 
00028   public:
00029 
00030     /// @name Analysis methods
00031     //@{
00032 
00033     /// Book histograms and initialise projections before the run
00034     void init() {
00035       FinalState fs;
00036       addProjection(fs, "FS");
00037 
00038       IdentifiedFinalState ifs(-1.0, 1.0, 30.0*GeV);
00039       ifs.acceptId(PHOTON);
00040       addProjection(ifs, "IFS");
00041 
00042       _h_Et_photon = bookHistogram1D(1, 1, 1);
00043 
00044     }
00045 
00046 
00047     /// Perform the per-event analysis
00048     void analyze(const Event& event) {
00049       const double weight = event.weight();
00050 
00051       ParticleVector photons;
00052       ParticleVector fs = applyProjection<FinalState>(event, "FS").particles();
00053       foreach (const Particle& photon, applyProjection<IdentifiedFinalState>(event, "IFS").particles()) {
00054         FourMomentum mom_in_cone;
00055         foreach (const Particle& p, fs) {
00056           if (deltaR(p.momentum(), photon.momentum()) < 0.4) {
00057             mom_in_cone += p.momentum();
00058           }
00059         }
00060         if (mom_in_cone.Et()-photon.momentum().Et() < 2.0*GeV) {
00061           photons.push_back(photon);
00062         }
00063       }
00064       if (photons.size() != 1) {
00065         vetoEvent;
00066       }
00067    
00068       _h_Et_photon->fill(photons[0].momentum().Et(), weight);
00069     }
00070 
00071 
00072     /// Normalise histograms etc., after the run
00073     void finalize() {
00074       scale(_h_Et_photon, crossSection()/sumOfWeights()/2.0);
00075     }
00076 
00077     //@}
00078 
00079 
00080   private:
00081 
00082     /// @name Histograms
00083     //@{
00084     AIDA::IHistogram1D *_h_Et_photon;
00085     //@}
00086 
00087   };
00088 
00089 
00090 
00091   // This global object acts as a hook for the plugin system
00092   AnalysisBuilder<CDF_2009_S8436959> plugin_CDF_2009_S8436959;
00093 
00094 
00095 }