CMS 3D CMS Logo

AddFourMomenta.cc

Go to the documentation of this file.
00001 // $Id: AddFourMomenta.cc,v 1.8 2007/09/27 13:55:04 llista Exp $
00002 #include "PhysicsTools/CandUtils/interface/AddFourMomenta.h"
00003 #include "DataFormats/Candidate/interface/Candidate.h"
00004 
00005 using namespace reco;
00006 
00007 void AddFourMomenta::set( Candidate & c ) const {
00008   Candidate::LorentzVector p4( 0, 0, 0, 0 );
00009   Candidate::Charge charge = 0;
00010   Candidate::iterator b = c.begin(), e = c.end(); 
00011   for(  Candidate::iterator d = b; d != e; ++ d ) {
00012     p4 += d->p4();
00013     charge += d->charge();
00014   }
00015   c.setP4( p4 );
00016   c.setCharge( charge );
00017 }

Generated on Tue Jun 9 17:41:04 2009 for CMSSW by  doxygen 1.5.4