rivet is hosted by Hepforge, IPPP Durham
SLD_1996_S3398250.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/Beam.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/ChargedFinalState.hh"
00008 #include "Rivet/Projections/Sphericity.hh"
00009 #include "Rivet/Projections/Thrust.hh"
00010 #include "Rivet/Projections/FastJets.hh"
00011 #include "Rivet/Projections/ParisiTensor.hh"
00012 #include "Rivet/Projections/Hemispheres.hh"
00013 #include "Rivet/Projections/InitialQuarks.hh"
00014 #include <cmath>
00015 
00016 namespace Rivet {
00017 
00018 
00019   /// @brief SLD multiplicities at mZ
00020   /// @author Peter Richardson
00021   class SLD_1996_S3398250 : public Analysis {
00022   public:
00023 
00024     /// Constructor
00025     SLD_1996_S3398250()
00026       : Analysis("SLD_1996_S3398250"),
00027         _weightedTotalChargedPartNumLight(0.),
00028         _weightedTotalChargedPartNumCharm(0.),
00029         _weightedTotalChargedPartNumBottom(0.),
00030         _weightLight(0.),_weightCharm(0.),_weightBottom(0.)
00031     {}
00032 
00033     /// @name Analysis methods
00034     //@{
00035 
00036 
00037     void init() {
00038       // Projections
00039       addProjection(Beam(), "Beams");
00040       addProjection(ChargedFinalState(), "CFS");
00041       addProjection(InitialQuarks(), "IQF");
00042 
00043     }
00044 
00045 
00046     void analyze(const Event& event) {
00047       const double weight = event.weight();
00048       // Even if we only generate hadronic events, we still need a cut on numCharged >= 2.
00049       const FinalState& cfs = applyProjection<FinalState>(event, "CFS");
00050       if (cfs.size() < 2) vetoEvent;
00051 
00052 
00053       int flavour = 0;
00054       const InitialQuarks& iqf = applyProjection<InitialQuarks>(event, "IQF");
00055 
00056       // If we only have two quarks (qqbar), just take the flavour.
00057       // If we have more than two quarks, look for the highest energetic q-qbar pair.
00058       if (iqf.particles().size() == 2) {
00059         flavour = abs( iqf.particles().front().pdgId() );
00060       }
00061       else {
00062         map<int, double> quarkmap;
00063         foreach (const Particle& p, iqf.particles()) {
00064           if (quarkmap[p.pdgId()] < p.momentum().E()) {
00065             quarkmap[p.pdgId()] = p.momentum().E();
00066           }
00067         }
00068         double maxenergy = 0.;
00069         for (int i = 1; i <= 5; ++i) {
00070           if (quarkmap[i]+quarkmap[-i] > maxenergy) {
00071             flavour = i;
00072           }
00073         }
00074       }
00075       const size_t numParticles = cfs.particles().size();
00076       switch (flavour) {
00077       case 1: case 2: case 3:
00078         _weightLight  += weight;
00079         _weightedTotalChargedPartNumLight  += numParticles * weight;
00080         break;
00081       case 4:
00082         _weightCharm  += weight;
00083         _weightedTotalChargedPartNumCharm  += numParticles * weight;
00084         break;
00085       case 5:
00086         _weightBottom += weight;
00087         _weightedTotalChargedPartNumBottom += numParticles * weight;
00088         break;
00089       }
00090 
00091     }
00092 
00093 
00094     void finalize() {
00095       // @todo YODA
00096       //// bottom
00097       //const double avgNumPartsBottom = _weightedTotalChargedPartNumBottom / _weightBottom;
00098       //AIDA::IDataPointSet * multB = bookDataPointSet(1, 1, 1);
00099       //multB->point(0)->coordinate(1)->setValue(avgNumPartsBottom);
00100       //// charm
00101       //const double avgNumPartsCharm = _weightedTotalChargedPartNumCharm / _weightCharm;
00102       //AIDA::IDataPointSet * multC = bookDataPointSet(2, 1, 1);
00103       //multC->point(0)->coordinate(1)->setValue(avgNumPartsCharm);
00104       //// light
00105       //const double avgNumPartsLight = _weightedTotalChargedPartNumLight / _weightLight;
00106       //AIDA::IDataPointSet * multL = bookDataPointSet(3, 1, 1);
00107       //multL->point(0)->coordinate(1)->setValue(avgNumPartsLight);
00108       //// charm-light
00109       //AIDA::IDataPointSet * multD1 = bookDataPointSet(4, 1, 1);
00110       //multD1->point(0)->coordinate(1)->setValue(avgNumPartsCharm -avgNumPartsLight);
00111       //// bottom-light
00112       //AIDA::IDataPointSet * multD2 = bookDataPointSet(5, 1, 1);
00113       //multD2->point(0)->coordinate(1)->setValue(avgNumPartsBottom-avgNumPartsLight);
00114     }
00115     //@}
00116 
00117 
00118   private:
00119 
00120     /// @name Multiplicities
00121     //@{
00122     double _weightedTotalChargedPartNumLight;
00123     double _weightedTotalChargedPartNumCharm;
00124     double _weightedTotalChargedPartNumBottom;
00125     //@}
00126 
00127     /// @name Weights
00128     //@{
00129     double _weightLight;
00130     double _weightCharm;
00131     double _weightBottom;
00132     //@}
00133   };
00134 
00135   // The hook for the plugin system
00136   DECLARE_RIVET_PLUGIN(SLD_1996_S3398250);
00137 
00138 }