CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TxyCalculator Class Reference

#include <TxyCalculator.h>

List of all members.

Public Member Functions

double getHollSxy (const reco::Photon p, double thePtCut, double outerR, double innerR)
int getNumAllTracks (double ptCut)
int getNumLocalTracks (const reco::Photon p, double detaCut, double ptCut)
double getTxy (const reco::Photon p, double x, double y)
 TxyCalculator (const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel)

Private Member Functions

double calcDphi (double phi1_, double phi2_)
double dRDistance (double eta1, double phi1, double eta2, double phi2)

Private Attributes

edm::Handle
< reco::TrackCollection
recCollection

Detailed Description

Definition at line 27 of file TxyCalculator.h.


Constructor & Destructor Documentation

TxyCalculator::TxyCalculator ( const edm::Event iEvent,
const edm::EventSetup iSetup,
edm::InputTag  trackLabel 
)

Definition at line 14 of file TxyCalculator.cc.

References edm::Event::getByLabel().

{ 
   // Get reconstructed tracks
   iEvent.getByLabel(trackLabel, recCollection); // !!
} 

Member Function Documentation

double TxyCalculator::calcDphi ( double  phi1_,
double  phi2_ 
) [inline, private]

Definition at line 47 of file TxyCalculator.h.

References PI.

Referenced by dRDistance().

   {
       double dphi=phi1_-phi2_;

      if (dphi>0){
         while (dphi>2*PI) dphi-=2*PI;
         if (dphi>PI) dphi=2*PI-dphi; 
      } else {
         while (dphi<-2*PI) dphi+=2*PI;
         if (dphi<-PI) dphi=-2*PI-dphi;
      }
      return dphi;
   }
double TxyCalculator::dRDistance ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
) [inline, private]

Definition at line 39 of file TxyCalculator.h.

References calcDphi(), and mathSSE::sqrt().

   {
      double deta = eta1 - eta2;
      double dphi = (calcDphi(phi1, phi2));
      
      return sqrt(deta * deta + dphi * dphi);
   }
double TxyCalculator::getHollSxy ( const reco::Photon  p,
double  thePtCut,
double  outerR,
double  innerR 
)

Definition at line 93 of file TxyCalculator.cc.

References reco::LeafCandidate::eta(), reco::LeafCandidate::phi(), and dt_dqm_sourceclient_common_cff::reco.

{
   using namespace edm;
   using namespace reco;
   
   double eta1 = p.eta();
   double phi1 = p.phi();

   double ptSum = 0;

   for(reco::TrackCollection::const_iterator
          recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
      {
         double pt = recTrack->pt();
         double eta2 = recTrack->eta();
         double phi2 = recTrack->phi();
         if (dRDistance(eta1,phi1,eta2,phi2) >= outerR)
            continue;
         if (dRDistance(eta1,phi1,eta2,phi2) <= innerR)
            continue;
         if(pt > thePtCut)
            ptSum = ptSum + pt;
      }
   
   return ptSum;
}
int TxyCalculator::getNumAllTracks ( double  ptCut)

Definition at line 21 of file TxyCalculator.cc.

References dt_dqm_sourceclient_common_cff::reco.

{
  using namespace edm;
  using namespace reco;

  int nTracks = 0;
  
  for(reco::TrackCollection::const_iterator
        recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
    {
      double pt = recTrack->pt();
      if ( pt > ptCut)  
        nTracks = nTracks +1;
    }
  return nTracks;
}
int TxyCalculator::getNumLocalTracks ( const reco::Photon  p,
double  detaCut,
double  ptCut 
)

Definition at line 39 of file TxyCalculator.cc.

References reco::LeafCandidate::eta(), reco::LeafCandidate::phi(), and dt_dqm_sourceclient_common_cff::reco.

{
  using namespace edm;
  using namespace reco;

  int nTracks = 0;

  double eta1 = p.eta();
  double phi1 = p.phi();

  for(reco::TrackCollection::const_iterator
        recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
    {
      double pt = recTrack->pt();
      if ( (pt > ptCut) && ( fabs(eta1 - recTrack->eta()) < detaCut) && ( fabs(calcDphi(recTrack->phi(),phi1)) < 3.141592/2. ) )
        nTracks= nTracks +1;
    }
  return nTracks;
}
double TxyCalculator::getTxy ( const reco::Photon  p,
double  x,
double  y 
)

Definition at line 59 of file TxyCalculator.cc.

References reco::LeafCandidate::eta(), reco::LeafCandidate::phi(), and dt_dqm_sourceclient_common_cff::reco.

Referenced by HiEgammaIsolationProducer::produce().

{
   using namespace edm;
   using namespace reco;

   //   if(!recCollection)
   //    {
   //    LogError("TxyCalculator") << "Error! The track container is not found.";
   //    return -100;
   //   }
   

   double eta1 = p.eta();
   double phi1 = p.phi();
   
   float txy = 0;

   for(reco::TrackCollection::const_iterator
          recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
   {
      double pt = recTrack->pt();
      double eta2 = recTrack->eta();
      double phi2 = recTrack->phi();
      
      if(dRDistance(eta1,phi1,eta2,phi2) >= 0.1 * x)
         continue;

      if(pt > y * 0.4)
         txy = txy + 1;
   }

   return txy;
}

Member Data Documentation

Definition at line 62 of file TxyCalculator.h.