UA5_1987_S1640666.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/Projections/TriggerUA5.hh" 00004 #include "Rivet/Projections/ChargedFinalState.hh" 00005 00006 namespace Rivet { 00007 00008 00009 class UA5_1987_S1640666 : public Analysis { 00010 public: 00011 00012 /// Constructor 00013 UA5_1987_S1640666() 00014 : Analysis("UA5_1987_S1640666") 00015 { 00016 _sumWPassed = 0; 00017 00018 } 00019 00020 /// Book histograms and initialise projections before the run 00021 void init() { 00022 addProjection(TriggerUA5(), "Trigger"); 00023 addProjection(ChargedFinalState(-5.0, 5.0), "CFS"); 00024 00025 _hist_mean_nch = bookHisto1D(1, 1, 1); 00026 _hist_nch = bookHisto1D(3, 1, 1); 00027 00028 } 00029 00030 00031 /// Perform the per-event analysis 00032 void analyze(const Event& event) { 00033 // Trigger 00034 const TriggerUA5& trigger = applyProjection<TriggerUA5>(event, "Trigger"); 00035 if (!trigger.nsdDecision()) vetoEvent; 00036 00037 const double weight = event.weight(); 00038 _sumWPassed += weight; 00039 00040 // Count final state particles in several eta regions 00041 const int Nch = applyProjection<ChargedFinalState>(event, "CFS").size(); 00042 00043 // Fill histograms 00044 _hist_nch->fill(Nch, weight); 00045 _hist_mean_nch->fill(_hist_mean_nch->bin(0).midpoint(), Nch*weight); 00046 00047 } 00048 00049 00050 /// Normalise histograms etc., after the run 00051 void finalize() { 00052 00053 scale(_hist_nch, 1.0/_sumWPassed); 00054 scale(_hist_mean_nch, 1.0/_sumWPassed); 00055 00056 } 00057 00058 private: 00059 00060 double _sumWPassed; 00061 00062 Histo1DPtr _hist_mean_nch; 00063 Histo1DPtr _hist_nch; 00064 00065 }; 00066 00067 00068 00069 // The hook for the plugin system 00070 DECLARE_RIVET_PLUGIN(UA5_1987_S1640666); 00071 00072 00073 } Generated on Thu Feb 6 2014 17:38:46 for The Rivet MC analysis system by ![]() |