00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 #include "Rivet/Projections/TriggerUA5.hh"
00006
00007 namespace Rivet {
00008
00009
00010
00011 class UA5_1982_S875503 : public Analysis {
00012 public:
00013
00014
00015 UA5_1982_S875503() : Analysis("UA5_1982_S875503") {
00016 _sumWTrig = 0;
00017 }
00018
00019
00020
00021
00022
00023
00024 void init() {
00025 addProjection(TriggerUA5(), "Trigger");
00026 addProjection(ChargedFinalState(-3.5, 3.5), "CFS");
00027
00028
00029 if (beamIds().first == beamIds().second) {
00030 _hist_nch = bookHistogram1D(2,1,1);
00031 _hist_eta = bookHistogram1D(3,1,1);
00032 } else {
00033 _hist_nch = bookHistogram1D(2,1,2);
00034 _hist_eta = bookHistogram1D(4,1,1);
00035 }
00036 }
00037
00038
00039 void analyze(const Event& event) {
00040
00041 const TriggerUA5& trigger = applyProjection<TriggerUA5>(event, "Trigger");
00042 if (!trigger.nsdDecision()) vetoEvent;
00043 const double weight = event.weight();
00044 _sumWTrig += weight;
00045
00046
00047 const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFS");
00048
00049
00050 _hist_nch->fill(_hist_nch->binMean(0), cfs.size());
00051
00052
00053 foreach (const Particle& p, cfs.particles()) {
00054 const double eta = fabs(p.momentum().pseudorapidity());
00055 _hist_eta->fill(eta, weight);
00056 }
00057
00058 }
00059
00060
00061 void finalize() {
00062
00063 if (beamIds().first == beamIds().second) {
00064 scale(_hist_nch, 1.0/_sumWTrig);
00065 } else {
00066 scale(_hist_nch, 0.5/_sumWTrig);
00067 }
00068 scale(_hist_eta, 0.5/_sumWTrig);
00069 }
00070
00071
00072
00073
00074 private:
00075
00076
00077
00078 double _sumWTrig;
00079
00080
00081
00082
00083 AIDA::IHistogram1D* _hist_nch;
00084 AIDA::IHistogram1D* _hist_eta;
00085
00086
00087 };
00088
00089
00090
00091
00092 AnalysisBuilder<UA5_1982_S875503> plugin_UA5_1982_S875503;
00093
00094 }