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