UA5_1986_S1583476.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/Projections/ChargedFinalState.hh" 00004 #include "Rivet/Projections/Beam.hh" 00005 #include "Rivet/Projections/TriggerUA5.hh" 00006 00007 namespace Rivet { 00008 00009 00010 /// @brief UA5 \f$ \eta \f$ distributions at 200 and 900 GeV 00011 class UA5_1986_S1583476 : public Analysis { 00012 public: 00013 00014 /// Constructor 00015 UA5_1986_S1583476() : Analysis("UA5_1986_S1583476") { 00016 _sumWTrig = 0; 00017 _sumWTrigNSD = 0; 00018 } 00019 00020 00021 /// @name Analysis methods 00022 //@{ 00023 00024 /// Set up projections and histograms 00025 void init() { 00026 addProjection(TriggerUA5(), "Trigger"); 00027 addProjection(Beam(), "Beams"); 00028 addProjection(ChargedFinalState(-5.0, 5.0), "CFS50"); 00029 00030 // Histograms 00031 if (fuzzyEquals(sqrtS()/GeV, 200.0, 1E-4)) { 00032 _hist_eta_nsd = bookHisto1D(1,1,1); 00033 _hist_eta_inelastic = bookHisto1D(1,1,2); 00034 for (int i = 1; i <= 6; ++i) { 00035 _sumWn += 0.0; 00036 _hists_eta_nsd += bookHisto1D(2,1,i); 00037 } 00038 } else if (fuzzyEquals(sqrtS()/GeV, 900.0, 1E-4)) { 00039 _hist_eta_nsd = bookHisto1D(1,1,3); 00040 _hist_eta_inelastic = bookHisto1D(1,1,4); 00041 for (int i = 1; i <= 9; ++i) { 00042 _sumWn += 0.0; 00043 _hists_eta_nsd += bookHisto1D(3,1,i); 00044 } 00045 } 00046 } 00047 00048 00049 /// Fill eta histograms (in Nch bins) 00050 void analyze(const Event& event) { 00051 // Trigger 00052 const TriggerUA5& trigger = applyProjection<TriggerUA5>(event, "Trigger"); 00053 if (!trigger.sdDecision()) vetoEvent; 00054 const bool isNSD = trigger.nsdDecision(); 00055 00056 // Get the index corresponding to the max Nch range histo/sum(w) vector index 00057 const ChargedFinalState& cfs50 = applyProjection<ChargedFinalState>(event, "CFS50"); 00058 const int numP = cfs50.size(); 00059 const int ni = (int)floor(static_cast<float>(numP-2)/10.0); 00060 const int num_idx = min(ni, (int)_sumWn.size()-1); 00061 MSG_TRACE("Multiplicity index: " << numP << " charged particles -> #" << num_idx); 00062 00063 // Update weights 00064 const double weight = event.weight(); 00065 _sumWTrig += weight; 00066 if (isNSD) { 00067 _sumWTrigNSD += weight; 00068 if (num_idx >= 0) _sumWn[num_idx] += weight; 00069 } 00070 00071 // Fill histos 00072 foreach (const Particle& p, cfs50.particles()) { 00073 const double eta = p.abseta(); 00074 _hist_eta_inelastic->fill(eta, weight); 00075 if (isNSD) { 00076 _hist_eta_nsd->fill(eta, weight); 00077 if (num_idx >= 0) _hists_eta_nsd[num_idx]->fill(eta, weight); 00078 } 00079 } 00080 } 00081 00082 00083 /// Scale histos 00084 void finalize() { 00085 MSG_DEBUG("sumW_NSD,inel = " << _sumWTrigNSD << ", " << _sumWTrig); 00086 scale(_hist_eta_nsd, 0.5/_sumWTrigNSD); 00087 scale(_hist_eta_inelastic, 0.5/_sumWTrig); 00088 // 00089 MSG_DEBUG("sumW[n] = " << _sumWn); 00090 for (size_t i = 0; i < _hists_eta_nsd.size(); ++i) { 00091 scale(_hists_eta_nsd[i], 0.5/_sumWn[i]); 00092 } 00093 } 00094 00095 00096 private: 00097 00098 /// @name Weight counters 00099 //@{ 00100 double _sumWTrig; 00101 double _sumWTrigNSD; 00102 vector<double> _sumWn; 00103 //@} 00104 00105 /// @name Histograms 00106 //@{ 00107 Histo1DPtr _hist_eta_nsd; 00108 Histo1DPtr _hist_eta_inelastic; 00109 vector<Histo1DPtr> _hists_eta_nsd; 00110 //@} 00111 00112 }; 00113 00114 00115 00116 // The hook for the plugin system 00117 DECLARE_RIVET_PLUGIN(UA5_1986_S1583476); 00118 00119 } Generated on Tue Sep 30 2014 19:45:47 for The Rivet MC analysis system by ![]() |