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