00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006
00007 namespace Rivet {
00008
00009
00010 class SFM_1984_S1178091 : public Analysis {
00011 public:
00012
00013
00014 SFM_1984_S1178091() : Analysis("SFM_1984_S1178091") {
00015 setBeams(PROTON, PROTON);
00016 _sumW = 0;
00017 _sumWDiff = 0;
00018 }
00019
00020
00021
00022
00023
00024 void init() {
00025
00026
00027 addProjection(ChargedFinalState(), "FS");
00028
00029
00030 if (fuzzyEquals(sqrtS()/GeV, 30.4, 1E-1)) {
00031 _hist_multiplicity_inel = bookHistogram1D(1, 1, 1);
00032 _hist_multiplicity_nsd = bookHistogram1D(2, 1, 1);
00033 } else if (fuzzyEquals(sqrtS(), 44.5, 1E-1)) {
00034 _hist_multiplicity_inel = bookHistogram1D(1, 1, 2);
00035 _hist_multiplicity_nsd = bookHistogram1D(2, 1, 2);
00036 } else if (fuzzyEquals(sqrtS(), 52.2, 1E-1)) {
00037 _hist_multiplicity_inel = bookHistogram1D(1, 1, 3);
00038 _hist_multiplicity_nsd = bookHistogram1D(2, 1, 3);
00039 } else if (fuzzyEquals(sqrtS(), 62.2, 1E-1)) {
00040 _hist_multiplicity_inel = bookHistogram1D(1, 1, 4);
00041 _hist_multiplicity_nsd = bookHistogram1D(2, 1, 4);
00042 }
00043
00044 }
00045
00046
00047
00048 void analyze(const Event& event) {
00049 const double weight = event.weight();
00050 const ChargedFinalState& fs = applyProjection<ChargedFinalState>(event, "FS");
00051 const size_t numParticles = fs.particles().size();
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 int n_left(0), n_right(0), n_large_x(0);
00063 foreach (const Particle& p, fs.particles()) {
00064
00065 const double x_feyn = 2.0 * fabs(p.momentum().pz())/sqrtS();
00066 if (x_feyn > 0.8 ) n_large_x += 1;
00067
00068
00069 const double eta = p.momentum().pseudorapidity();
00070 if (eta > 0.0) n_right += 1;
00071 else if (eta < 0.0) n_left += 1;
00072 }
00073 getLog() << Log::DEBUG
00074 << "N_left: " << n_left << ", "
00075 << "N_right: " << n_right << ", "
00076 << "N_large_x: " << n_large_x << endl;
00077
00078
00079
00080
00081
00082
00083
00084 const bool isDiffractive = (n_large_x == 1) ||
00085 ((n_left == 1 || n_right == 1) && numParticles < 8 );
00086
00087
00088 _sumW += weight;
00089 _sumWDiff += weight;
00090
00091
00092 _hist_multiplicity_inel->fill(numParticles, weight);
00093 if (!isDiffractive) _hist_multiplicity_nsd->fill(numParticles, weight);
00094 }
00095
00096
00097 void finalize() {
00098 scale(_hist_multiplicity_inel, 1.0/_sumWDiff);
00099 scale(_hist_multiplicity_nsd, 1.0/_sumW );
00100 }
00101
00102
00103
00104
00105 private:
00106
00107
00108
00109 double _sumW, _sumWDiff;
00110
00111
00112
00113
00114 AIDA::IHistogram1D *_hist_multiplicity_inel;
00115 AIDA::IHistogram1D *_hist_multiplicity_nsd;
00116
00117
00118 };
00119
00120
00121
00122
00123 AnalysisBuilder<SFM_1984_S1178091> plugin_SFM_1984_S1178091;
00124
00125 }