CMS 3D CMS Logo

PartonSelector Class Reference

Inheritance diagram for PartonSelector:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 PartonSelector (const edm::ParameterSet &)
 ~PartonSelector ()

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

bool withLeptons
bool withTop


Detailed Description

Definition at line 36 of file PartonSelector.cc.


Constructor & Destructor Documentation

PartonSelector::PartonSelector ( const edm::ParameterSet iConfig  ) 

Definition at line 50 of file PartonSelector.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), withLeptons, and withTop.

00051 { 
00052     produces<reco::GenParticleRefVector>();
00053     withLeptons         = iConfig.getParameter<bool>("withLeptons"); 
00054     if ( iConfig.exists("withTop") ) {
00055       withTop = iConfig.getParameter<bool>("withTop");
00056     } else {
00057       withTop = false;
00058     }
00059 }

PartonSelector::~PartonSelector (  ) 

Definition at line 63 of file PartonSelector.cc.

00064 {
00065 }


Member Function Documentation

void PartonSelector::produce ( edm::Event iEvent,
const edm::EventSetup iEs 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 69 of file PartonSelector.cc.

References funct::abs(), reco::CompositeRefCandidateT< D >::daughter(), flavour, edm::Event::getByLabel(), m, reco::CompositeRefCandidateT< D >::numberOfDaughters(), reco::Particle::pdgId(), edm::Event::put(), reco::Particle::status(), withLeptons, and withTop.

00070 {
00071   
00072   //edm::Handle <reco::CandidateView> particles;
00073   edm::Handle <reco::GenParticleCollection> particles;
00074   iEvent.getByLabel ("genParticles", particles );  
00075   edm::LogVerbatim("PartonSelector") << "=== GenParticle size:" << particles->size();
00076   int nPart=0; 
00077 
00078   auto_ptr<GenParticleRefVector> thePartons ( new GenParticleRefVector);  
00079   
00080   for (size_t m = 0; m < particles->size(); m++) {
00081     
00082     // Don't take into account first 6 particles in generator list
00083     if (m<6) continue;    
00084 
00085     const GenParticle & aParticle = (*particles)[ m ];
00086 
00087     bool isAParton = false;
00088     bool isALepton = false;
00089     int flavour = abs(aParticle.pdgId());
00090     if(flavour == 1 ||
00091        flavour == 2 ||
00092        flavour == 3 ||
00093        flavour == 4 ||
00094        flavour == 5 ||  
00095        (flavour == 6 && withTop) ||
00096        flavour == 21 ) isAParton = true;
00097     if(flavour == 11 ||
00098        flavour == 12 ||
00099        flavour == 13 ||
00100        flavour == 14 ||
00101        flavour == 15 ||
00102        flavour == 16 ) isALepton = true;
00103 
00104 
00105     //Add Partons status 3
00106     if( aParticle.status() == 3 && isAParton ) {
00107       thePartons->push_back( GenParticleRef( particles, m ) );
00108       nPart++;
00109     }
00110 
00111     //Add Partons stauts 2
00112     if(   aParticle.numberOfDaughters() > 0  && 
00113         ( aParticle.daughter(0)->pdgId() == 91 || aParticle.daughter(0)->pdgId() == 92 ) ) {
00114       thePartons->push_back( GenParticleRef( particles, m ) );
00115       nPart++;
00116     }
00117 
00118     //Add Leptons
00119     // Here you have to decide what to do with taus....
00120     // Now all leptons, including e and mu from leptonic tau decays, are added
00121     if( withLeptons && aParticle.status() == 3 && isALepton ) {
00122       thePartons->push_back( GenParticleRef( particles, m ) );
00123       nPart++;
00124     }
00125   }
00126   
00127   edm::LogVerbatim("PartonSelector") << "=== GenParticle selected:" << nPart;  
00128   iEvent.put( thePartons );
00129 
00130 }


Member Data Documentation

bool PartonSelector::withLeptons [private]

Definition at line 45 of file PartonSelector.cc.

Referenced by PartonSelector(), and produce().

bool PartonSelector::withTop [private]

Definition at line 46 of file PartonSelector.cc.

Referenced by PartonSelector(), and produce().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:29:27 2009 for CMSSW by  doxygen 1.5.4