CMS 3D CMS Logo

Public Member Functions | Private Attributes

ElectronIDAnalyzer Class Reference

#include <ElectronIDAnalyzer.h>

Inheritance diagram for ElectronIDAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &e, const edm::EventSetup &c)
 ElectronIDAnalyzer (const edm::ParameterSet &conf)
virtual ~ElectronIDAnalyzer ()

Private Attributes

edm::ParameterSet conf_
std::string electronLabelLoose_
std::string electronLabelRobustLoose_
std::string electronLabelRobustTight_
std::string electronLabelTight_
std::string electronProducer_

Detailed Description

Definition at line 10 of file ElectronIDAnalyzer.h.


Constructor & Destructor Documentation

ElectronIDAnalyzer::ElectronIDAnalyzer ( const edm::ParameterSet conf) [explicit]

Definition at line 6 of file ElectronIDAnalyzer.cc.

References electronLabelLoose_, electronLabelRobustLoose_, electronLabelRobustTight_, electronLabelTight_, electronProducer_, and edm::ParameterSet::getParameter().

                                                                  : conf_(conf) {
  electronProducer_=conf.getParameter<std::string>("electronProducer") ;
  electronLabelRobustLoose_=conf.getParameter<std::string>("electronLabelRobustLoose") ;
  electronLabelRobustTight_=conf.getParameter<std::string>("electronLabelRobustTight") ; 
  electronLabelLoose_=conf.getParameter<std::string>("electronLabelLoose") ;
  electronLabelTight_=conf.getParameter<std::string>("electronLabelTight") ;
}  
virtual ElectronIDAnalyzer::~ElectronIDAnalyzer ( ) [inline, virtual]

Definition at line 15 of file ElectronIDAnalyzer.h.

{};

Member Function Documentation

void ElectronIDAnalyzer::analyze ( const edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 14 of file ElectronIDAnalyzer.cc.

References gather_cfg::cout, electronLabelLoose_, electronLabelRobustLoose_, electronLabelRobustTight_, electronLabelTight_, electronProducer_, HI_PhotonSkim_cff::electrons, edm::Event::getByLabel(), i, and edm::EventBase::id().

                                                                          {

  //Read selectrons
  edm::Handle<reco::GsfElectronCollection> electrons ;
  e.getByLabel(electronProducer_,electrons) ;

  //Read eID results
  std::vector<edm::Handle<edm::ValueMap<float> > > eIDValueMap(4); 
  //Robust-Loose 
  e.getByLabel( electronLabelRobustLoose_ , eIDValueMap[0] ); 
  const edm::ValueMap<float> & eIDmapRL = * eIDValueMap[0] ;
  //Robust-Tight 
  e.getByLabel( electronLabelRobustTight_ , eIDValueMap[1] ); 
  const edm::ValueMap<float> & eIDmapRT = * eIDValueMap[1] ;
  //Loose 
  e.getByLabel( electronLabelLoose_ , eIDValueMap[2] ); 
  const edm::ValueMap<float> & eIDmapL = * eIDValueMap[2] ;
  //Tight 
  e.getByLabel( electronLabelTight_ , eIDValueMap[3] ); 
  const edm::ValueMap<float> & eIDmapT = * eIDValueMap[3] ;

  // Loop over electrons
  for (unsigned int i = 0; i < electrons->size(); i++){
    edm::Ref<reco::GsfElectronCollection> electronRef(electrons,i);
    std::cout << "Event " << e.id() 
              << " , electron " << i+1 
              << " , Robust Loose = " << eIDmapRL[electronRef] 
              << " , Robust Tight = " << eIDmapRT[electronRef] 
              << " , Loose = " << eIDmapL[electronRef] 
              << " , Tight = " << eIDmapT[electronRef] 
              << std::endl;
  }

}

Member Data Documentation

Definition at line 21 of file ElectronIDAnalyzer.h.

Definition at line 27 of file ElectronIDAnalyzer.h.

Referenced by analyze(), and ElectronIDAnalyzer().

Definition at line 25 of file ElectronIDAnalyzer.h.

Referenced by analyze(), and ElectronIDAnalyzer().

Definition at line 26 of file ElectronIDAnalyzer.h.

Referenced by analyze(), and ElectronIDAnalyzer().

Definition at line 28 of file ElectronIDAnalyzer.h.

Referenced by analyze(), and ElectronIDAnalyzer().

Definition at line 23 of file ElectronIDAnalyzer.h.

Referenced by analyze(), and ElectronIDAnalyzer().