Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:22

0001 #include "L1Trigger/L1TNtuples/interface/L1AnalysisRecoElectron.h"
0002 
0003 using namespace std;
0004 
0005 L1Analysis::L1AnalysisRecoElectron::L1AnalysisRecoElectron() {}
0006 
0007 L1Analysis::L1AnalysisRecoElectron::~L1AnalysisRecoElectron() {}
0008 
0009 void L1Analysis::L1AnalysisRecoElectron::SetElectron(
0010     const edm::Event& event,
0011     const edm::EventSetup& setup,
0012     //const edm::Handle<edm::View<reco::GsfElectron>>& electrons,
0013     edm::Handle<reco::GsfElectronCollection> electrons,
0014     std::vector<edm::Handle<edm::ValueMap<bool> > > eleVIDDecisionHandles,
0015     const unsigned& maxElectron)
0016 
0017 {
0018   recoElectron_.nElectrons = 0;
0019 
0020   for (reco::GsfElectronCollection::const_iterator el = electrons->begin();
0021        el != electrons->end() && recoElectron_.nElectrons < maxElectron;
0022        ++el) {
0023     recoElectron_.e.push_back(el->energy());
0024     recoElectron_.pt.push_back(el->pt());
0025     recoElectron_.et.push_back(el->et());
0026     recoElectron_.eta.push_back(el->eta());
0027     recoElectron_.phi.push_back(el->phi());
0028     recoElectron_.eta_SC.push_back((el->superClusterPosition()).eta());
0029     recoElectron_.phi_SC.push_back((el->superClusterPosition()).phi());
0030     recoElectron_.e_ECAL.push_back(el->ecalEnergy());
0031     recoElectron_.e_SC.push_back(el->superCluster()->energy());
0032     recoElectron_.charge.push_back(el->charge());
0033 
0034     edm::Ref<reco::GsfElectronCollection> electronEdmRef(electrons, recoElectron_.nElectrons);
0035 
0036     recoElectron_.isVetoElectron.push_back((*(eleVIDDecisionHandles[0]))[electronEdmRef]);
0037     recoElectron_.isLooseElectron.push_back((*(eleVIDDecisionHandles[1]))[electronEdmRef]);
0038     recoElectron_.isMediumElectron.push_back((*(eleVIDDecisionHandles[2]))[electronEdmRef]);
0039     recoElectron_.isTightElectron.push_back((*(eleVIDDecisionHandles[3]))[electronEdmRef]);
0040 
0041     double iso = (el->pfIsolationVariables().sumChargedHadronPt +
0042                   max(el->pfIsolationVariables().sumNeutralHadronEt + el->pfIsolationVariables().sumPhotonEt -
0043                           0.5 * el->pfIsolationVariables().sumPUPt,
0044                       0.0)) /
0045                  el->pt();
0046 
0047     recoElectron_.iso.push_back(iso);
0048     // cout<<ConversionTools::hasMatchedConversion(*el,conversions,theBeamSpot->position())<<endl;
0049 
0050     recoElectron_.nElectrons++;
0051   }
0052   // for(reco::GsfElectronCollection::const_iterator it=electrons->begin();
0053   //     it!=electrons->end() && recoElectron_.nElectrons < maxElectron;
0054   //     ++it) {
0055 
0056   //   recoElectron_.e.push_back(it->energy());
0057   //   recoElectron_.pt.push_back(it->pt());
0058   //   recoElectron_.et.push_back(it->et());
0059   //   recoElectron_.eta.push_back(it->eta());
0060   //   recoElectron_.phi.push_back(it->phi());
0061 
0062   //   // cout<<it->superCluster().position().eta()<<endl;
0063   //   isVetoElectronCustom(*it, vertices, conversions, theBeamSpot, Rho);
0064 
0065   //   // cout<<ConversionTools::hasMatchedConversion(*it,conversions,theBeamSpot->position())<<endl;
0066 
0067   //   recoElectron_.nElectrons++;
0068 
0069   // }
0070 }