CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/RecoTauTag/HLTProducers/src/L2TauIsolationAlgs.cc

Go to the documentation of this file.
00001 #include "RecoTauTag/HLTProducers/interface/L2TauIsolationAlgs.h"
00002 #include "Math/GenVector/VectorUtil.h"
00003 
00004 
00005 L2TauIsolationAlgs::L2TauIsolationAlgs()
00006 {
00007 
00008 }
00009 
00010 L2TauIsolationAlgs::~L2TauIsolationAlgs()
00011 {
00012 
00013 }
00014 
00015 
00016 
00017 double 
00018 L2TauIsolationAlgs::isolatedEt(const math::PtEtaPhiELorentzVectorCollection& hits,const math::XYZVector& direction,double innerCone, double outerCone) const
00019 {
00020   //Compute the Isolation
00021   double eRMax = 0.;
00022   double eRMin = 0;
00023   if(hits.size()>0)
00024     for (math::PtEtaPhiELorentzVectorCollection::const_iterator mRH = hits.begin();mRH!=hits.end();++mRH)
00025     {
00026           double delta = ROOT::Math::VectorUtil::DeltaR(direction,(*mRH));
00027           if(delta <outerCone)
00028             eRMax+= mRH->pt();
00029           if(delta <innerCone)
00030             eRMin+= mRH->pt();
00031     }
00032   double etIsol = eRMax - eRMin;
00033   return etIsol;
00034 }
00035 
00036 
00037 int 
00038 L2TauIsolationAlgs::nClustersAnnulus(const math::PtEtaPhiELorentzVectorCollection& hits,const math::XYZVector& direction,double innerCone, double outerCone) const
00039 {
00040   //Compute the Isolation
00041   int cands=0;
00042   if(hits.size()>0)
00043     for (math::PtEtaPhiELorentzVectorCollection::const_iterator mRH = hits.begin();mRH!=hits.end();++mRH)
00044     {
00045           double delta = ROOT::Math::VectorUtil::DeltaR(direction,(*mRH));
00046           if(delta <outerCone)
00047             if(delta >innerCone)
00048               cands++;
00049     }
00050   return cands;
00051 }
00052 
00053 
00054 std::vector<double> 
00055 L2TauIsolationAlgs::clusterShape(const math::PtEtaPhiELorentzVectorCollection& hits,const math::XYZVector& direction,double innerCone,double outerCone) const
00056 {
00057   double eta_rms=0.;
00058   double phi_rms=0.;
00059   double dr_rms=0.;
00060   double sumpt = 0.;
00061 
00062   std::vector<double> rmsVector; //declare the vector
00063   if(hits.size()>0)
00064     {
00065       for(math::PtEtaPhiELorentzVectorCollection::const_iterator  c = hits.begin();c!=hits.end();++c) //loop on clusters
00066         {
00067           eta_rms+=c->pt()*std::pow(c->eta()-direction.eta(),2);
00068           phi_rms+=c->pt()*std::pow(ROOT::Math::VectorUtil::DeltaPhi(*c,direction),2);
00069           dr_rms+=c->pt()*std::pow(ROOT::Math::VectorUtil::DeltaR(*c,direction),2);
00070           sumpt+=c->pt();                          
00071         }
00072     }
00073   else
00074     {
00075       eta_rms=0.;
00076       phi_rms=0.;
00077       dr_rms =0.;
00078       sumpt=1.;
00079     }
00080 
00081   rmsVector.push_back(eta_rms/sumpt);
00082   rmsVector.push_back(phi_rms/sumpt);
00083   rmsVector.push_back(dr_rms/sumpt);
00084 
00085   return rmsVector;
00086 }
00087