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/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 SLD multiplicities at mZ
00018   /// @author Peter Richardson
00019   class SLD_1996_S3398250 : public Analysis {
00020   public:
00021 
00022     /// Constructor
00023     SLD_1996_S3398250()
00024       : Analysis("SLD_1996_S3398250"),
00025         _weightLight(0.),_weightCharm(0.),_weightBottom(0.)
00026     {}
00027 
00028     /// @name Analysis methods
00029     //@{
00030 
00031 
00032     void init() {
00033       // Projections
00034       addProjection(Beam(), "Beams");
00035       addProjection(ChargedFinalState(), "CFS");
00036       addProjection(InitialQuarks(), "IQF");
00037 
00038       _h_bottom = bookHisto1D(1, 1, 1);
00039       _h_charm  = bookHisto1D(2, 1, 1);
00040       _h_light  = bookHisto1D(3, 1, 1);
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         _h_light->fillBin(0, numParticles*weight);
00078         break;
00079       case 4:
00080         _weightCharm  += weight;
00081         _h_charm->fillBin(0, numParticles*weight);
00082         break;
00083       case 5:
00084         _weightBottom += weight;
00085         _h_bottom->fillBin(0, numParticles*weight);
00086         break;
00087       }
00088 
00089     }
00090 
00091 
00092     void multiplicity_subtract(const Histo1DPtr first, const Histo1DPtr second, int a, int b, int c) {
00093       const double x  = first->bin(0).midpoint();
00094       const double ex = first->bin(0).width()/2.;
00095       const double y  = first->bin(0).area() - second->bin(0).area();
00096       const double ey = sqrt(sqr(first->bin(0).areaErr()) + sqr(second->bin(0).areaErr()));
00097       Scatter2DPtr scatter = bookScatter2D(a, b, c);
00098       scatter->addPoint(x, y, ex, ey);
00099     }
00100 
00101 
00102     void finalize() {
00103       if (_weightBottom != 0) scale(_h_bottom, 1./_weightBottom);
00104       if (_weightCharm  != 0) scale(_h_charm,  1./_weightCharm );
00105       if (_weightLight  != 0) scale(_h_light,  1./_weightLight );
00106 
00107       multiplicity_subtract(_h_charm,  _h_light, 4, 1, 1);
00108       multiplicity_subtract(_h_bottom, _h_light, 5, 1, 1);
00109     }
00110 
00111     //@}
00112 
00113 
00114   private:
00115 
00116     /// @name Multiplicities
00117     //@{
00118     //double _weightedTotalChargedPartNumLight;
00119     //double _weightedTotalChargedPartNumCharm;
00120     //double _weightedTotalChargedPartNumBottom;
00121     //@}
00122 
00123     /// @name Weights
00124     //@{
00125     double _weightLight;
00126     double _weightCharm;
00127     double _weightBottom;
00128     //@}
00129 
00130     Histo1DPtr _h_bottom;
00131     Histo1DPtr _h_charm;
00132     Histo1DPtr _h_light;
00133 
00134   };
00135 
00136 
00137   // The hook for the plugin system
00138   DECLARE_RIVET_PLUGIN(SLD_1996_S3398250);
00139 
00140 }