#ifdef USE_CDFEDM2 ////////////////////////////////////////////////////////////////////////// // // Component: SnowMassSummer.cc // Purpose: This class inherits from TowerSummer. Physics towers // are summed according to the Snowmass convention. // N.B. The four-vector will be massless // // Created: 20/09/99 Pierre Savard (based on Jodi Lamoureux's class) // History: // ////////////////////////////////////////////////////////////////////////// #include "Calor/SnowMassSummer.hh" Centroid SnowMassSummer::sumTowers(const PhysicsTowerView& view) const{ // Sum Et, eta, phi weighted by Et. if(view.size() == 0) { Centroid ctd(0.,0.,0.); return ctd; } // something is wrong here... Towers::const_iterator firstIter = view.begin(); float et =0.; float eta =0.; float phi =0.; for(Towers::const_iterator iter = view.begin(); iter != view.end(); ++iter) { et += (*iter)->totEt(); eta += (*iter)->totEt() * (*iter)->totEta(); float dphi = (*iter)->dPhi(*firstIter); phi += ((*iter)->totEt())*dphi; } if(et == 0.) { Centroid ctd(0.,0.,0.); return ctd; } eta = ( eta/et ); phi = ( (*firstIter)->totPhi() + phi/et ); if (phi < 0) phi = ( 2*PI + phi ); if (phi>2*PI) phi = ( phi - 2*PI ); return Centroid(eta,phi,et);; } HepLorentzVector SnowMassSummer::sumFourVector(const PhysicsTowerView& view) const{ if (view.size()==0) { HepLorentzVector vec(0.,0.,0.,0.); return vec; } // must assume that jets are massless. Centroid initSum = sumTowers(view); // calculate the other variables from Et, eta and phi. float theta = 2.*atan(exp(-initSum.eta())); float sinTheta = sin(theta); float energy; if (sinTheta>0) energy = initSum.et()/sinTheta; double e = energy; double pz = energy*cos( theta ); double px = initSum.et()*cos( initSum.phi() ); double py = initSum.et()*sin( initSum.phi() ); return HepLorentzVector(px,py,pz,e);; } #endif // USE_CDFEDM2