rivet is hosted by Hepforge, IPPP Durham
Hemispheres.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Projections/Hemispheres.hh"
00003 #include "Rivet/Jet.hh"
00004 
00005 namespace Rivet {
00006 
00007 
00008   void Hemispheres::project(const Event& e) {
00009     clear();
00010 
00011     // Get thrust axes.
00012     const AxesDefinition& ax = applyProjection<AxesDefinition>(e, "Axes");
00013     const Vector3 n = ax.axis1();
00014     const FinalState& fs = applyProjection<FinalState>(e, ax.getProjection("FS"));
00015     const Particles& particles = fs.particles();
00016     calc(n, particles);
00017   }
00018 
00019 
00020   void Hemispheres::calc(const Vector3& n, const Particles& particles) {
00021     vector<FourMomentum> p4s; p4s.reserve(particles.size());
00022     foreach (const Particle& p, particles) p4s.push_back(p.mom());
00023     calc(n, p4s);
00024   }
00025 
00026 
00027   void Hemispheres::calc(const Vector3& n, const Jets& jets) {
00028     vector<FourMomentum> p4s; p4s.reserve(jets.size());
00029     foreach (const Jet& j, jets) p4s.push_back(j.mom());
00030     calc(n, p4s);
00031   }
00032 
00033 
00034   void Hemispheres::calc(const Vector3& n, const vector<FourMomentum>& p4s) {
00035     MSG_DEBUG("Hemisphere axis = " << n);
00036     MSG_DEBUG("Number of constituents = " << p4s.size());
00037 
00038     FourMomentum p4With, p4Against;
00039     double Evis(0), broadWith(0), broadAgainst(0), broadDenom(0);
00040     foreach (const FourMomentum& p4, p4s) {
00041       const Vector3 p3 = p4.vector3();
00042       const double p3Para = dot(p3, n);
00043       const double p3Trans = (p3 - p3Para * n).mod();
00044 
00045       // Update normalisations
00046       Evis += p4.E();
00047       broadDenom += 2.0 * p3.mod();
00048 
00049       // Update the mass and broadening variables
00050       if (p3Para > 0) {
00051         p4With += p4;
00052         broadWith += p3Trans;
00053       } else if (p3Para < 0) {
00054         p4Against += p4;
00055         broadAgainst += p3Trans;
00056       } else {
00057         // In the incredibly unlikely event that a particle goes exactly along the
00058         // thrust plane, add half to each hemisphere.
00059         MSG_WARNING("Particle split between hemispheres");
00060         p4With += 0.5 * p4;
00061         p4Against += 0.5 * p4;
00062         broadWith += 0.5 * p3Trans;
00063         broadAgainst += 0.5 * p3Trans;
00064       }
00065     }
00066 
00067     // Visible energy squared.
00068     _E2vis = sqr(Evis);
00069 
00070     // Calculate masses.
00071     const double mass2With = p4With.mass2();
00072     const double mass2Against = p4Against.mass2();
00073     _M2high = max(mass2With, mass2Against);
00074     _M2low = min(mass2With, mass2Against);
00075 
00076     // Calculate broadenings.
00077     broadWith /= broadDenom;
00078     broadAgainst /= broadDenom;
00079     _Bmax = max(broadWith, broadAgainst);
00080     _Bmin = min(broadWith, broadAgainst);
00081 
00082     // Calculate high-max correlation flag.
00083     const int maxMassID = (mass2With >= mass2Against);
00084     const int maxBroadID = (broadWith >= broadAgainst);
00085     _highMassEqMaxBroad = (maxMassID == maxBroadID);
00086   }
00087 
00088 
00089 }