CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1AnalysisRecoElectron.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 
6 
8 
10  const edm::Event& event,
11  const edm::EventSetup& setup,
12  //const edm::Handle<edm::View<reco::GsfElectron>>& electrons,
14  std::vector<edm::Handle<edm::ValueMap<bool> > > eleVIDDecisionHandles,
15  const unsigned& maxElectron)
16 
17 {
18  recoElectron_.nElectrons = 0;
19 
20  for (reco::GsfElectronCollection::const_iterator el = electrons->begin();
21  el != electrons->end() && recoElectron_.nElectrons < maxElectron;
22  ++el) {
23  recoElectron_.e.push_back(el->energy());
24  recoElectron_.pt.push_back(el->pt());
25  recoElectron_.et.push_back(el->et());
26  recoElectron_.eta.push_back(el->eta());
27  recoElectron_.phi.push_back(el->phi());
28  recoElectron_.eta_SC.push_back((el->superClusterPosition()).eta());
29  recoElectron_.phi_SC.push_back((el->superClusterPosition()).phi());
30  recoElectron_.e_ECAL.push_back(el->ecalEnergy());
31  recoElectron_.e_SC.push_back(el->superCluster()->energy());
32  recoElectron_.charge.push_back(el->charge());
33 
34  edm::Ref<reco::GsfElectronCollection> electronEdmRef(electrons, recoElectron_.nElectrons);
35 
36  recoElectron_.isVetoElectron.push_back((*(eleVIDDecisionHandles[0]))[electronEdmRef]);
37  recoElectron_.isLooseElectron.push_back((*(eleVIDDecisionHandles[1]))[electronEdmRef]);
38  recoElectron_.isMediumElectron.push_back((*(eleVIDDecisionHandles[2]))[electronEdmRef]);
39  recoElectron_.isTightElectron.push_back((*(eleVIDDecisionHandles[3]))[electronEdmRef]);
40 
41  double iso = (el->pfIsolationVariables().sumChargedHadronPt +
42  max(el->pfIsolationVariables().sumNeutralHadronEt + el->pfIsolationVariables().sumPhotonEt -
43  0.5 * el->pfIsolationVariables().sumPUPt,
44  0.0)) /
45  el->pt();
46 
47  recoElectron_.iso.push_back(iso);
48  // cout<<ConversionTools::hasMatchedConversion(*el,conversions,theBeamSpot->position())<<endl;
49 
50  recoElectron_.nElectrons++;
51  }
52  // for(reco::GsfElectronCollection::const_iterator it=electrons->begin();
53  // it!=electrons->end() && recoElectron_.nElectrons < maxElectron;
54  // ++it) {
55 
56  // recoElectron_.e.push_back(it->energy());
57  // recoElectron_.pt.push_back(it->pt());
58  // recoElectron_.et.push_back(it->et());
59  // recoElectron_.eta.push_back(it->eta());
60  // recoElectron_.phi.push_back(it->phi());
61 
62  // // cout<<it->superCluster().position().eta()<<endl;
63  // isVetoElectronCustom(*it, vertices, conversions, theBeamSpot, Rho);
64 
65  // // cout<<ConversionTools::hasMatchedConversion(*it,conversions,theBeamSpot->position())<<endl;
66 
67  // recoElectron_.nElectrons++;
68 
69  // }
70 }
void SetElectron(const edm::Event &event, const edm::EventSetup &setup, const edm::Handle< reco::GsfElectronCollection > electrons, const std::vector< edm::Handle< edm::ValueMap< bool > > > eleVIDDecisionHandles, const unsigned &maxElectron)