rivet is hosted by Hepforge, IPPP Durham
DISLepton.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Projections/DISLepton.hh"
00003 
00004 namespace Rivet {
00005 
00006 
00007   int DISLepton::compare(const Projection& p) const {
00008     const DISLepton& other = pcast<DISLepton>(p);
00009     return mkNamedPCmp(other, "Beam") || mkNamedPCmp(other, "FS");
00010   }
00011 
00012 
00013   void DISLepton::project(const Event& e) {
00014     const ParticlePair& inc = applyProjection<Beam>(e, "Beam").beams();
00015 
00016     Particle inLepton;
00017 
00018     bool firstIsLepton = PID::isLepton(inc.first.pdgId());
00019     bool secondIsLepton = PID::isLepton(inc.second.pdgId());
00020 
00021     if (firstIsLepton && !secondIsLepton) {
00022       _incoming = inc.first;
00023     } else if (!firstIsLepton && secondIsLepton) {
00024       _incoming = inc.second;
00025     } else {
00026       //eek!
00027       throw Error("DISLepton projector could not find the correct beam.");
00028     }
00029 
00030     _sign = (_incoming.momentum().pz() > 0.0)? 1.0: -1.0;
00031     long id = _incoming.pdgId();
00032 
00033     double pzMax = -1000000000.0;
00034 
00035     const FinalState& fs = applyProjection<FinalState>(e, "FS");
00036     foreach (const Particle& p, fs.particles()) {
00037       double pz = _sign * p.momentum().pz();
00038       if (p.pdgId() == id && pz > pzMax) {
00039         _outgoing = p;
00040         pzMax = pz;
00041       }
00042     }
00043 
00044     if (_outgoing.genParticle() == NULL) {
00045       throw Error("DISLepton projector could not find the scattered lepton.");
00046     }
00047   }
00048 
00049 
00050 }