rivet is hosted by Hepforge, IPPP Durham
DELPHI_2000_S4328825.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/Beam.hh"
00004 #include "Rivet/Projections/FinalState.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Projections/Sphericity.hh"
00007 #include "Rivet/Projections/Thrust.hh"
00008 #include "Rivet/Projections/FastJets.hh"
00009 #include "Rivet/Projections/ParisiTensor.hh"
00010 #include "Rivet/Projections/Hemispheres.hh"
00011 #include "Rivet/Projections/InitialQuarks.hh"
00012 #include <cmath>
00013 
00014 namespace Rivet {
00015 
00016 
00017   /// @brief OPAL multiplicities at various energies
00018   /// @author Peter Richardson
00019   class DELPHI_2000_S4328825 : public Analysis {
00020   public:
00021 
00022     /// Constructor
00023     DELPHI_2000_S4328825()
00024       : Analysis("DELPHI_2000_S4328825"),
00025         _weightedTotalChargedPartNumLight(0.),
00026         _weightedTotalChargedPartNumCharm(0.),
00027         _weightedTotalChargedPartNumBottom(0.),
00028         _weightLight(0.),_weightCharm(0.),_weightBottom(0.)
00029     {}
00030 
00031     /// @name Analysis methods
00032     //@{
00033 
00034 
00035     void init() {
00036       // Projections
00037       addProjection(Beam(), "Beams");
00038       addProjection(ChargedFinalState(), "CFS");
00039       addProjection(InitialQuarks(), "IQF");
00040 
00041     }
00042 
00043 
00044     void analyze(const Event& event) {
00045       const double weight = event.weight();
00046       // Even if we only generate hadronic events, we still need a cut on numCharged >= 2.
00047       const FinalState& cfs = applyProjection<FinalState>(event, "CFS");
00048       if (cfs.size() < 2) vetoEvent;
00049 
00050 
00051       int flavour = 0;
00052       const InitialQuarks& iqf = applyProjection<InitialQuarks>(event, "IQF");
00053 
00054       // If we only have two quarks (qqbar), just take the flavour.
00055       // If we have more than two quarks, look for the highest energetic q-qbar pair.
00056       if (iqf.particles().size() == 2) {
00057         flavour = abs( iqf.particles().front().pdgId() );
00058       }
00059       else {
00060         map<int, double> quarkmap;
00061         foreach (const Particle& p, iqf.particles()) {
00062           if (quarkmap[p.pdgId()] < p.momentum().E()) {
00063             quarkmap[p.pdgId()] = p.momentum().E();
00064           }
00065         }
00066         double maxenergy = 0.;
00067         for (int i = 1; i <= 5; ++i) {
00068           if (quarkmap[i]+quarkmap[-i] > maxenergy) {
00069             flavour = i;
00070           }
00071         }
00072       }
00073       const size_t numParticles = cfs.particles().size();
00074       switch (flavour) {
00075       case 1: case 2: case 3:
00076         _weightLight  += weight;
00077         _weightedTotalChargedPartNumLight  += numParticles * weight;
00078         break;
00079       case 4:
00080         _weightCharm  += weight;
00081         _weightedTotalChargedPartNumCharm  += numParticles * weight;
00082         break;
00083       case 5:
00084         _weightBottom += weight;
00085         _weightedTotalChargedPartNumBottom += numParticles * weight;
00086         break;
00087       }
00088 
00089     }
00090 
00091 
00092     void finalize() {
00093       Histo1D temphisto(refData(1, 1, 1));
00094 
00095       const double avgNumPartsBottom = _weightedTotalChargedPartNumBottom / _weightBottom;
00096       const double avgNumPartsCharm  = _weightedTotalChargedPartNumCharm  / _weightCharm;
00097       const double avgNumPartsLight  = _weightedTotalChargedPartNumLight  / _weightLight;
00098       Scatter2DPtr h_bottom = bookScatter2D(1, 1, 1);
00099       Scatter2DPtr h_charm  = bookScatter2D(1, 1, 2);
00100       Scatter2DPtr h_light  = bookScatter2D(1, 1, 3);
00101       Scatter2DPtr h_diff   = bookScatter2D(1, 1, 4);  // bottom minus light
00102       for (size_t b = 0; b < temphisto.numBins(); b++) {
00103         const double x  = temphisto.bin(b).midpoint();
00104         const double ex = temphisto.bin(b).width()/2.;
00105         if (inRange(sqrtS()/GeV, x-ex, x+ex)) {
00106           // @TODO: Fix y-error:
00107           h_bottom->addPoint(x, avgNumPartsBottom, ex, 0.);
00108           h_charm->addPoint(x, avgNumPartsCharm, ex, 0.);
00109           h_light->addPoint(x, avgNumPartsLight, ex, 0.);
00110           h_diff->addPoint(x, avgNumPartsBottom-avgNumPartsLight, ex, 0.);
00111         }
00112       }
00113     }
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 
00136   // The hook for the plugin system
00137   DECLARE_RIVET_PLUGIN(DELPHI_2000_S4328825);
00138 
00139 }