Skip to content

Commit

Permalink
Merge CMSSW_10_5_X into CMSSW_10_5_DEVEL_X.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed Feb 18, 2019
2 parents ff5d351 + 5fd1581 commit b7d1682
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class EgammaSCCorrectionMaker : public edm::stream::EDProducer<> {

private:

EcalClusterFunctionBaseClass* energyCorrectionFunction_;
EcalClusterFunctionBaseClass* crackCorrectionFunction_;
EcalClusterFunctionBaseClass* localContCorrectionFunction_;
std::unique_ptr<EcalClusterFunctionBaseClass> energyCorrectionFunction_;
std::unique_ptr<EcalClusterFunctionBaseClass> crackCorrectionFunction_;
std::unique_ptr<EcalClusterFunctionBaseClass> localContCorrectionFunction_;


// pointer to the correction algo object
EgammaSCEnergyCorrectionAlgo *energyCorrector_;
std::unique_ptr<EgammaSCEnergyCorrectionAlgo> energyCorrector_;



Expand Down
29 changes: 8 additions & 21 deletions RecoEcal/EgammaClusterProducers/src/EgammaSCCorrectionMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,36 +77,23 @@ EgammaSCCorrectionMaker::EgammaSCCorrectionMaker(const edm::ParameterSet& ps)
produces<reco::SuperClusterCollection>(outputCollection_);

// instanciate the correction algo object
energyCorrector_ = new EgammaSCEnergyCorrectionAlgo(sigmaElectronicNoise_, sCAlgo_, fCorrPset);
energyCorrector_ = std::make_unique<EgammaSCEnergyCorrectionAlgo>(sigmaElectronicNoise_, sCAlgo_, fCorrPset);

// energy correction class
if (applyEnergyCorrection_ )
energyCorrectionFunction_ = EcalClusterFunctionFactory::get()->create(energyCorrectorName_, ps);
energyCorrectionFunction_ = std::unique_ptr<EcalClusterFunctionBaseClass>(EcalClusterFunctionFactory::get()->create(energyCorrectorName_, ps));
//energyCorrectionFunction_ = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", ps);
else
energyCorrectionFunction_=nullptr;

if (applyCrackCorrection_ )
crackCorrectionFunction_ = EcalClusterFunctionFactory::get()->create(crackCorrectorName_, ps);
else
crackCorrectionFunction_=nullptr;
crackCorrectionFunction_ = std::unique_ptr<EcalClusterFunctionBaseClass>(EcalClusterFunctionFactory::get()->create(crackCorrectorName_, ps));


if (applyLocalContCorrection_ )
localContCorrectionFunction_ = EcalClusterFunctionFactory::get()->create(localContCorrectorName_, ps);
else
localContCorrectionFunction_=nullptr;
localContCorrectionFunction_ = std::unique_ptr<EcalClusterFunctionBaseClass>(EcalClusterFunctionFactory::get()->create(localContCorrectorName_, ps));

}

EgammaSCCorrectionMaker::~EgammaSCCorrectionMaker()
{
if (energyCorrectionFunction_) delete energyCorrectionFunction_;
if (crackCorrectionFunction_) delete crackCorrectionFunction_;
if (localContCorrectionFunction_) delete localContCorrectionFunction_;

delete energyCorrector_;
}
EgammaSCCorrectionMaker::~EgammaSCCorrectionMaker() = default;

void
EgammaSCCorrectionMaker::produce(edm::Event& evt, const edm::EventSetup& es)
Expand Down Expand Up @@ -169,19 +156,19 @@ EgammaSCCorrectionMaker::produce(edm::Event& evt, const edm::EventSetup& es)
i++;

if(applyEnergyCorrection_)
enecorrClus = energyCorrector_->applyCorrection(*aClus, *hitCollection, sCAlgo_, geometry_p, energyCorrectionFunction_, energyCorrectorName_, modeEB_, modeEE_);
enecorrClus = energyCorrector_->applyCorrection(*aClus, *hitCollection, sCAlgo_, geometry_p, energyCorrectionFunction_.get(), energyCorrectorName_, modeEB_, modeEE_);
else
enecorrClus=*aClus;


if(applyCrackCorrection_)
crackcorrClus=energyCorrector_->applyCrackCorrection(enecorrClus,crackCorrectionFunction_);
crackcorrClus=energyCorrector_->applyCrackCorrection(enecorrClus,crackCorrectionFunction_.get());
else
crackcorrClus=enecorrClus;

if (applyLocalContCorrection_)
localContCorrClus =
energyCorrector_->applyLocalContCorrection(crackcorrClus,localContCorrectionFunction_);
energyCorrector_->applyLocalContCorrection(crackcorrClus,localContCorrectionFunction_.get());
else
localContCorrClus = crackcorrClus;

Expand Down
19 changes: 6 additions & 13 deletions RecoEcal/EgammaCoreTools/test/testEcalClusterFunctions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,21 @@ Description: <one line class summary>
class testEcalClusterFunctions : public edm::EDAnalyzer {
public:
explicit testEcalClusterFunctions(const edm::ParameterSet&);
~testEcalClusterFunctions();
~testEcalClusterFunctions() override = default;

private:
virtual void analyze(const edm::Event&, const edm::EventSetup&);
EcalClusterFunctionBaseClass *ff_;
void analyze(const edm::Event&, const edm::EventSetup&) override;
std::unique_ptr<EcalClusterFunctionBaseClass> ff_;

};



testEcalClusterFunctions::testEcalClusterFunctions(const edm::ParameterSet& ps) :
ff_(0)
testEcalClusterFunctions::testEcalClusterFunctions(const edm::ParameterSet& ps)
{
std::string functionName = ps.getParameter<std::string>("functionName");
ff_ = EcalClusterFunctionFactory::get()->create( functionName, ps );
std::cout << "got " << functionName << " function at: " << ff_ << "\n";
}



testEcalClusterFunctions::~testEcalClusterFunctions()
{
ff_ = std::unique_ptr<EcalClusterFunctionBaseClass>{EcalClusterFunctionFactory::get()->create( functionName, ps )};
std::cout << "got " << functionName << " function at: " << ff_.get() << "\n";
}


Expand Down
11 changes: 3 additions & 8 deletions RecoLocalCalo/EcalRecProducers/plugins/ESRecHitProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@

ESRecHitProducer::ESRecHitProducer(edm::ParameterSet const& ps) :
digiToken_( consumes<ESDigiCollection>(ps.getParameter<edm::InputTag>("ESdigiCollection")) ),
rechitCollection_( ps.getParameter<std::string>("ESrechitCollection") )
rechitCollection_( ps.getParameter<std::string>("ESrechitCollection") ),
worker_{ESRecHitWorkerFactory::get()->create(ps.getParameter<std::string>("algo"), ps )}
{
produces<ESRecHitCollection>(rechitCollection_);

std::string const & componentType = ps.getParameter<std::string>("algo");
worker_ = ESRecHitWorkerFactory::get()->create( componentType, ps );
}

ESRecHitProducer::~ESRecHitProducer() {

delete worker_;
}
ESRecHitProducer::~ESRecHitProducer() = default;

void ESRecHitProducer::produce(edm::Event& e, const edm::EventSetup& es) {

Expand Down
2 changes: 1 addition & 1 deletion RecoLocalCalo/EcalRecProducers/plugins/ESRecHitProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class ESRecHitProducer : public edm::stream::EDProducer<> {
const edm::EDGetTokenT<ESDigiCollection> digiToken_;
const std::string rechitCollection_; // secondary name to be given to collection of hits

ESRecHitWorkerBaseClass * worker_;
std::unique_ptr<ESRecHitWorkerBaseClass> worker_;
};
#endif
13 changes: 4 additions & 9 deletions RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,18 @@ EcalRecHitProducer::EcalRecHitProducer(const edm::ParameterSet& ps)

std::string componentType = ps.getParameter<std::string>("algo");
edm::ConsumesCollector c{consumesCollector()};
worker_ = EcalRecHitWorkerFactory::get()->create(componentType, ps, c);
worker_ = std::unique_ptr<EcalRecHitWorkerBaseClass>{EcalRecHitWorkerFactory::get()->create(componentType, ps, c)};

// to recover problematic channels
componentType = ps.getParameter<std::string>("algoRecover");
workerRecover_ = EcalRecHitWorkerFactory::get()->create(componentType, ps, c);
workerRecover_ = std::unique_ptr<EcalRecHitWorkerBaseClass>{EcalRecHitWorkerFactory::get()->create(componentType, ps, c)};

edm::ParameterSet cleaningPs =
ps.getParameter<edm::ParameterSet>("cleaningConfig");
cleaningAlgo_ = new EcalCleaningAlgo(cleaningPs);
cleaningAlgo_ = std::make_unique<EcalCleaningAlgo>(cleaningPs);
}

EcalRecHitProducer::~EcalRecHitProducer()
{
delete worker_;
delete workerRecover_;
delete cleaningAlgo_;
}
EcalRecHitProducer::~EcalRecHitProducer() = default;

void
EcalRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es)
Expand Down
6 changes: 3 additions & 3 deletions RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ class EcalRecHitProducer : public edm::stream::EDProducer<> {
bool killDeadChannels_;


EcalRecHitWorkerBaseClass * worker_;
EcalRecHitWorkerBaseClass * workerRecover_;
std::unique_ptr<EcalRecHitWorkerBaseClass> worker_;
std::unique_ptr<EcalRecHitWorkerBaseClass> workerRecover_;

EcalCleaningAlgo * cleaningAlgo_;
std::unique_ptr<EcalCleaningAlgo> cleaningAlgo_;

edm::EDGetTokenT<EBUncalibratedRecHitCollection> ebUncalibRecHitToken_;
edm::EDGetTokenT<EEUncalibratedRecHitCollection> eeUncalibRecHitToken_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ EcalUncalibRecHitProducer::EcalUncalibRecHitProducer(const edm::ParameterSet& ps
edm::ParameterSet algoConf = ps.getParameter<edm::ParameterSet>("algoPSet");

edm::ConsumesCollector c{consumesCollector()};
worker_ = EcalUncalibRecHitWorkerFactory::get()->create(componentType, algoConf, c);
worker_ = std::unique_ptr<EcalUncalibRecHitWorkerBaseClass>{EcalUncalibRecHitWorkerFactory::get()->create(componentType, algoConf, c)};
}

EcalUncalibRecHitProducer::~EcalUncalibRecHitProducer()
{
delete worker_;
}
EcalUncalibRecHitProducer::~EcalUncalibRecHitProducer() = default;

void EcalUncalibRecHitProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ class EcalUncalibRecHitProducer : public edm::stream::EDProducer<> {
std::string ebHitCollection_;
std::string eeHitCollection_;

EcalUncalibRecHitWorkerBaseClass * worker_;
std::unique_ptr<EcalUncalibRecHitWorkerBaseClass> worker_;
};
#endif

0 comments on commit b7d1682

Please sign in to comment.