Hemispheres.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Projections/Hemispheres.hh"
00003 #include "Rivet/RivetCLHEP.hh"
00004 
00005 using namespace Rivet;
00006 using namespace std;
00007 
00008 
00009 void Hemispheres::project(const Event& e) {
00010   // Get thrust axes.
00011   const Thrust th = e.applyProjection(_thrustproj);
00012   const Vector3 nT = th.thrustAxis();
00013 
00014   LorentzVector p4With, p4Against;
00015   double Evis(0), broadWith(0), broadAgainst(0), broadDenom(0);
00016   const ParticleVector particles = e.applyProjection(_fsproj).particles();  
00017   for (ParticleVector::const_iterator p = particles.begin(); p != particles.end(); ++p) {
00018     const LorentzVector p4 = p->getMomentum();
00019     const Vector3 p3 = p4.vect();
00020     const double p3Mag = p3.mag();
00021     const double p3Para = p3.dot(nT);
00022     const double p3Trans = (p3 - p3Para * nT).mag();
00023 
00024     // Update normalisations
00025     Evis += p4.t();
00026     broadDenom += p3Mag;
00027 
00028     // Update the mass and broadening variables
00029     if (p3Para > 0) {
00030       p4With += p4;
00031       broadWith += p3Trans;
00032     } else if (p3Para < 0) {
00033       p4Against += p4;
00034       broadAgainst += p3Trans;
00035     } else {
00036       // In the incredibly unlikely event that a particle goes exactly along the
00037       // thrust plane, add half to each hemisphere.
00038       p4With += 0.5 * p4;
00039       p4Against += 0.5 * p4;
00040       broadWith += 0.5 * p3Trans;
00041       broadAgainst += 0.5 * p3Trans;
00042     }
00043   }
00044 
00045   // Visible energy squared.
00046   _E2vis = Evis * Evis;
00047 
00048   // Calculate masses.
00049   const double mass2With = p4With.mag2();
00050   const double mass2Against = p4Against.mag2();
00051   const bool withIsMaxMass2 = (mass2With > mass2Against);
00052   _M2high = (withIsMaxMass2) ? mass2With : mass2Against;
00053   _M2low = (withIsMaxMass2) ? mass2Against : mass2With;
00054 
00055   // Calculate broadenings.
00056   broadWith /= 2.0 * broadDenom;
00057   broadAgainst /= 2.0 * broadDenom;
00058   const bool withIsMaxBroad = (broadWith > broadAgainst);
00059   _Bmax = (withIsMaxBroad) ? broadWith : broadAgainst;
00060   _Bmin = (withIsMaxBroad) ? broadAgainst : broadWith;
00061 
00062   // Calculate high-max correlation flag.
00063   _highMassEqMaxBroad = (withIsMaxMass2 && withIsMaxBroad || !withIsMaxMass2 && !withIsMaxBroad);
00064 
00065 }