CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FSPFProducer Class Reference

#include <FSPFProducer.h>

Inheritance diagram for FSPFProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginJob ()
virtual void beginRun (edm::Run &, const edm::EventSetup &)
 FSPFProducer (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~FSPFProducer ()

Private Member Functions

double energy_threshold (double eta)

Private Attributes

double barrel_th
double endcap_th
edm::InputTag labelPFCandidateCollection_
double middle_th
double par1
double par2

Detailed Description

Definition at line 17 of file FSPFProducer.h.


Constructor & Destructor Documentation

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

Definition at line 14 of file FSPFProducer.cc.

References edm::ParameterSet::getParameter().

                                                         {
 
  labelPFCandidateCollection_ = iConfig.getParameter < edm::InputTag > ("pfCandidates");
  
  par1       = iConfig.getParameter<double>("par1");
  par2       = iConfig.getParameter<double>("par2");
  barrel_th  = iConfig.getParameter<double>("barrel_th");
  endcap_th  = iConfig.getParameter<double>("endcap_th");
  middle_th  = iConfig.getParameter<double>("middle_th");
  // register products
  produces<reco::PFCandidateCollection>();
  
}
FSPFProducer::~FSPFProducer ( )

Definition at line 28 of file FSPFProducer.cc.

{}

Member Function Documentation

void FSPFProducer::beginJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 31 of file FSPFProducer.cc.

{}
void FSPFProducer::beginRun ( edm::Run iRun,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 34 of file FSPFProducer.cc.

                                                     {}
double FSPFProducer::energy_threshold ( double  eta) [private]

Definition at line 74 of file FSPFProducer.cc.

References eta.

                                                {
  if (eta<0) eta = -eta;
  if      (eta < 1.6) return barrel_th;
  else if (eta < 1.8) return middle_th;
  else                return endcap_th;
}
void FSPFProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 38 of file FSPFProducer.cc.

References edm::EventID::event(), edm::Event::getByLabel(), h, reco::PFCandidate::h0, edm::EventBase::id(), LogDebug, reco::tau::pfCandidates(), edm::Event::put(), edm::EventID::run(), and mathSSE::sqrt().

                                                {
  
  Handle < reco::PFCandidateCollection > pfCandidates;
  iEvent.getByLabel (labelPFCandidateCollection_, pfCandidates);
  
  auto_ptr< reco::PFCandidateCollection >  pOutputCandidateCollection(new PFCandidateCollection);   
  
  LogDebug("FSPFProducer")<<"START event: "
                          <<iEvent.id().event()
                          <<" in run "<<iEvent.id().run()<<endl;   
  
  double theNeutralFraction, px, py, pz, en;
  reco::PFCandidateCollection::const_iterator  itCand =  pfCandidates->begin();
  reco::PFCandidateCollection::const_iterator  itCandEnd = pfCandidates->end();
  for( ; itCand != itCandEnd; itCand++) {
    pOutputCandidateCollection->push_back(*itCand);
    if(itCand->particleId() == reco::PFCandidate::h){
      theNeutralFraction = par1 - par2*itCand->energy();
      if(theNeutralFraction > 0.){
        px = theNeutralFraction*itCand->px();
        py = theNeutralFraction*itCand->py();
        pz = theNeutralFraction*itCand->pz();
        en = sqrt(px*px + py*py + pz*pz); 
        if (en > energy_threshold(itCand->eta())) {
          // create a PFCandidate and add it to the particles Collection
          math::XYZTLorentzVector momentum(px,py,pz,en);
          reco::PFCandidate FakeNeutralHadron(0, momentum,  reco::PFCandidate::h0);
          pOutputCandidateCollection->push_back(FakeNeutralHadron);
        }
      }
    }
  }
  iEvent.put(pOutputCandidateCollection);
}

Member Data Documentation

double FSPFProducer::barrel_th [private]

Definition at line 30 of file FSPFProducer.h.

double FSPFProducer::endcap_th [private]

Definition at line 30 of file FSPFProducer.h.

Definition at line 28 of file FSPFProducer.h.

double FSPFProducer::middle_th [private]

Definition at line 30 of file FSPFProducer.h.

double FSPFProducer::par1 [private]

Definition at line 29 of file FSPFProducer.h.

double FSPFProducer::par2 [private]

Definition at line 29 of file FSPFProducer.h.