CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
dRxyCalculator.cc
Go to the documentation of this file.
9 
10 using namespace edm;
11 using namespace reco;
12 
14 {
15  // Get reconstructed tracks
16  iEvent.getByLabel(trackLabel, recCollection); // !!
17 
18 }
19 
20 double dRxyCalculator::getDRxy(const reco::Photon& p, double x, double y)
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 }
61 
double getDRxy(const reco::Photon &cluster, double x, double y)
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
int iEvent
Definition: GenABIO.cc:243
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
Definition: DDAxes.h:10
dRxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::InputTag &trackLabel)