CMS 3D CMS Logo

AddFourMomenta.cc
Go to the documentation of this file.
1 // $Id: AddFourMomenta.cc,v 1.2 2009/09/29 12:24:45 llista Exp $
4 using namespace reco;
5 
6 void AddFourMomenta::set( Candidate & c ) const {
7  Candidate::LorentzVector p4( 0, 0, 0, 0 );
9  size_t n = c.numberOfDaughters();
10  for(size_t i = 0; i < n; ++i) {
11  const Candidate * d = (const_cast<const Candidate &>(c)).daughter(i);
12  p4 += d->p4();
13  charge += d->charge();
14  }
15  c.setP4( p4 );
16  c.setCharge( charge );
17 }
int Charge
electric charge type
Definition: Candidate.h:35
virtual void setP4(const LorentzVector &p4)=0
set 4-momentum
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
double p4[4]
Definition: TauolaWrapper.h:92
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
virtual int charge() const =0
electric charge
fixed size matrix
void set(reco::Candidate &c) const
set up a candidate
virtual size_type numberOfDaughters() const =0
number of daughters
virtual void setCharge(Charge q)=0
set electric charge