rivet is hosted by Hepforge, IPPP Durham
MergedFinalState.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Projections/MergedFinalState.hh"
00003 
00004 namespace Rivet {
00005 
00006 
00007   int MergedFinalState::compare(const Projection& p) const {
00008     /// @todo: Currently A+B is not recognised to be the same as B+A.
00009     return mkNamedPCmp(p, "FSA") || mkNamedPCmp(p, "FSB");
00010   }
00011 
00012 
00013   void MergedFinalState::project(const Event& e) {
00014     const FinalState& fsa = applyProjection<FinalState>(e, "FSA");
00015     const FinalState& fsb = applyProjection<FinalState>(e, "FSB");
00016     _theParticles.clear();
00017     foreach (const Particle& pa, fsa.particles()){
00018       _theParticles.push_back(pa);
00019     }
00020     foreach (const Particle& pb, fsb.particles()){
00021       const GenParticle* originalb = pb.genParticle();
00022       bool notfound = true;
00023       foreach (const Particle& pa, fsa.particles()){
00024         const GenParticle* originala = pa.genParticle();
00025         if (originala == originalb) {
00026           notfound = false;
00027           break;
00028         }
00029       }
00030       if (notfound) {
00031         _theParticles.push_back(pb);
00032       }
00033     }
00034     MSG_DEBUG("Number of particles in the two final states to be merged: = \n"
00035               << "   1st final state = " << fsa.particles().size() << "\n"
00036               << "   2nd final state = " << fsb.particles().size());
00037     MSG_DEBUG("Number of merged final-state particles = " << _theParticles.size());
00038   }
00039 
00040 
00041 }