forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding code for GEDGsfElectronCores and GEDGsfElectrons
- Loading branch information
Gabriel Musat
committed
May 6, 2013
1 parent
a419851
commit 2c084bb
Showing
7 changed files
with
140 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
RecoEgamma/EgammaElectronProducers/plugins/GEDGsfElectronCoreProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
{} | ||
|
27 changes: 27 additions & 0 deletions
27
RecoEgamma/EgammaElectronProducers/plugins/GEDGsfElectronCoreProducer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
RecoEgamma/EgammaElectronProducers/python/gedGsfElectronCores_cfi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"), | ||
) | ||
|
10 changes: 10 additions & 0 deletions
10
RecoEgamma/EgammaElectronProducers/python/gedGsfElectronSequence_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
6 changes: 6 additions & 0 deletions
6
RecoEgamma/EgammaElectronProducers/python/gedGsfElectrons_cfi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |