CMS 3D CMS Logo

Public Member Functions | Private Member Functions

GsfElectronCoreEcalDrivenProducer Class Reference

#include <GsfElectronCoreEcalDrivenProducer.h>

Inheritance diagram for GsfElectronCoreEcalDrivenProducer:
GsfElectronCoreBaseProducer edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 GsfElectronCoreEcalDrivenProducer (const edm::ParameterSet &conf)
virtual void produce (edm::Event &, const edm::EventSetup &)
virtual ~GsfElectronCoreEcalDrivenProducer ()

Private Member Functions

void produceEcalDrivenCore (const reco::GsfTrackRef &gsfTrackRef, reco::GsfElectronCoreCollection *electrons)

Detailed Description

Definition at line 7 of file GsfElectronCoreEcalDrivenProducer.h.


Constructor & Destructor Documentation

GsfElectronCoreEcalDrivenProducer::GsfElectronCoreEcalDrivenProducer ( const edm::ParameterSet conf) [explicit]
GsfElectronCoreEcalDrivenProducer::~GsfElectronCoreEcalDrivenProducer ( ) [virtual]

Definition at line 89 of file GsfElectronCoreEcalDrivenProducer.cc.

 {}

Member Function Documentation

void GsfElectronCoreEcalDrivenProducer::produce ( edm::Event event,
const edm::EventSetup setup 
) [virtual]

Implements edm::EDProducer.

Definition at line 31 of file GsfElectronCoreEcalDrivenProducer.cc.

References HI_PhotonSkim_cff::electrons, edm::Ref< C, T, F >::get(), GsfElectronCoreBaseProducer::gsfPfRecTracksH_, GsfElectronCoreBaseProducer::gsfTracksH_, i, GsfElectronCoreBaseProducer::initEvent(), produceEcalDrivenCore(), edm::Handle< T >::product(), and GsfElectronCoreBaseProducer::useGsfPfRecTracks_.

 {
  // base input
  GsfElectronCoreBaseProducer::initEvent(event,setup) ;

  // output
  std::auto_ptr<GsfElectronCoreCollection> electrons(new GsfElectronCoreCollection) ;

  // loop on ecal driven tracks
  if (useGsfPfRecTracks_)
   {
    const GsfPFRecTrackCollection * gsfPfRecTrackCollection = gsfPfRecTracksH_.product() ;
    GsfPFRecTrackCollection::const_iterator gsfPfRecTrack ;
    for ( gsfPfRecTrack=gsfPfRecTrackCollection->begin() ;
          gsfPfRecTrack!=gsfPfRecTrackCollection->end() ;
          ++gsfPfRecTrack )
     {
      const GsfTrackRef gsfTrackRef = gsfPfRecTrack->gsfTrackRef() ;
      produceEcalDrivenCore(gsfTrackRef,electrons.get()) ;
     }
   }
  else
   {
    const GsfTrackCollection * gsfTrackCollection = gsfTracksH_.product() ;
    for ( unsigned int i=0 ; i<gsfTrackCollection->size() ; ++i )
     {
      const GsfTrackRef gsfTrackRef = edm::Ref<GsfTrackCollection>(gsfTracksH_,i) ;
      produceEcalDrivenCore(gsfTrackRef,electrons.get()) ;
     }
   }

  event.put(electrons) ;
 }
void GsfElectronCoreEcalDrivenProducer::produceEcalDrivenCore ( const reco::GsfTrackRef gsfTrackRef,
reco::GsfElectronCoreCollection electrons 
) [private]

Definition at line 65 of file GsfElectronCoreEcalDrivenProducer.cc.

References edm::RefToBase< T >::castTo(), reco::GsfElectronCore::ecalDrivenSeed(), GsfElectronCoreBaseProducer::fillElectronCore(), edm::Ref< C, T, F >::isNull(), and reco::GsfElectronCore::setSuperCluster().

Referenced by produce().

 {
  GsfElectronCore * eleCore = new GsfElectronCore(gsfTrackRef) ;

  if (!eleCore->ecalDrivenSeed())
   { delete eleCore ; return ; }

  GsfElectronCoreBaseProducer::fillElectronCore(eleCore) ;

  edm::RefToBase<TrajectorySeed> seed = gsfTrackRef->extra()->seedRef() ;
  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>() ;
  edm::RefToBase<CaloCluster> caloCluster = elseed->caloCluster() ;
  SuperClusterRef scRef = caloCluster.castTo<SuperClusterRef>() ;
  if (!scRef.isNull())
   {
    eleCore->setSuperCluster(scRef) ;
    electrons->push_back(*eleCore) ;
   }
  else
   { edm::LogWarning("GsfElectronCoreEcalDrivenProducer")<<"Seed CaloCluster is not a SuperCluster, unexpected..." ; }

  delete eleCore ;
 }