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.
10 
11 using namespace edm;
12 using namespace reco;
13 
15 {
16  // Get reconstructed tracks
17  iEvent.getByLabel(trackLabel, recCollection); // !!
18 
19 }
20 
21 double dRxyCalculator::getDRxy(const reco::Photon p, double x, double y)
22 {
23  using namespace edm;
24  using namespace reco;
25 
26  double eta1 = p.eta();
27  double phi1 = p.phi();
28 
29  std::vector<double> Rxy;
30 
31  for(reco::TrackCollection::const_iterator
32  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
33  {
34  double pt = recTrack->pt();
35  double eta2 = recTrack->eta();
36  double phi2 = recTrack->phi();
37 
38  if(pt < x * 0.4)
39  continue;
40 
41  double dR = dRDistance(eta1,phi1,eta2,phi2);
42 
43  if(Rxy.size() < y+1)
44  {
45  Rxy.push_back(dR);
46  sort(Rxy.begin(), Rxy.end());
47  continue;
48  }
49 
50  if(dR < Rxy[Rxy.size()-1])
51  {
52  Rxy[Rxy.size()-1] = dR;
53  sort(Rxy.begin(), Rxy.end());
54  }
55  }
56 
57  double rxy = 4;
58  if (Rxy.size()<y) rxy=4; else rxy = Rxy[(int)y-1];
59  Rxy.clear();
60  return rxy;
61 }
62 
dRxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel)
virtual double eta() const
momentum pseudorapidity
int iEvent
Definition: GenABIO.cc:243
double getDRxy(const reco::Photon cluster, double x, double y)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
Definition: DDAxes.h:10
virtual double phi() const
momentum azimuthal angle