CMS 3D CMS Logo

Functions

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/PhysicsTools/PatExamples/plugins/PatTauAnalyzer.cc File Reference

#include "PhysicsTools/PatExamples/plugins/PatTauAnalyzer.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "DataFormats/PatCandidates/interface/Tau.h"
#include <TMath.h>
#include "FWCore/Framework/interface/MakerMacros.h"

Go to the source code of this file.

Functions

 DEFINE_FWK_MODULE (PatTauAnalyzer)
const reco::GenParticlegetGenTau (const pat::Tau &patTau)

Function Documentation

DEFINE_FWK_MODULE ( PatTauAnalyzer  )
const reco::GenParticle* getGenTau ( const pat::Tau patTau)

Definition at line 11 of file PatTauAnalyzer.cc.

References pat::PATObject< ObjectType >::genParticleRefs(), and edm::Ref< C, T, F >::get().

Referenced by PatTauAnalyzer::analyze().

{
  std::vector<reco::GenParticleRef> associatedGenParticles = patTau.genParticleRefs();
  for ( std::vector<reco::GenParticleRef>::const_iterator it = associatedGenParticles.begin(); 
        it != associatedGenParticles.end(); ++it ) {
    if ( it->isAvailable() ) {
      const reco::GenParticleRef& genParticle = (*it);
      if ( genParticle->pdgId() == -15 || genParticle->pdgId() == +15 ) return genParticle.get();
    }
  }

  return 0;
}