00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/ParticleIdUtils.hh"
00005 #include "Rivet/Projections/Beam.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/ChargedFinalState.hh"
00008 #include "Rivet/Projections/InitialQuarks.hh"
00009
00010 namespace Rivet {
00011
00012
00013
00014
00015 class OPAL_1998_S3780481 : public Analysis {
00016 public:
00017
00018
00019 OPAL_1998_S3780481() : Analysis("OPAL_1998_S3780481")
00020 {
00021
00022
00023 _weightedTotalPartNum = 0;
00024 _SumOfudsWeights = 0;
00025 _SumOfcWeights = 0;
00026 _SumOfbWeights = 0;
00027 }
00028
00029
00030
00031
00032
00033 void analyze(const Event& e) {
00034
00035 const FinalState& fs = applyProjection<FinalState>(e, "FS");
00036 const size_t numParticles = fs.particles().size();
00037
00038
00039 if (numParticles < 2) {
00040 MSG_DEBUG("Failed ncharged cut");
00041 vetoEvent;
00042 }
00043 MSG_DEBUG("Passed ncharged cut");
00044
00045
00046 const double weight = e.weight();
00047 _weightedTotalPartNum += numParticles * weight;
00048
00049
00050 const ParticlePair& beams = applyProjection<Beam>(e, "Beams").beams();
00051 const double meanBeamMom = ( beams.first.momentum().vector3().mod() +
00052 beams.second.momentum().vector3().mod() ) / 2.0;
00053 MSG_DEBUG("Avg beam momentum = " << meanBeamMom);
00054
00055 int flavour = 0;
00056 const InitialQuarks& iqf = applyProjection<InitialQuarks>(e, "IQF");
00057
00058
00059
00060 if (iqf.particles().size() == 2) {
00061 flavour = abs( iqf.particles().front().pdgId() );
00062 }
00063 else {
00064 map<int, double> quarkmap;
00065 foreach (const Particle& p, iqf.particles()) {
00066 if (quarkmap[p.pdgId()] < p.momentum().E()) {
00067 quarkmap[p.pdgId()] = p.momentum().E();
00068 }
00069 }
00070 double maxenergy = 0.;
00071 for (int i = 1; i <= 5; ++i) {
00072 if (quarkmap[i]+quarkmap[-i] > maxenergy) {
00073 flavour = i;
00074 }
00075 }
00076 }
00077
00078 switch (flavour) {
00079 case 1:
00080 case 2:
00081 case 3:
00082 _SumOfudsWeights += weight;
00083 break;
00084 case 4:
00085 _SumOfcWeights += weight;
00086 break;
00087 case 5:
00088 _SumOfbWeights += weight;
00089 break;
00090 }
00091
00092 foreach (const Particle& p, fs.particles()) {
00093 const double xp = p.momentum().vector3().mod()/meanBeamMom;
00094 const double logxp = -std::log(xp);
00095 _histXpall->fill(xp, weight);
00096 _histLogXpall->fill(logxp, weight);
00097 _histMultiChargedall->fill(_histMultiChargedall->binMean(0), weight);
00098 switch (flavour) {
00099
00100 case DQUARK:
00101 case UQUARK:
00102 case SQUARK:
00103 _histXpuds->fill(xp, weight);
00104 _histLogXpuds->fill(logxp, weight);
00105 _histMultiChargeduds->fill(_histMultiChargeduds->binMean(0), weight);
00106 break;
00107 case CQUARK:
00108 _histXpc->fill(xp, weight);
00109 _histLogXpc->fill(logxp, weight);
00110 _histMultiChargedc->fill(_histMultiChargedc->binMean(0), weight);
00111 break;
00112 case BQUARK:
00113 _histXpb->fill(xp, weight);
00114 _histLogXpb->fill(logxp, weight);
00115 _histMultiChargedb->fill(_histMultiChargedb->binMean(0), weight);
00116 break;
00117 }
00118 }
00119
00120 }
00121
00122
00123 void init() {
00124
00125 addProjection(Beam(), "Beams");
00126 addProjection(ChargedFinalState(), "FS");
00127 addProjection(InitialQuarks(), "IQF");
00128
00129
00130 _histXpuds = bookHistogram1D(1, 1, 1);
00131 _histXpc = bookHistogram1D(2, 1, 1);
00132 _histXpb = bookHistogram1D(3, 1, 1);
00133 _histXpall = bookHistogram1D(4, 1, 1);
00134 _histLogXpuds = bookHistogram1D(5, 1, 1);
00135 _histLogXpc = bookHistogram1D(6, 1, 1);
00136 _histLogXpb = bookHistogram1D(7, 1, 1);
00137 _histLogXpall = bookHistogram1D(8, 1, 1);
00138 _histMultiChargeduds = bookHistogram1D(9, 1, 1);
00139 _histMultiChargedc = bookHistogram1D(9, 1, 2);
00140 _histMultiChargedb = bookHistogram1D(9, 1, 3);
00141 _histMultiChargedall = bookHistogram1D(9, 1, 4);
00142 }
00143
00144
00145
00146 void finalize() {
00147 const double avgNumParts = _weightedTotalPartNum / sumOfWeights();
00148 normalize(_histXpuds , avgNumParts);
00149 normalize(_histXpc , avgNumParts);
00150 normalize(_histXpb , avgNumParts);
00151 normalize(_histXpall , avgNumParts);
00152 normalize(_histLogXpuds , avgNumParts);
00153 normalize(_histLogXpc , avgNumParts);
00154 normalize(_histLogXpb , avgNumParts);
00155 normalize(_histLogXpall , avgNumParts);
00156
00157 scale(_histMultiChargeduds, 1.0/_SumOfudsWeights);
00158 scale(_histMultiChargedc , 1.0/_SumOfcWeights);
00159 scale(_histMultiChargedb , 1.0/_SumOfbWeights);
00160 scale(_histMultiChargedall, 1.0/sumOfWeights());
00161 }
00162
00163
00164
00165
00166 private:
00167
00168
00169
00170
00171 double _weightedTotalPartNum;
00172
00173 double _SumOfudsWeights;
00174 double _SumOfcWeights;
00175 double _SumOfbWeights;
00176
00177 AIDA::IHistogram1D *_histXpuds;
00178 AIDA::IHistogram1D *_histXpc;
00179 AIDA::IHistogram1D *_histXpb;
00180 AIDA::IHistogram1D *_histXpall;
00181 AIDA::IHistogram1D *_histLogXpuds;
00182 AIDA::IHistogram1D *_histLogXpc;
00183 AIDA::IHistogram1D *_histLogXpb;
00184 AIDA::IHistogram1D *_histLogXpall;
00185 AIDA::IHistogram1D *_histMultiChargeduds;
00186 AIDA::IHistogram1D *_histMultiChargedc;
00187 AIDA::IHistogram1D *_histMultiChargedb;
00188 AIDA::IHistogram1D *_histMultiChargedall;
00189
00190
00191
00192 };
00193
00194
00195
00196
00197 DECLARE_RIVET_PLUGIN(OPAL_1998_S3780481);
00198
00199 }