Skip to content

Commit

Permalink
adding code for GEDGsfElectronCores and GEDGsfElectrons
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Musat committed May 6, 2013
1 parent a419851 commit 2c084bb
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 1 deletion.
1 change: 1 addition & 0 deletions RecoEgamma/EgammaElectronProducers/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<use name="DataFormats/SiPixelCluster"/>
<use name="DataFormats/TrackerRecHit2D"/>
<use name="DataFormats/TrackingRecHit"/>
<use name="DataFormats/ParticleFlowCandidate"/>
<use name="hepmc"/>
<use name="clhep"/>
<use name="root"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

#include "GEDGsfElectronCoreProducer.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

#include "DataFormats/EgammaCandidates/interface/GsfElectronCore.h"
#include "DataFormats/ParticleFlowReco/interface/GsfPFRecTrack.h"
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
#include "DataFormats/EgammaReco/interface/ElectronSeed.h"
#include "DataFormats/Common/interface/ValueMap.h"

#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateEGammaExtra.h"

#include <map>

using namespace reco ;

void GEDGsfElectronCoreProducer::fillDescriptions( edm::ConfigurationDescriptions & descriptions )
{
edm::ParameterSetDescription desc ;
GsfElectronCoreBaseProducer::fillDescription(desc) ;
desc.add<edm::InputTag>("GEDEMUnbiased",edm::InputTag("GEDPFCandidates")) ;

descriptions.add("produceEcalDrivenGsfElectronCores",desc) ;
}

GEDGsfElectronCoreProducer::GEDGsfElectronCoreProducer( const edm::ParameterSet & config )
: GsfElectronCoreBaseProducer(config)
{
gedEMUnbiasedTag_ = config.getParameter<edm::InputTag>("GEDEMUnbiased") ;
}

void GEDGsfElectronCoreProducer::produce( edm::Event & event, const edm::EventSetup & setup )
{
// base input
GsfElectronCoreBaseProducer::initEvent(event,setup) ;

event.getByLabel(gedEMUnbiasedTag_,gedEMUnbiasedH_);

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

const PFCandidateCollection * pfCandidateCollection = gedEMUnbiasedH_.product();
for ( unsigned int i=0 ; i<pfCandidateCollection->size() ; ++i )
produceElectronCore((*pfCandidateCollection)[i],electrons.get()) ;

event.put(electrons) ;
}

void GEDGsfElectronCoreProducer::produceElectronCore( const reco::PFCandidate & pfCandidate, reco::GsfElectronCoreCollection * electrons )
{
const GsfTrackRef gsfTrackRef = pfCandidate.gsfTrackRef();
if(gsfTrackRef.isNull())
return;

reco::PFCandidateEGammaExtraRef extraRef = pfCandidate.egammaExtraRef();
if(extraRef.isNull())
return;

GsfElectronCore * eleCore = new GsfElectronCore(gsfTrackRef) ;

GsfElectronCoreBaseProducer::fillElectronCore(eleCore) ;

SuperClusterRef scRef = extraRef->superClusterRef();
SuperClusterRef scBoxRef = extraRef->superClusterBoxRef();

if (!scRef.isNull() || !scBoxRef.isNull())
{
eleCore->setSuperCluster(scRef) ;
eleCore->setPflowSuperCluster(scBoxRef) ;
electrons->push_back(*eleCore) ;
}
else
{ edm::LogWarning("GEDGsfElectronCoreProducer")<<"Both superClusterRef and superClusterBoxRef of pfCandidate.egammaExtraRef() are Null" ; }

delete eleCore ;
}

GEDGsfElectronCoreProducer::~GEDGsfElectronCoreProducer()
{}

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef GEDGsfElectronCoreProducer_h
#define GEDGsfElectronCoreProducer_h

#include "GsfElectronCoreBaseProducer.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h"
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"

class GEDGsfElectronCoreProducer : public GsfElectronCoreBaseProducer
{
public:

static void fillDescriptions( edm::ConfigurationDescriptions & ) ;

explicit GEDGsfElectronCoreProducer( const edm::ParameterSet & conf ) ;
virtual ~GEDGsfElectronCoreProducer() ;
virtual void produce( edm::Event&, const edm::EventSetup & ) ;

private:

void produceElectronCore( const reco::PFCandidate & pfCandidate, reco::GsfElectronCoreCollection * electrons ) ;

edm::Handle<reco::PFCandidateCollection> gedEMUnbiasedH_;

edm::InputTag gedEMUnbiasedTag_ ;
} ;

#endif
3 changes: 2 additions & 1 deletion RecoEgamma/EgammaElectronProducers/plugins/SealModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "GsfElectronProducer.h"
//#include "GlobalGsfElectronProducer.h"


#include "GEDGsfElectronCoreProducer.h"

DEFINE_FWK_MODULE(SiStripElectronProducer);
DEFINE_FWK_MODULE(SiStripElectronAssociator);
Expand All @@ -26,4 +26,5 @@ DEFINE_FWK_MODULE(GsfElectronCoreProducer);
DEFINE_FWK_MODULE(GsfElectronProducer);
//DEFINE_FWK_MODULE(GlobalGsfElectronProducer);
DEFINE_FWK_MODULE(SiStripElectronSeedProducer);
DEFINE_FWK_MODULE(GEDGsfElectronCoreProducer);

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import FWCore.ParameterSet.Config as cms

gedGsfElectronCores = cms.EDProducer("GEDGsfElectronCoreProducer",
GEDEMUnbiased = cms.InputTag("particleFlowEGamma"),
gsfTracks = cms.InputTag("electronGsfTracks"),
ctfTracks = cms.InputTag("generalTracks"),
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import FWCore.ParameterSet.Config as cms

#==============================================================================
# Sequence to the GED electrons.
#==============================================================================

from RecoEgamma.EgammaElectronProducers.gedGsfElectronCores_cfi import *
from RecoEgamma.EgammaElectronProducers.gedGsfElectrons_cfi import *
gedGsfElectronSequence = cms.Sequence(gedGsfElectronCores*gedGsfElectrons)

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import FWCore.ParameterSet.Config as cms

from RecoEgamma.EgammaElectronProducers.gsfElectrons_cfi import *

gedGsfElectrons=ecalDrivenGsfElectrons.clone()
gedGsfElectrons.gsfElectronCoresTag="gedGsfElectronCores"

0 comments on commit 2c084bb

Please sign in to comment.