Skip to content

Commit

Permalink
Merge pull request #28213 from guitargeek/ElectronSeedProducer_config
Browse files Browse the repository at this point in the history
Remove manually generated cfi file for ElectronSeedProducer
  • Loading branch information
cmsbuild committed Oct 24, 2019
2 parents 29bb6d5 + 6df92ce commit 6a037a6
Show file tree
Hide file tree
Showing 21 changed files with 159 additions and 284 deletions.
2 changes: 1 addition & 1 deletion DPGAnalysis/Skims/python/singleElectronSkim_cff.py
Expand Up @@ -77,7 +77,7 @@
# minNumber = cms.uint32(1)
# )

#from RecoEgamma.EgammaElectronProducers.ecalDrivenElectronSeeds_cfi import *
#from RecoEgamma.EgammaElectronProducers.ecalDrivenElectronSeeds_cff import *

#ecalDrivenElectronSeeds.SCEtCut = cms.double(1.0)
#ecalDrivenElectronSeeds.applyHOverECut = cms.bool(False)
Expand Down
Expand Up @@ -44,7 +44,6 @@ class ElectronSeedGenerator {
struct Tokens {
edm::EDGetTokenT<std::vector<reco::Vertex> > token_vtx;
edm::EDGetTokenT<reco::BeamSpot> token_bs;
edm::EDGetTokenT<MeasurementTrackerEvent> token_measTrkEvt;
};

typedef edm::OwnVector<TrackingRecHit> PRecHitContainer;
Expand All @@ -58,15 +57,11 @@ class ElectronSeedGenerator {
void run(edm::Event&,
const edm::EventSetup& setup,
const reco::SuperClusterRefVector&,
const std::vector<float>& hoe1s,
const std::vector<float>& hoe2s,
const std::vector<const TrajectorySeedCollection*>& seedsV,
reco::ElectronSeedCollection&);

private:
void seedsFromThisCluster(edm::Ref<reco::SuperClusterCollection> seedCluster,
float hoe1,
float hoe2,
reco::BeamSpot const& beamSpot,
std::vector<reco::Vertex> const* vertices,
reco::ElectronSeedCollection& out);
Expand Down
12 changes: 9 additions & 3 deletions RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h
Expand Up @@ -27,7 +27,6 @@
#include "MagneticField/Engine/interface/MagneticField.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h"
#include "RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h"
#include "RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgoHeavyObjectCache.h"
#include "RecoEgamma/EgammaElectronAlgos/interface/RegressionHelper.h"
#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaRecHitIsolation.h"
#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h"
Expand All @@ -48,6 +47,13 @@

class GsfElectronAlgo {
public:
class HeavyObjectCache {
public:
HeavyObjectCache(const edm::ParameterSet&);
std::unique_ptr<const SoftElectronMVAEstimator> sElectronMVAEstimator;
std::unique_ptr<const ElectronMVAEstimator> iElectronMVAEstimator;
};

struct InputTagsConfiguration {
edm::EDGetTokenT<reco::GsfElectronCollection> previousGsfElectrons;
edm::EDGetTokenT<reco::GsfElectronCollection> pflowGsfElectronsTag;
Expand Down Expand Up @@ -198,7 +204,7 @@ class GsfElectronAlgo {
void completeElectrons(reco::GsfElectronCollection& electrons, // do not redo cloned electrons done previously
edm::Event const& event,
edm::EventSetup const& eventSetup,
const gsfAlgoHelpers::HeavyObjectCache* hoc);
const HeavyObjectCache* hoc);

private:
// internal structures
Expand Down Expand Up @@ -344,7 +350,7 @@ class GsfElectronAlgo {
void createElectron(reco::GsfElectronCollection& electrons,
ElectronData& electronData,
EventData& eventData,
const gsfAlgoHelpers::HeavyObjectCache*);
const HeavyObjectCache*);

void setMVAepiBasedPreselectionFlag(reco::GsfElectron& ele);
void setCutBasedPreselectionFlag(reco::GsfElectron& ele, const reco::BeamSpot&);
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions RecoEgamma/EgammaElectronAlgos/src/ElectronClassification.cc
Expand Up @@ -2,8 +2,6 @@

#include "DataFormats/EgammaReco/interface/SuperCluster.h"

#include "FWCore/MessageLogger/interface/MessageLogger.h"

//===================================================================
// Author: Federico Ferri - INFN Milano, Bicocca university
// 12/2005
Expand Down
23 changes: 6 additions & 17 deletions RecoEgamma/EgammaElectronAlgos/src/ElectronSeedGenerator.cc
Expand Up @@ -114,8 +114,6 @@ namespace {

void seedsFromTrajectorySeeds(const std::vector<SeedWithInfo> &pixelSeeds,
const reco::ElectronSeed::CaloClusterRef &cluster,
float hoe1,
float hoe2,
reco::ElectronSeedCollection &out,
bool positron) {
if (!pixelSeeds.empty()) {
Expand Down Expand Up @@ -182,12 +180,7 @@ ElectronSeedGenerator::ElectronSeedGenerator(const edm::ParameterSet &pset, cons
pset.getParameter<double>("r2MaxF"),
pset.getParameter<double>("rMinI"),
pset.getParameter<double>("rMaxI"),
useRecoVertex_) {
if (!pset.getParameter<bool>("fromTrackerSeeds")) {
throw cms::Exception("NotSupported")
<< "Setting the fromTrackerSeeds parameter in ElectronSeedGenerator to True is not supported anymore.\n";
}
}
useRecoVertex_) {}

void ElectronSeedGenerator::setupES(const edm::EventSetup &setup) {
// get records if necessary (called once per event)
Expand Down Expand Up @@ -215,8 +208,6 @@ void ElectronSeedGenerator::setupES(const edm::EventSetup &setup) {
void ElectronSeedGenerator::run(edm::Event &e,
const edm::EventSetup &setup,
const reco::SuperClusterRefVector &sclRefs,
const std::vector<float> &hoe1s,
const std::vector<float> &hoe2s,
const std::vector<const TrajectorySeedCollection *> &seedsV,
reco::ElectronSeedCollection &out) {
initialSeedCollectionVector_ = &seedsV;
Expand All @@ -232,7 +223,7 @@ void ElectronSeedGenerator::run(edm::Event &e,
for (unsigned int i = 0; i < sclRefs.size(); ++i) {
// Find the seeds
LogDebug("ElectronSeedGenerator") << "new cluster, calling seedsFromThisCluster";
seedsFromThisCluster(sclRefs[i], hoe1s[i], hoe2s[i], beamSpot, vertices, out);
seedsFromThisCluster(sclRefs[i], beamSpot, vertices, out);
}

LogDebug("ElectronSeedGenerator") << ": For event " << e.id();
Expand All @@ -241,8 +232,6 @@ void ElectronSeedGenerator::run(edm::Event &e,
}

void ElectronSeedGenerator::seedsFromThisCluster(edm::Ref<reco::SuperClusterCollection> seedCluster,
float hoe1,
float hoe2,
reco::BeamSpot const &beamSpot,
std::vector<reco::Vertex> const *vertices,
reco::ElectronSeedCollection &out) {
Expand Down Expand Up @@ -294,10 +283,10 @@ void ElectronSeedGenerator::seedsFromThisCluster(edm::Ref<reco::SuperClusterColl

// try electron
auto elePixelSeeds = electronMatcher_(*initialSeedCollectionVector_, clusterPos, vertexPos, clusterEnergy, -1.);
seedsFromTrajectorySeeds(elePixelSeeds, caloCluster, hoe1, hoe2, out, false);
seedsFromTrajectorySeeds(elePixelSeeds, caloCluster, out, false);
// try positron
auto posPixelSeeds = positronMatcher_(*initialSeedCollectionVector_, clusterPos, vertexPos, clusterEnergy, 1.);
seedsFromTrajectorySeeds(posPixelSeeds, caloCluster, hoe1, hoe2, out, true);
seedsFromTrajectorySeeds(posPixelSeeds, caloCluster, out, true);

} else if (vertices) // here we use the reco vertices
{
Expand All @@ -320,10 +309,10 @@ void ElectronSeedGenerator::seedsFromThisCluster(edm::Ref<reco::SuperClusterColl

// try electron
auto elePixelSeeds = electronMatcher_(*initialSeedCollectionVector_, clusterPos, vertexPos, clusterEnergy, -1.);
seedsFromTrajectorySeeds(elePixelSeeds, caloCluster, hoe1, hoe2, out, false);
seedsFromTrajectorySeeds(elePixelSeeds, caloCluster, out, false);
// try positron
auto posPixelSeeds = positronMatcher_(*initialSeedCollectionVector_, clusterPos, vertexPos, clusterEnergy, 1.);
seedsFromTrajectorySeeds(posPixelSeeds, caloCluster, hoe1, hoe2, out, true);
seedsFromTrajectorySeeds(posPixelSeeds, caloCluster, out, true);
}
}
}
15 changes: 13 additions & 2 deletions RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc
Expand Up @@ -39,6 +39,17 @@
using namespace edm;
using namespace reco;

GsfElectronAlgo::HeavyObjectCache::HeavyObjectCache(const edm::ParameterSet& conf) {
// soft electron MVA
SoftElectronMVAEstimator::Configuration sconfig;
sconfig.vweightsfiles = conf.getParameter<std::vector<std::string> >("SoftElecMVAFilesString");
sElectronMVAEstimator.reset(new SoftElectronMVAEstimator(sconfig));
// isolated electron MVA
ElectronMVAEstimator::Configuration iconfig;
iconfig.vweightsfiles = conf.getParameter<std::vector<std::string> >("ElecMVAFilesString");
iElectronMVAEstimator.reset(new ElectronMVAEstimator(iconfig));
}

GsfElectronAlgo::EventSetupData::EventSetupData()
: cacheIDGeom(0),
cacheIDTopo(0),
Expand Down Expand Up @@ -489,7 +500,7 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event)
void GsfElectronAlgo::completeElectrons(reco::GsfElectronCollection& electrons,
edm::Event const& event,
edm::EventSetup const& eventSetup,
const gsfAlgoHelpers::HeavyObjectCache* hoc) {
const GsfElectronAlgo::HeavyObjectCache* hoc) {
checkSetup(eventSetup);
auto eventData = beginEvent(event);

Expand Down Expand Up @@ -645,7 +656,7 @@ void GsfElectronAlgo::setCutBasedPreselectionFlag(GsfElectron& ele, const reco::
void GsfElectronAlgo::createElectron(reco::GsfElectronCollection& electrons,
ElectronData& electronData,
EventData& eventData,
const gsfAlgoHelpers::HeavyObjectCache* hoc) {
const GsfElectronAlgo::HeavyObjectCache* hoc) {
// eventually check ctf track
if (generalData_.strategyCfg.ctfTracksCheck && electronData.ctfTrackRef.isNull()) {
electronData.ctfTrackRef =
Expand Down

This file was deleted.

0 comments on commit 6a037a6

Please sign in to comment.