CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

reco::ParticleFlowForChargedMETProducer Class Reference

#include <ParticleFlowForChargedMETProducer.h>

Inheritance diagram for reco::ParticleFlowForChargedMETProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

double dzCut
double neutralEtThreshold
edm::InputTag pfCollectionLabel
edm::InputTag pvCollectionLabel

Detailed Description

Definition at line 17 of file ParticleFlowForChargedMETProducer.h.


Constructor & Destructor Documentation

ParticleFlowForChargedMETProducer::ParticleFlowForChargedMETProducer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 12 of file ParticleFlowForChargedMETProducer.cc.

References edm::ParameterSet::getParameter().

{
  pfCollectionLabel    = iConfig.getParameter<edm::InputTag>("PFCollectionLabel");
  pvCollectionLabel    = iConfig.getParameter<edm::InputTag>("PVCollectionLabel");
  dzCut    = iConfig.getParameter<double>("dzCut");
  neutralEtThreshold    = iConfig.getParameter<double>("neutralEtThreshold");

  produces<PFCandidateCollection>();
}
ParticleFlowForChargedMETProducer::~ParticleFlowForChargedMETProducer ( )

Definition at line 64 of file ParticleFlowForChargedMETProducer.cc.

{}

Member Function Documentation

void ParticleFlowForChargedMETProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 22 of file ParticleFlowForChargedMETProducer.cc.

References edm::Event::getByLabel(), i, edm::Ptr< T >::isNonnull(), reco::tau::pfCandidates(), and edm::Event::put().

{

  //Get the PV collection
  Handle<VertexCollection> pvCollection;
  iEvent.getByLabel(pvCollectionLabel, pvCollection);
  VertexCollection::const_iterator vertex = pvCollection->begin();

  //Get pfCandidates
  Handle<PFCandidateCollection> pfCandidates;
  iEvent.getByLabel(pfCollectionLabel, pfCandidates);

  // the output collection
  auto_ptr<PFCandidateCollection> chargedPFCandidates( new PFCandidateCollection ) ;
  if (pvCollection->size()>0) {
    for( unsigned i=0; i<pfCandidates->size(); i++ ) {
      const PFCandidate& pfCand = (*pfCandidates)[i];
      PFCandidatePtr pfCandPtr(pfCandidates, i);
      
      if (pfCandPtr->trackRef().isNonnull()) { 
        if (pfCandPtr->trackRef()->dz((*vertex).position()) < dzCut) {
          chargedPFCandidates->push_back( pfCand );
          chargedPFCandidates->back().setSourceCandidatePtr( pfCandPtr );
        }
        
      }
      else if (neutralEtThreshold>0 and 
               pfCandPtr->pt()>neutralEtThreshold) {
        chargedPFCandidates->push_back( pfCand );
        chargedPFCandidates->back().setSourceCandidatePtr( pfCandPtr );
      }  
        

    }
  }


  iEvent.put(chargedPFCandidates); 

  return;
}

Member Data Documentation

Definition at line 30 of file ParticleFlowForChargedMETProducer.h.

Definition at line 31 of file ParticleFlowForChargedMETProducer.h.

Definition at line 27 of file ParticleFlowForChargedMETProducer.h.

Definition at line 28 of file ParticleFlowForChargedMETProducer.h.