CMS 3D CMS Logo

Pi0.cc

Go to the documentation of this file.
00001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00002 #include "RecoTauTag/Pi0Tau/interface/Pi0.h"
00003 
00004 using namespace reco;
00005 
00006 Pi0::Pi0(){
00007   type_ = 0;
00008   energy_ = 0.0;
00009   position_ *= 0;
00010   momentum_ *= 0;
00011   sourceCandidates_.clear();
00012 }
00013 
00014 
00015 Pi0::Pi0(int type, double e, math::XYZPoint pos, math::XYZTLorentzVector mom, reco::PFCandidateRefVector &source_candidates){
00016   type_ = type;
00017   energy_ = e;
00018   position_ = pos;
00019   momentum_ = mom;
00020   sourceCandidates_ = source_candidates;
00021 }
00022   
00023 
00024 Pi0::Pi0(const Pi0& other){
00025   type_ = other.type();
00026   energy_ = other.energy();
00027   position_ = other.position();
00028   momentum_ = other.momentum();
00029   sourceCandidates_ = other.sourceCandidates();
00030 }
00031 
00032 
00033 math::XYZTLorentzVector Pi0::momentum(const math::XYZPoint &vtx) const {
00034 
00035   math::XYZTLorentzVector p4(0.0,0.0,0.0,0.0);
00036 
00037   double mag = momentum_.E();
00038   if(mag <= 0.0) return p4;
00039 
00040   if(mag > PI0MASS) mag = sqrt(mag*mag - PI0MASS*PI0MASS);
00041 
00042   math::XYZPoint p3(position_ - vtx);
00043   if(p3.R() == 0.0) return math::XYZTLorentzVector(0.0,0.0,0.0,0.0);
00044 
00045   p3 *= mag/p3.R();
00046   p4.SetCoordinates(p3.X(),p3.Y(),p3.Z(),momentum_.E());
00047 
00048   return p4;
00049 
00050 }
00051 
00052 
00053 std::ostream& reco::operator<<(std::ostream& out, 
00054                                const Pi0& pi0) {  
00055   if (!out) return out;  
00056 
00057   out << "type : " << pi0.type_
00058       << ", energy : "<< pi0.energy()
00059       << ", position = (" << pi0.position().X()
00060       << "," << pi0.position().Y()
00061       << "," << pi0.position().Z()
00062       << ")" 
00063       << std::endl;
00064 
00065   return out;
00066 }

Generated on Tue Jun 9 17:45:00 2009 for CMSSW by  doxygen 1.5.4