TotalVisibleMomentum.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/Projections/TotalVisibleMomentum.hh"
00005 #include "Rivet/Cmp.hh"
00006 #include "HepPDT/ParticleID.hh"
00007 
00008 
00009 namespace Rivet {
00010 
00011   int TotalVisibleMomentum::compare(const Projection& p) const {
00012     const TotalVisibleMomentum& other = dynamic_cast<const TotalVisibleMomentum&>(p);
00013     return pcmp(*_fsproj, *other._fsproj);
00014   }
00015 
00016 
00017   void TotalVisibleMomentum::project(const Event& e) {
00018     Log& log = getLog();
00019 
00020     _momentum = LorentzVector();
00021     _momentum.setPx(0.0);
00022     _momentum.setPy(0.0);
00023     _momentum.setPz(0.0);
00024     _momentum.setE(0.0);
00025 
00026     _set = 0.;
00027 
00028     // Project into final state
00029     const FinalState& fs = e.applyProjection(*_fsproj);
00030 
00031     // Get hadron and charge info for each particle, and fill counters appropriately
00032     for (ParticleVector::const_iterator p = fs.particles().begin(); p != fs.particles().end(); ++p) {
00033       _momentum += p->getMomentum();
00034       _set += p->getMomentum().perp(); 
00035     }
00036 
00037     log << Log::DEBUG << "Done" << endl;
00038   }
00039 
00040 
00041 }