CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
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().

12 {
13  std::vector<reco::GenParticleRef> associatedGenParticles = patTau.genParticleRefs();
14  for ( std::vector<reco::GenParticleRef>::const_iterator it = associatedGenParticles.begin();
15  it != associatedGenParticles.end(); ++it ) {
16  if ( it->isAvailable() ) {
17  const reco::GenParticleRef& genParticle = (*it);
18  if ( genParticle->pdgId() == -15 || genParticle->pdgId() == +15 ) return genParticle.get();
19  }
20  }
21 
22  return 0;
23 }
std::vector< reco::GenParticleRef > genParticleRefs() const
Definition: PATObject.h:678
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:241