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 
00004 namespace Rivet {
00005 
00006 
00007   void Hemispheres::project(const Event& e) {
00008     clear();
00009 
00010     // Get thrust axes.
00011     const AxesDefinition& ax = applyProjection<AxesDefinition>(e, "Axes");
00012     const Vector3 n = ax.axis1();
00013     MSG_DEBUG("Thrust axis = " << n);
00014 
00015     FourMomentum p4With, p4Against;
00016     double Evis(0), broadWith(0), broadAgainst(0), broadDenom(0);
00017     const FinalState& fs = applyProjection<FinalState>(e, ax.getProjection("FS"));
00018     const Particles& particles = fs.particles();
00019     MSG_DEBUG("Number of particles = " << particles.size());
00020     foreach (const Particle& p, particles) {
00021       const FourMomentum p4 = p.momentum();
00022       const Vector3 p3 = p4.vector3();
00023       const double p3Mag = mod(p3);
00024       const double p3Para = dot(p3, n);
00025       const double p3Trans = mod(p3 - p3Para * n);
00026 
00027       // Update normalisations
00028       Evis += p4.E();
00029       broadDenom += 2.0 * p3Mag;
00030 
00031       // Update the mass and broadening variables
00032       if (p3Para > 0) {
00033         p4With += p4;
00034         broadWith += p3Trans;
00035       } else if (p3Para < 0) {
00036         p4Against += p4;
00037         broadAgainst += p3Trans;
00038       } else {
00039         // In the incredibly unlikely event that a particle goes exactly along the
00040         // thrust plane, add half to each hemisphere.
00041         MSG_WARNING("Particle split between hemispheres");
00042         p4With += 0.5 * p4;
00043         p4Against += 0.5 * p4;
00044         broadWith += 0.5 * p3Trans;
00045         broadAgainst += 0.5 * p3Trans;
00046       }
00047     }
00048 
00049     // Visible energy squared.
00050     _E2vis = Evis * Evis;
00051 
00052     // Calculate masses.
00053     const double mass2With = p4With.mass2();
00054     const double mass2Against = p4Against.mass2();
00055     _M2high = max(mass2With, mass2Against);
00056     _M2low = min(mass2With, mass2Against);
00057 
00058     // Calculate broadenings.
00059     broadWith /= broadDenom;
00060     broadAgainst /= broadDenom;
00061     _Bmax = max(broadWith, broadAgainst);
00062     _Bmin = min(broadWith, broadAgainst);
00063 
00064     // Calculate high-max correlation flag.
00065     const int maxMassID = (mass2With >= mass2Against);
00066     const int maxBroadID = (broadWith >= broadAgainst);
00067     _highMassEqMaxBroad = (maxMassID == maxBroadID);
00068   }
00069 
00070 
00071 }