Go to the documentation of this file.00001 #include "RecoEgamma/Examples/plugins/ElectronIDAnalyzer.h"
00002 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00003 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00004 #include "DataFormats/Common/interface/ValueMap.h"
00005
00006 ElectronIDAnalyzer::ElectronIDAnalyzer(const edm::ParameterSet& conf) : conf_(conf) {
00007 electronProducer_=conf.getParameter<std::string>("electronProducer") ;
00008 electronLabelRobustLoose_=conf.getParameter<std::string>("electronLabelRobustLoose") ;
00009 electronLabelRobustTight_=conf.getParameter<std::string>("electronLabelRobustTight") ;
00010 electronLabelLoose_=conf.getParameter<std::string>("electronLabelLoose") ;
00011 electronLabelTight_=conf.getParameter<std::string>("electronLabelTight") ;
00012 }
00013
00014 void ElectronIDAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) {
00015
00016
00017 edm::Handle<reco::GsfElectronCollection> electrons ;
00018 e.getByLabel(electronProducer_,electrons) ;
00019
00020
00021 std::vector<edm::Handle<edm::ValueMap<float> > > eIDValueMap(4);
00022
00023 e.getByLabel( electronLabelRobustLoose_ , eIDValueMap[0] );
00024 const edm::ValueMap<float> & eIDmapRL = * eIDValueMap[0] ;
00025
00026 e.getByLabel( electronLabelRobustTight_ , eIDValueMap[1] );
00027 const edm::ValueMap<float> & eIDmapRT = * eIDValueMap[1] ;
00028
00029 e.getByLabel( electronLabelLoose_ , eIDValueMap[2] );
00030 const edm::ValueMap<float> & eIDmapL = * eIDValueMap[2] ;
00031
00032 e.getByLabel( electronLabelTight_ , eIDValueMap[3] );
00033 const edm::ValueMap<float> & eIDmapT = * eIDValueMap[3] ;
00034
00035
00036 for (unsigned int i = 0; i < electrons->size(); i++){
00037 edm::Ref<reco::GsfElectronCollection> electronRef(electrons,i);
00038 std::cout << "Event " << e.id()
00039 << " , electron " << i+1
00040 << " , Robust Loose = " << eIDmapRL[electronRef]
00041 << " , Robust Tight = " << eIDmapRT[electronRef]
00042 << " , Loose = " << eIDmapL[electronRef]
00043 << " , Tight = " << eIDmapT[electronRef]
00044 << std::endl;
00045 }
00046
00047 }