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
dRxyCalculator Class Reference

#include <dRxyCalculator.h>

Public Member Functions

 dRxyCalculator (const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::InputTag &trackLabel)
 
double getDRxy (const reco::Photon &cluster, double x, double y)
 

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 26 of file dRxyCalculator.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file dRxyCalculator.cc.

References edm::Event::getByLabel().

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

Member Function Documentation

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

Definition at line 41 of file dRxyCalculator.h.

References PI.

Referenced by dRDistance().

42  {
43  double dphi=phi1_-phi2_;
44 
45  if (dphi>0){
46  while (dphi>2*PI) dphi-=2*PI;
47  if (dphi>PI) dphi=2*PI-dphi;
48  } else {
49  while (dphi<-2*PI) dphi+=2*PI;
50  if (dphi<-PI) dphi=-2*PI-dphi;
51  }
52  return dphi;
53  }
#define PI
double dRxyCalculator::dRDistance ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)
inlineprivate

Definition at line 33 of file dRxyCalculator.h.

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

34  {
35  double deta = eta1 - eta2;
36  double dphi = (calcDphi(phi1, phi2));
37 
38  return sqrt(deta * deta + dphi * dphi);
39  }
T sqrt(T t)
Definition: SSEVec.h:48
double calcDphi(double phi1_, double phi2_)
double dRxyCalculator::getDRxy ( const reco::Photon cluster,
double  x,
double  y 
)

Definition at line 20 of file dRxyCalculator.cc.

References PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::LeafCandidate::eta(), reco::LeafCandidate::phi(), RecoTauCleanerPlugins::pt, dt_dqm_sourceclient_common_cff::reco, python.multivaluedict::sort(), and detailsBasic3DVector::y.

Referenced by HiEgammaIsolationProducer::produce().

21 {
22  using namespace edm;
23  using namespace reco;
24 
25  double eta1 = p.eta();
26  double phi1 = p.phi();
27 
28  std::vector<double> Rxy;
29 
30  for(reco::TrackCollection::const_iterator
31  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
32  {
33  double pt = recTrack->pt();
34  double eta2 = recTrack->eta();
35  double phi2 = recTrack->phi();
36 
37  if(pt < x * 0.4)
38  continue;
39 
40  double dR = dRDistance(eta1,phi1,eta2,phi2);
41 
42  if(Rxy.size() < y+1)
43  {
44  Rxy.push_back(dR);
45  sort(Rxy.begin(), Rxy.end());
46  continue;
47  }
48 
49  if(dR < Rxy[Rxy.size()-1])
50  {
51  Rxy[Rxy.size()-1] = dR;
52  sort(Rxy.begin(), Rxy.end());
53  }
54  }
55 
56  double rxy = 4;
57  if (Rxy.size()<y) rxy=4; else rxy = Rxy[(int)y-1];
58  Rxy.clear();
59  return rxy;
60 }
edm::Handle< reco::TrackCollection > recCollection
Definition: DDAxes.h:10
double dRDistance(double eta1, double phi1, double eta2, double phi2)

Member Data Documentation

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

Definition at line 56 of file dRxyCalculator.h.