UA5_1986_S1583476.cc
Go to the documentation of this file.00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Projections/Beam.hh"
00007 #include "Rivet/Projections/TriggerUA5.hh"
00008
00009 namespace Rivet {
00010
00011
00012
00013 class UA5_1986_S1583476 : public Analysis {
00014 public:
00015
00016
00017 UA5_1986_S1583476() : Analysis("UA5_1986_S1583476") {
00018 setBeams(PROTON, ANTIPROTON);
00019 _sumWTrig = 0;
00020 _sumWTrigNSD = 0;
00021 }
00022
00023
00024
00025
00026
00027
00028 void init() {
00029 addProjection(TriggerUA5(), "Trigger");
00030 addProjection(Beam(), "Beams");
00031 addProjection(ChargedFinalState(-5.0, 5.0), "CFS50");
00032
00033
00034 if (fuzzyEquals(sqrtS()/GeV, 200.0, 1E-4)) {
00035 _hist_eta_nsd = bookHistogram1D(1,1,1);
00036 _hist_eta_inelastic = bookHistogram1D(1,1,2);
00037 for (int i = 1; i <= 6; ++i) {
00038 _sumWn += 0.0;
00039 _hists_eta_nsd += bookHistogram1D(2,1,i);
00040 }
00041 } else if (fuzzyEquals(sqrtS()/GeV, 900.0, 1E-4)) {
00042 _hist_eta_nsd = bookHistogram1D(1,1,3);
00043 _hist_eta_inelastic = bookHistogram1D(1,1,4);
00044 for (int i = 1; i <= 9; ++i) {
00045 _sumWn += 0.0;
00046 _hists_eta_nsd += bookHistogram1D(3,1,i);
00047 }
00048 }
00049 }
00050
00051
00052
00053 void analyze(const Event& event) {
00054
00055 const TriggerUA5& trigger = applyProjection<TriggerUA5>(event, "Trigger");
00056 if (!trigger.sdDecision()) vetoEvent;
00057 const bool isNSD = trigger.nsdDecision();
00058
00059
00060 const ChargedFinalState& cfs50 = applyProjection<ChargedFinalState>(event, "CFS50");
00061 const int numP = cfs50.size();
00062 const int ni = (int)floor(static_cast<float>(numP-2)/10.0);
00063 const int num_idx = min(ni, (int)_sumWn.size()-1);
00064 getLog() << Log::TRACE << "Multiplicity index: " << numP << " charged particles -> #" << num_idx << endl;
00065
00066
00067 const double weight = event.weight();
00068 _sumWTrig += weight;
00069 if (isNSD) {
00070 _sumWTrigNSD += weight;
00071 if (num_idx >= 0) _sumWn[num_idx] += weight;
00072 }
00073
00074
00075 foreach (const Particle& p, cfs50.particles()) {
00076 const double eta = fabs(p.momentum().pseudorapidity());
00077 _hist_eta_inelastic->fill(eta, weight);
00078 if (isNSD) {
00079 _hist_eta_nsd->fill(eta, weight);
00080 if (num_idx >= 0) _hists_eta_nsd[num_idx]->fill(eta, weight);
00081 }
00082 }
00083 }
00084
00085
00086
00087 void finalize() {
00088 getLog() << Log::DEBUG << "sumW_NSD,inel = " << _sumWTrigNSD << ", " << _sumWTrig << endl;
00089 scale(_hist_eta_nsd, 0.5/_sumWTrigNSD);
00090 scale(_hist_eta_inelastic, 0.5/_sumWTrig);
00091
00092 getLog() << Log::DEBUG << "sumW[n] = " << _sumWn << endl;
00093 for (size_t i = 0; i < _hists_eta_nsd.size(); ++i) {
00094 scale(_hists_eta_nsd[i], 0.5/_sumWn[i]);
00095 }
00096 }
00097
00098
00099 private:
00100
00101
00102
00103 double _sumWTrig;
00104 double _sumWTrigNSD;
00105 vector<double> _sumWn;
00106
00107
00108
00109
00110 AIDA::IHistogram1D *_hist_eta_nsd;
00111 AIDA::IHistogram1D *_hist_eta_inelastic;
00112 vector<AIDA::IHistogram1D*> _hists_eta_nsd;
00113
00114
00115 };
00116
00117
00118
00119
00120 AnalysisBuilder<UA5_1986_S1583476> plugin_UA5_1986_S1583476;
00121
00122 }