CMS 3D CMS Logo

GenJetParticleSelector Class Reference

#include <PhysicsTools/CandAlgos/interface/GenJetParticleSelector.h>

List of all members.

Public Member Functions

 GenJetParticleSelector (const edm::ParameterSet &)
void init (const edm::EventSetup &)
bool operator() (const reco::Candidate &)

Private Types

typedef std::vector< PdtEntryvpdt

Private Attributes

bool bInclude_
bool partons_
vpdt pdtList_
std::set< intpIds_
bool stableOnly_


Detailed Description

Definition at line 16 of file GenJetParticleSelector.h.


Member Typedef Documentation

typedef std::vector<PdtEntry> GenJetParticleSelector::vpdt [private]

Definition at line 22 of file GenJetParticleSelector.h.


Constructor & Destructor Documentation

GenJetParticleSelector::GenJetParticleSelector ( const edm::ParameterSet cfg  ) 

Definition at line 10 of file GenJetParticleSelector.cc.

References bInclude_, Exception, find(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), partons_, pdtList_, and stableOnly_.

00010                                                                       :
00011   stableOnly_(cfg.getParameter<bool>("stableOnly")),
00012   partons_(false), bInclude_(false) {
00013   const string excludeString("excludeList");
00014   const string includeString("includeList");
00015   vpdt includeList, excludeList;
00016   vector<string> vPdtParams = cfg.getParameterNamesForType<vpdt>();
00017   bool found = std::find(vPdtParams.begin(), vPdtParams.end(), includeString) != vPdtParams.end();
00018   if(found) includeList = cfg.getParameter<vpdt>(includeString);
00019   found = find(vPdtParams.begin(), vPdtParams.end(), excludeString) != vPdtParams.end();
00020   if(found) excludeList = cfg.getParameter<vpdt>(excludeString);
00021   const string partonsString("partons");
00022   vector<string> vBoolParams = cfg.getParameterNamesForType<bool>();
00023   found = find(vBoolParams.begin(), vBoolParams.end(), partonsString) != vBoolParams.end();
00024   if(found) partons_ = cfg.getParameter<bool>(partonsString);
00025   bool bExclude = false;
00026   if (includeList.size() > 0) bInclude_ = true;
00027   if (excludeList.size() > 0) bExclude = true;
00028 
00029   if (bInclude_ && bExclude) {
00030     throw cms::Exception("ConfigError", "not allowed to use both includeList and excludeList at the same time\n");
00031   }
00032   else if (bInclude_) {
00033     pdtList_ = includeList;
00034   }
00035   else {
00036     pdtList_ = excludeList;
00037   }
00038   if(stableOnly_ && partons_) {
00039     throw cms::Exception("ConfigError", "not allowed to have both stableOnly and partons true at the same time\n");
00040   }
00041 }


Member Function Documentation

void GenJetParticleSelector::init ( const edm::EventSetup es  ) 

Definition at line 57 of file GenJetParticleSelector.cc.

References i, and pdtList_.

Referenced by reco::modules::GenJetParticleSelectorEventSetupInit::init().

00057                                                          {
00058   for(vpdt::iterator i = pdtList_.begin(); i != pdtList_.end(); ++i )
00059     i->setup(es);
00060 }

bool GenJetParticleSelector::operator() ( const reco::Candidate p  ) 

Definition at line 43 of file GenJetParticleSelector.cc.

References funct::abs(), bInclude_, reco::Candidate::daughter(), reco::Candidate::numberOfDaughters(), partons_, reco::Particle::pdgId(), pIds_, stableOnly_, StDecayID::status, and reco::Particle::status().

00043                                                               {
00044   int status = p.status();
00045   int id = abs(p.pdgId());
00046   if((!stableOnly_ || status == 1) && !partons_ &&
00047      (pIds_.find(id) == pIds_.end() ^ bInclude_))
00048     return true;
00049   else if(partons_ &&
00050           (p.numberOfDaughters() > 0 && (p.daughter(0)->pdgId() == 91 || p.daughter(0)->pdgId() == 92)) &&
00051           ((pIds_.find(id) == pIds_.end() ^ bInclude_)))
00052     return true;
00053   else
00054     return false;
00055 }


Member Data Documentation

bool GenJetParticleSelector::bInclude_ [private]

Definition at line 26 of file GenJetParticleSelector.h.

Referenced by GenJetParticleSelector(), and operator()().

bool GenJetParticleSelector::partons_ [private]

Definition at line 24 of file GenJetParticleSelector.h.

Referenced by GenJetParticleSelector(), and operator()().

vpdt GenJetParticleSelector::pdtList_ [private]

Definition at line 25 of file GenJetParticleSelector.h.

Referenced by GenJetParticleSelector(), and init().

std::set<int> GenJetParticleSelector::pIds_ [private]

Definition at line 27 of file GenJetParticleSelector.h.

Referenced by operator()().

bool GenJetParticleSelector::stableOnly_ [private]

Definition at line 23 of file GenJetParticleSelector.h.

Referenced by GenJetParticleSelector(), and operator()().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:21:13 2009 for CMSSW by  doxygen 1.5.4