test
CMS 3D CMS Logo

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

#include <PFElToElAssMaker.h>

Public Member Functions

 PFElToElAssMaker ()
 
void SetVars (HWW &, const edm::Event &, const edm::EventSetup &)
 

Detailed Description

Definition at line 7 of file PFElToElAssMaker.h.

Constructor & Destructor Documentation

PFElToElAssMaker::PFElToElAssMaker ( )
inline

Definition at line 11 of file PFElToElAssMaker.h.

11 {};

Member Function Documentation

void PFElToElAssMaker::SetVars ( HWW hww,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 7 of file PFElToElAssMaker.cc.

References deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, HWW::els_p4(), i, cmsHarvester::index, HWW::Load_pfels_elsidx(), HWW::pfels_elsidx(), and HWW::pfels_p4().

Referenced by HWWAnalyzer::analyze().

7  {
8 
9  using namespace edm;
10  using std::vector;
11 
12  hww.Load_pfels_elsidx();
13 
14  vector<LorentzVector> *pfels_p4_h = new vector<LorentzVector>;
15  *pfels_p4_h = hww.pfels_p4();
16 
17  vector<LorentzVector> *els_p4_h = new vector<LorentzVector>;
18  *els_p4_h = hww.els_p4();
19 
20  //loop over reco electrons and find the closest particle flow electron
21  for (vector<LorentzVector>::const_iterator pfels_it = pfels_p4_h->begin(); pfels_it != pfels_p4_h->end(); pfels_it++) {
22 
23  double pfel_eta = pfels_it->Eta();
24  double pfel_phi = pfels_it->Phi();
25 
26  double minDR = 9999.;
27  unsigned int i = 0;
28  int index = -1;
29 
30  for (vector<LorentzVector>::const_iterator els_it = els_p4_h->begin(); els_it != els_p4_h->end(); els_it++, i++) {
31 
32  double el_eta = els_it->Eta();
33  double el_phi = els_it->Phi();
34  double dR = deltaR(pfel_eta, pfel_phi, el_eta, el_phi);
35 
36  if(dR < minDR) {
37  minDR = dR;
38  index = i;
39  }
40 
41  }
42 
43  if(minDR > 0.1) {
44  minDR = -9999.;
45  index = -1;
46  }
47 
48  hww.pfels_elsidx().push_back(index);
49 
50  }
51 
52 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > & pfels_elsidx()
Definition: HWW.cc:749
void Load_pfels_elsidx()
Definition: HWW.cc:1349
std::vector< LorentzVector > & pfels_p4()
Definition: HWW.cc:753
std::vector< LorentzVector > & els_p4()
Definition: HWW.cc:101
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17