CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

GsfElectronCoreBaseProducer Class Reference

#include <GsfElectronCoreBaseProducer.h>

Inheritance diagram for GsfElectronCoreBaseProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper GEDGsfElectronCoreProducer GsfElectronCoreEcalDrivenProducer GsfElectronCoreProducer

List of all members.

Public Member Functions

 GsfElectronCoreBaseProducer (const edm::ParameterSet &conf)
virtual ~GsfElectronCoreBaseProducer ()

Static Public Member Functions

static void fillDescription (edm::ParameterSetDescription &)

Protected Member Functions

void fillElectronCore (reco::GsfElectronCore *)
void initEvent (edm::Event &event, const edm::EventSetup &setup)

Protected Attributes

edm::Handle
< reco::TrackCollection
ctfTracksH_
edm::Handle
< reco::GsfPFRecTrackCollection
gsfPfRecTracksH_
edm::Handle
< reco::GsfTrackCollection
gsfTracksH_
bool useGsfPfRecTracks_

Private Member Functions

std::pair< reco::TrackRef, float > getCtfTrackRef (const reco::GsfTrackRef &)

Private Attributes

edm::InputTag ctfTracksTag_
edm::InputTag gsfPfRecTracksTag_
edm::InputTag gsfTracksTag_

Detailed Description

Definition at line 31 of file GsfElectronCoreBaseProducer.h.


Constructor & Destructor Documentation

GsfElectronCoreBaseProducer::GsfElectronCoreBaseProducer ( const edm::ParameterSet conf) [explicit]

Definition at line 28 of file GsfElectronCoreBaseProducer.cc.

References edm::ParameterSet::getParameter().

 {
  produces<GsfElectronCoreCollection>() ;
  gsfPfRecTracksTag_ = config.getParameter<edm::InputTag>("gsfPfRecTracks") ;
  gsfTracksTag_ = config.getParameter<edm::InputTag>("gsfTracks") ;
  ctfTracksTag_ = config.getParameter<edm::InputTag>("ctfTracks") ;
  useGsfPfRecTracks_ = config.getParameter<bool>("useGsfPfRecTracks") ;
 }
GsfElectronCoreBaseProducer::~GsfElectronCoreBaseProducer ( ) [virtual]

Definition at line 37 of file GsfElectronCoreBaseProducer.cc.

 {}

Member Function Documentation

void GsfElectronCoreBaseProducer::fillDescription ( edm::ParameterSetDescription desc) [static]

Definition at line 20 of file GsfElectronCoreBaseProducer.cc.

References edm::ParameterSetDescription::add().

Referenced by GEDGsfElectronCoreProducer::fillDescriptions().

 {
  desc.add<edm::InputTag>("gsfPfRecTracks",edm::InputTag("pfTrackElec")) ;
  desc.add<edm::InputTag>("gsfTracks",edm::InputTag("electronGsfTracks")) ;
  desc.add<edm::InputTag>("ctfTracks",edm::InputTag("generalTracks")) ;
  desc.add<bool>("useGsfPfRecTracks",true) ;
 }
void GsfElectronCoreBaseProducer::fillElectronCore ( reco::GsfElectronCore eleCore) [protected]

Definition at line 54 of file GsfElectronCoreBaseProducer.cc.

References reco::GsfElectronCore::gsfTrack(), and reco::GsfElectronCore::setCtfTrack().

Referenced by GsfElectronCoreEcalDrivenProducer::produceEcalDrivenCore(), GEDGsfElectronCoreProducer::produceElectronCore(), and GsfElectronCoreProducer::produceTrackerDrivenCore().

 {
  const GsfTrackRef & gsfTrackRef = eleCore->gsfTrack() ;

  std::pair<TrackRef,float> ctfpair = getCtfTrackRef(gsfTrackRef) ;
  eleCore->setCtfTrack(ctfpair.first,ctfpair.second) ;
 }
std::pair< TrackRef, float > GsfElectronCoreBaseProducer::getCtfTrackRef ( const reco::GsfTrackRef gsfTrackRef) [private]

Definition at line 68 of file GsfElectronCoreBaseProducer.cc.

References abs, TrackingRecHit::all, dPhi(), reco::HitPattern::getHitPattern(), min, pi, reco::HitPattern::pixelHitFilter(), mathSSE::sqrt(), reco::HitPattern::stripTIBHitFilter(), and reco::HitPattern::stripTIDHitFilter().

 {
  float maxFracShared = 0;
  TrackRef ctfTrackRef = TrackRef() ;
  const TrackCollection * ctfTrackCollection = ctfTracksH_.product() ;

  // get the Hit Pattern for the gsfTrack
  const HitPattern& gsfHitPattern = gsfTrackRef->hitPattern();

  unsigned int counter ;
  TrackCollection::const_iterator ctfTkIter ;
  for ( ctfTkIter = ctfTrackCollection->begin() , counter = 0 ;
        ctfTkIter != ctfTrackCollection->end() ; ctfTkIter++, counter++ )
   {

    double dEta = gsfTrackRef->eta() - ctfTkIter->eta();
    double dPhi = gsfTrackRef->phi() - ctfTkIter->phi();
    double pi = acos(-1.);
    if(std::abs(dPhi) > pi) dPhi = 2*pi - std::abs(dPhi);

    // dont want to look at every single track in the event!
    if(sqrt(dEta*dEta + dPhi*dPhi) > 0.3) continue;

    unsigned int shared = 0 ;
    int gsfHitCounter = 0 ;
    int numGsfInnerHits = 0 ;
    int numCtfInnerHits = 0 ;
    // get the CTF Track Hit Pattern
    const HitPattern& ctfHitPattern = ctfTkIter->hitPattern() ;

    trackingRecHit_iterator elHitsIt ;
    for ( elHitsIt = gsfTrackRef->recHitsBegin() ;
          elHitsIt != gsfTrackRef->recHitsEnd() ;
          elHitsIt++, gsfHitCounter++ )
     {
      if(!((**elHitsIt).isValid()))  //count only valid Hits
       { continue ; }

      // look only in the pixels/TIB/TID
      uint32_t gsfHit = gsfHitPattern.getHitPattern(gsfHitCounter) ;
      if (!(gsfHitPattern.pixelHitFilter(gsfHit) ||
          gsfHitPattern.stripTIBHitFilter(gsfHit) ||
          gsfHitPattern.stripTIDHitFilter(gsfHit) ) )
       { continue ; }

      numGsfInnerHits++ ;

      int ctfHitsCounter = 0 ;
      numCtfInnerHits = 0 ;
      trackingRecHit_iterator ctfHitsIt ;
      for ( ctfHitsIt = ctfTkIter->recHitsBegin() ;
            ctfHitsIt != ctfTkIter->recHitsEnd() ;
            ctfHitsIt++, ctfHitsCounter++ )
       {
        if(!((**ctfHitsIt).isValid())) //count only valid Hits!
         { continue ; }

      uint32_t ctfHit = ctfHitPattern.getHitPattern(ctfHitsCounter);
      if( !(ctfHitPattern.pixelHitFilter(ctfHit) ||
            ctfHitPattern.stripTIBHitFilter(ctfHit) ||
            ctfHitPattern.stripTIDHitFilter(ctfHit) ) )
       { continue ; }

      numCtfInnerHits++ ;

        if( (**elHitsIt).sharesInput(&(**ctfHitsIt),TrackingRecHit::all) )
         {
          shared++ ;
          break ;
         }

       } //ctfHits iterator

     } //gsfHits iterator

    if ((numGsfInnerHits==0)||(numCtfInnerHits==0))
     { continue ; }

    if ( static_cast<float>(shared)/std::min(numGsfInnerHits,numCtfInnerHits) > maxFracShared )
     {
      maxFracShared = static_cast<float>(shared)/std::min(numGsfInnerHits, numCtfInnerHits);
      ctfTrackRef = TrackRef(ctfTracksH_,counter);
     }

   } //ctfTrack iterator

  return make_pair(ctfTrackRef,maxFracShared) ;
 }
void GsfElectronCoreBaseProducer::initEvent ( edm::Event event,
const edm::EventSetup setup 
) [protected]

Member Data Documentation

Definition at line 47 of file GsfElectronCoreBaseProducer.h.

Definition at line 56 of file GsfElectronCoreBaseProducer.h.

Definition at line 54 of file GsfElectronCoreBaseProducer.h.

Definition at line 55 of file GsfElectronCoreBaseProducer.h.