CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TxyCalculator Class Reference

#include <TxyCalculator.h>

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, const 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,
const edm::InputTag trackLabel 
)

Definition at line 13 of file TxyCalculator.cc.

References edm::Event::getByLabel().

14 {
15  // Get reconstructed tracks
16  iEvent.getByLabel(trackLabel, recCollection); // !!
17 }
edm::Handle< reco::TrackCollection > recCollection
Definition: TxyCalculator.h:62
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390

Member Function Documentation

double TxyCalculator::calcDphi ( double  phi1_,
double  phi2_ 
)
inlineprivate

Definition at line 47 of file TxyCalculator.h.

References PI.

Referenced by dRDistance().

48  {
49  double dphi=phi1_-phi2_;
50 
51  if (dphi>0){
52  while (dphi>2*PI) dphi-=2*PI;
53  if (dphi>PI) dphi=2*PI-dphi;
54  } else {
55  while (dphi<-2*PI) dphi+=2*PI;
56  if (dphi<-PI) dphi=-2*PI-dphi;
57  }
58  return dphi;
59  }
#define PI
double TxyCalculator::dRDistance ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)
inlineprivate

Definition at line 39 of file TxyCalculator.h.

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

40  {
41  double deta = eta1 - eta2;
42  double dphi = (calcDphi(phi1, phi2));
43 
44  return sqrt(deta * deta + dphi * dphi);
45  }
T sqrt(T t)
Definition: SSEVec.h:48
double calcDphi(double phi1_, double phi2_)
Definition: TxyCalculator.h:47
double TxyCalculator::getHollSxy ( const reco::Photon p,
double  thePtCut,
double  outerR,
double  innerR 
)

Definition at line 92 of file TxyCalculator.cc.

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

93 {
94  using namespace edm;
95  using namespace reco;
96 
97  double eta1 = p.eta();
98  double phi1 = p.phi();
99 
100  double ptSum = 0;
101 
102  for(reco::TrackCollection::const_iterator
103  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
104  {
105  double pt = recTrack->pt();
106  double eta2 = recTrack->eta();
107  double phi2 = recTrack->phi();
108  if (dRDistance(eta1,phi1,eta2,phi2) >= outerR)
109  continue;
110  if (dRDistance(eta1,phi1,eta2,phi2) <= innerR)
111  continue;
112  if(pt > thePtCut)
113  ptSum = ptSum + pt;
114  }
115 
116  return ptSum;
117 }
double dRDistance(double eta1, double phi1, double eta2, double phi2)
Definition: TxyCalculator.h:39
edm::Handle< reco::TrackCollection > recCollection
Definition: TxyCalculator.h:62
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
int TxyCalculator::getNumAllTracks ( double  ptCut)

Definition at line 20 of file TxyCalculator.cc.

References RecoTauCleanerPlugins::pt, and dt_dqm_sourceclient_common_cff::reco.

21 {
22  using namespace edm;
23  using namespace reco;
24 
25  int nTracks = 0;
26 
27  for(reco::TrackCollection::const_iterator
28  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
29  {
30  double pt = recTrack->pt();
31  if ( pt > ptCut)
32  nTracks = nTracks +1;
33  }
34  return nTracks;
35 }
edm::Handle< reco::TrackCollection > recCollection
Definition: TxyCalculator.h:62
int TxyCalculator::getNumLocalTracks ( const reco::Photon p,
double  detaCut,
double  ptCut 
)

Definition at line 38 of file TxyCalculator.cc.

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

39 {
40  using namespace edm;
41  using namespace reco;
42 
43  int nTracks = 0;
44 
45  double eta1 = p.eta();
46  double phi1 = p.phi();
47 
48  for(reco::TrackCollection::const_iterator
49  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
50  {
51  double pt = recTrack->pt();
52  if ( (pt > ptCut) && ( fabs(eta1 - recTrack->eta()) < detaCut) && ( fabs(calcDphi(recTrack->phi(),phi1)) < 3.141592/2. ) )
53  nTracks= nTracks +1;
54  }
55  return nTracks;
56 }
edm::Handle< reco::TrackCollection > recCollection
Definition: TxyCalculator.h:62
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
double calcDphi(double phi1_, double phi2_)
Definition: TxyCalculator.h:47
double TxyCalculator::getTxy ( const reco::Photon p,
double  x,
double  y 
)

Definition at line 58 of file TxyCalculator.cc.

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

Referenced by HiEgammaIsolationProducer::produce().

59 {
60  using namespace edm;
61  using namespace reco;
62 
63  // if(!recCollection)
64  // {
65  // LogError("TxyCalculator") << "Error! The track container is not found.";
66  // return -100;
67  // }
68 
69 
70  double eta1 = p.eta();
71  double phi1 = p.phi();
72 
73  float txy = 0;
74 
75  for(reco::TrackCollection::const_iterator
76  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
77  {
78  double pt = recTrack->pt();
79  double eta2 = recTrack->eta();
80  double phi2 = recTrack->phi();
81 
82  if(dRDistance(eta1,phi1,eta2,phi2) >= 0.1 * x)
83  continue;
84 
85  if(pt > y * 0.4)
86  txy = txy + 1;
87  }
88 
89  return txy;
90 }
double dRDistance(double eta1, double phi1, double eta2, double phi2)
Definition: TxyCalculator.h:39
edm::Handle< reco::TrackCollection > recCollection
Definition: TxyCalculator.h:62
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
Definition: DDAxes.h:10

Member Data Documentation

edm::Handle<reco::TrackCollection> TxyCalculator::recCollection
private

Definition at line 62 of file TxyCalculator.h.