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