rivet is hosted by Hepforge, IPPP Durham
TOTEM_2012_I1115294.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 namespace Rivet {
00008 
00009 
00010   class TOTEM_2012_I1115294 : public Analysis {
00011   public:
00012 
00013     TOTEM_2012_I1115294()
00014       : Analysis("TOTEM_2012_I1115294")
00015     {    }
00016 
00017 
00018   public:
00019 
00020     void init() {
00021       ChargedFinalState cfsm(-6.50, -5.35, 40.*MeV);
00022       ChargedFinalState cfsp( 5.35,  6.50, 40.*MeV);
00023       addProjection(cfsm, "CFSM");
00024       addProjection(cfsp, "CFSP");
00025 
00026       _h_eta = bookHisto1D(1, 1, 1);
00027       _sumofweights = 0.;
00028     }
00029 
00030 
00031     void analyze(const Event& event) {
00032       const double weight = event.weight();
00033 
00034       const ChargedFinalState cfsm = applyProjection<ChargedFinalState>(event, "CFSM");
00035       const ChargedFinalState cfsp = applyProjection<ChargedFinalState>(event, "CFSP");
00036 
00037       if (cfsm.size() == 0 && cfsp.size() == 0) vetoEvent;
00038 
00039       _sumofweights += weight;
00040 
00041       foreach (const Particle& p, cfsm.particles() + cfsp.particles()) {
00042         _h_eta->fill(fabs(p.momentum().eta()), weight);
00043       }
00044 
00045     }
00046 
00047 
00048     void finalize() {
00049       scale(_h_eta, 1./(2*_sumofweights));
00050     }
00051 
00052 
00053   private:
00054 
00055     double _sumofweights;
00056     Histo1DPtr _h_eta;
00057 
00058 
00059   };
00060 
00061 
00062 
00063   // The hook for the plugin system
00064   DECLARE_RIVET_PLUGIN(TOTEM_2012_I1115294);
00065 
00066 }