CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SoftElectronCandProducer Class Reference

#include <SoftElectronCandProducer.h>

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

List of all members.

Public Member Functions

 SoftElectronCandProducer (const edm::ParameterSet &conf)
 ~SoftElectronCandProducer ()

Private Member Functions

bool isClean (const reco::GsfElectron &gsfcandidate)
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)

Private Attributes

std::vector< double > barreldRGsfTrackElectronCuts_
std::vector< double > barrelEemPinRatioCuts_
std::vector< double > barrelMVACuts_
std::vector< double > barrelPtCuts_
std::vector< double > forwarddRGsfTrackElectronCuts_
std::vector< double > forwardInverseFBremCuts_
std::vector< double > forwardMVACuts_
std::vector< double > forwardPtCuts_
edm::InputTag gsfElectronTag_

Detailed Description

Definition at line 17 of file SoftElectronCandProducer.h.


Constructor & Destructor Documentation

SoftElectronCandProducer::SoftElectronCandProducer ( const edm::ParameterSet conf)

Definition at line 14 of file SoftElectronCandProducer.cc.

                                                                               :
    gsfElectronTag_                  (conf.getParameter<edm::InputTag>("electrons")),

    barrelPtCuts_                    (conf.getParameter<std::vector<double> >("BarrelPtCuts")),
    barreldRGsfTrackElectronCuts_    (conf.getParameter<std::vector<double> >("BarreldRGsfTrackElectronCuts")),
    barrelEemPinRatioCuts_           (conf.getParameter<std::vector<double> >("BarrelEemPinRatioCuts")),
    barrelMVACuts_                   (conf.getParameter<std::vector<double> >("BarrelMVACuts")),

    forwardPtCuts_                   (conf.getParameter<std::vector<double> >("ForwardPtCuts")),
    forwardInverseFBremCuts_         (conf.getParameter<std::vector<double> >("ForwardInverseFBremCuts")),
    forwarddRGsfTrackElectronCuts_   (conf.getParameter<std::vector<double> >("ForwarddRGsfTrackElectronCuts")),
    forwardMVACuts_                  (conf.getParameter<std::vector<double> >("ForwardMVACuts"))
{
    produces< edm::ValueMap<float> >();
}
SoftElectronCandProducer::~SoftElectronCandProducer ( )

Definition at line 30 of file SoftElectronCandProducer.cc.

{

}

Member Function Documentation

bool SoftElectronCandProducer::isClean ( const reco::GsfElectron gsfcandidate) [private]

Definition at line 54 of file SoftElectronCandProducer.cc.

References barreldRGsfTrackElectronCuts_, barrelEemPinRatioCuts_, barrelMVACuts_, barrelPtCuts_, deltaR(), reco::GsfElectron::eSuperClusterOverP(), reco::LeafCandidate::eta(), reco::GsfElectron::fbrem(), forwarddRGsfTrackElectronCuts_, forwardInverseFBremCuts_, forwardMVACuts_, forwardPtCuts_, reco::HitPattern::getHitPattern(), reco::HitPattern::getLayer(), reco::GsfElectron::gsfTrack(), reco::GsfElectron::mva(), reco::LeafCandidate::phi(), reco::HitPattern::pixelBarrelHitFilter(), reco::HitPattern::pixelEndcapHitFilter(), reco::LeafCandidate::pt(), and reco::HitPattern::validHitFilter().

Referenced by produce().

{
  const reco::HitPattern& hitPattern = gsfcandidate.gsfTrack()->hitPattern();
  //check that the first hit is a pixel hit
  uint32_t hit = hitPattern.getHitPattern(0);
  if( !(hitPattern.validHitFilter(hit) && ( (hitPattern.pixelBarrelHitFilter(hit) && hitPattern.getLayer(hit) < 3) || hitPattern.pixelEndcapHitFilter(hit))) )
    return false;

  const double EemPinRatio           = (gsfcandidate.eSuperClusterOverP() - 1.0)/(gsfcandidate.eSuperClusterOverP() + 1.0);
  const double pt                    = gsfcandidate.pt();
  const double fbrem                 = gsfcandidate.fbrem();
  const double dRGsfTrackElectron    = deltaR(gsfcandidate.gsfTrack()->eta(), gsfcandidate.gsfTrack()->phi(), gsfcandidate.eta(), gsfcandidate.phi());
  const double mva                   = gsfcandidate.mva();

  if(fabs(gsfcandidate.eta()) < 1.5)
  {
    // use barrel cuts
    if( barrelPtCuts_.front()                    > pt                    || barrelPtCuts_.back()                    < pt)                    return false;
    if( barreldRGsfTrackElectronCuts_.front()    > dRGsfTrackElectron    || barreldRGsfTrackElectronCuts_.back()    < dRGsfTrackElectron)    return false;
    if( barrelEemPinRatioCuts_.front()           > EemPinRatio           || barrelEemPinRatioCuts_.back()           < EemPinRatio)           return false;
    if( barrelMVACuts_.front()                   > mva                   || barrelMVACuts_.back()                   < mva)                   return false;
  }
  else
  {
    // use endcap cuts
    if( forwardPtCuts_.front()                 > pt                 || forwardPtCuts_.back()                 < pt)                 return false;
    if( forwardInverseFBremCuts_.front()       > 1.0/fbrem          || forwardInverseFBremCuts_.back()       < 1.0/fbrem)          return false;
    if( forwarddRGsfTrackElectronCuts_.front() > dRGsfTrackElectron || forwarddRGsfTrackElectronCuts_.back() < dRGsfTrackElectron) return false;
    if( forwardMVACuts_.front()                > mva                || forwardMVACuts_.back()                < mva)                return false;
  }

  return true;
}
void SoftElectronCandProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 35 of file SoftElectronCandProducer.cc.

References edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), gsfElectronTag_, edm::helper::Filler< Map >::insert(), isClean(), convertSQLitetoXML_cfg::output, edm::Event::put(), and makeHLTPrescaleTable::values.

{
  edm::Handle<reco::GsfElectronCollection> gsfCandidates;
  iEvent.getByLabel(gsfElectronTag_, gsfCandidates);

  std::vector<float> values;
  values.reserve(gsfCandidates->size());

  for(reco::GsfElectronCollection::const_iterator iter = gsfCandidates->begin();
      iter != gsfCandidates->end(); ++iter)
    values.push_back(isClean(*iter) ? 1.0 : 0.0);

  std::auto_ptr< edm::ValueMap<float> > output(new edm::ValueMap<float>);
  edm::ValueMap<float>::Filler filler(*output);
  filler.insert(gsfCandidates, values.begin(), values.end());
  filler.fill();
  iEvent.put(output);
}

Member Data Documentation

Definition at line 33 of file SoftElectronCandProducer.h.

Referenced by isClean().

std::vector<double> SoftElectronCandProducer::barrelEemPinRatioCuts_ [private]

Definition at line 34 of file SoftElectronCandProducer.h.

Referenced by isClean().

std::vector<double> SoftElectronCandProducer::barrelMVACuts_ [private]

Definition at line 35 of file SoftElectronCandProducer.h.

Referenced by isClean().

std::vector<double> SoftElectronCandProducer::barrelPtCuts_ [private]

Definition at line 32 of file SoftElectronCandProducer.h.

Referenced by isClean().

Definition at line 39 of file SoftElectronCandProducer.h.

Referenced by isClean().

Definition at line 38 of file SoftElectronCandProducer.h.

Referenced by isClean().

std::vector<double> SoftElectronCandProducer::forwardMVACuts_ [private]

Definition at line 40 of file SoftElectronCandProducer.h.

Referenced by isClean().

std::vector<double> SoftElectronCandProducer::forwardPtCuts_ [private]

Definition at line 37 of file SoftElectronCandProducer.h.

Referenced by isClean().

Definition at line 30 of file SoftElectronCandProducer.h.

Referenced by produce().