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