rivet is hosted by Hepforge, IPPP Durham
TOTEM_2014_I1328627.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_2014_I1328627 : public Analysis {
00009   public:
00010 
00011 
00012     TOTEM_2014_I1328627()
00013       : Analysis("TOTEM_2014_I1328627")
00014     {    }
00015 
00016 
00017 
00018     void init() {
00019       ChargedFinalState cfsm(-7.0, -6.0, 0.0*GeV);
00020       ChargedFinalState cfsp( 3.7,  4.8, 0.0*GeV);
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 ChargedFinalState cfsm = applyProjection<ChargedFinalState>(event, "CFSM");
00031       const ChargedFinalState cfsp = applyProjection<ChargedFinalState>(event, "CFSP");
00032       if (cfsm.size() == 0 && cfsp.size() == 0) vetoEvent;
00033 
00034       _sumofweights += event.weight();
00035       foreach (const Particle& p, cfsm.particles() + cfsp.particles()) {
00036         _h_eta->fill(p.abseta(), event.weight());
00037       }
00038     }
00039 
00040 
00041     void finalize() {
00042       scale(_h_eta, 1./_sumofweights);
00043     }
00044 
00045 
00046   private:
00047 
00048     double _sumofweights;
00049     Histo1DPtr _h_eta;
00050 
00051   };
00052 
00053 
00054   // The hook for the plugin system
00055   DECLARE_RIVET_PLUGIN(TOTEM_2014_I1328627);
00056 
00057 
00058 }