From 4148626805a41f82c58a9c1aaa59f719a74f0fba Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 5 Apr 2022 14:12:15 +0200 Subject: [PATCH] get rid of CMSDEPRECATED_X warnings in HeavyFlavorAnalysis/SpecificDecay --- .../plugins/BPHHistoSpecificDecay.cc | 32 +++------ .../plugins/BPHHistoSpecificDecay.h | 12 ++-- .../plugins/BPHWriteSpecificDecay.cc | 65 ++++++++----------- .../plugins/BPHWriteSpecificDecay.h | 26 ++++---- 4 files changed, 52 insertions(+), 83 deletions(-) diff --git a/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHHistoSpecificDecay.cc b/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHHistoSpecificDecay.cc index 5001fb1f02211..bb74241fc4317 100644 --- a/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHHistoSpecificDecay.cc +++ b/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHHistoSpecificDecay.cc @@ -1,30 +1,20 @@ - -#include "HeavyFlavorAnalysis/SpecificDecay/plugins/BPHHistoSpecificDecay.h" - -#include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleMasses.h" - -#include "FWCore/Framework/interface/MakerMacros.h" - +#include "CommonTools/Statistics/interface/ChiSquaredProbability.h" #include "DataFormats/PatCandidates/interface/Muon.h" - -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "MagneticField/Engine/interface/MagneticField.h" - #include "FWCore/Common/interface/TriggerNames.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "CommonTools/Statistics/interface/ChiSquaredProbability.h" - +#include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleMasses.h" +#include "HeavyFlavorAnalysis/SpecificDecay/plugins/BPHHistoSpecificDecay.h" #include "RecoVertex/VertexTools/interface/VertexDistanceXY.h" + +#include "TFile.h" +#include "TH1.h" #include "TMath.h" -#include "Math/VectorUtil.h" +#include "TTree.h" #include "TVector3.h" -#include -#include -#include - +#include "Math/VectorUtil.h" #include #include #include @@ -1303,10 +1293,6 @@ void BPHHistoSpecificDecay::analyze(const edm::Event& ev, const edm::EventSetup& lumiSection = ev.id().luminosityBlock(); eventNumber = ev.id().event(); - // get magnetic field - edm::ESHandle magneticField; - es.get().get(magneticField); - // get object collections // collections are got through "BPHTokenWrapper" interface to allow // uniform access in different CMSSW versions diff --git a/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHHistoSpecificDecay.h b/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHHistoSpecificDecay.h index 93558e52a322f..eaeb60293f114 100644 --- a/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHHistoSpecificDecay.h +++ b/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHHistoSpecificDecay.h @@ -1,17 +1,15 @@ #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHHistoSpecificDecay_h #define HeavyFlavorAnalysis_SpecificDecay_BPHHistoSpecificDecay_h -#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHAnalyzerTokenWrapper.h" -#include "DataFormats/PatCandidates/interface/CompositeCandidate.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/TriggerResults.h" - +#include "DataFormats/PatCandidates/interface/CompositeCandidate.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/Ref.h" - #include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHAnalyzerTokenWrapper.h" #include @@ -38,7 +36,7 @@ class BPHHistoSpecificDecay : public BPHAnalyzerWrapper #include @@ -53,7 +43,7 @@ using namespace std; // is equivalent to // ( xyz = ps.getParameter< string >( "xyx" ) ) -BPHWriteSpecificDecay::BPHWriteSpecificDecay(const edm::ParameterSet& ps) { +BPHWriteSpecificDecay::BPHWriteSpecificDecay(const edm::ParameterSet& ps) : bFieldToken(esConsumes()) { usePV = (!SET_PAR(string, pVertexLabel, ps).empty()); usePM = (!SET_PAR(string, patMuonLabel, ps).empty()); useCC = (!SET_PAR(string, ccCandsLabel, ps).empty()); @@ -212,8 +202,6 @@ BPHWriteSpecificDecay::BPHWriteSpecificDecay(const edm::ParameterSet& ps) { produces(x3872Name); } -BPHWriteSpecificDecay::~BPHWriteSpecificDecay() {} - void BPHWriteSpecificDecay::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("pVertexLabel", ""); @@ -320,8 +308,7 @@ void BPHWriteSpecificDecay::fill(edm::Event& ev, const edm::EventSetup& es) { ccRefMap.clear(); // get magnetic field - edm::ESHandle magneticField; - es.get().get(magneticField); + const MagneticField* magneticField = &es.getData(bFieldToken); // get object collections // collections are got through "BPHTokenWrapper" interface to allow diff --git a/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHWriteSpecificDecay.h b/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHWriteSpecificDecay.h index c357045ca742f..1a7052d49305f 100644 --- a/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHWriteSpecificDecay.h +++ b/HeavyFlavorAnalysis/SpecificDecay/plugins/BPHWriteSpecificDecay.h @@ -1,26 +1,23 @@ #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHWriteSpecificDecay_h #define HeavyFlavorAnalysis_SpecificDecay_BPHWriteSpecificDecay_h -#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHAnalyzerTokenWrapper.h" - +#include "DataFormats/Candidate/interface/VertexCompositeCandidate.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/PatCandidates/interface/CompositeCandidate.h" +#include "DataFormats/PatCandidates/interface/GenericParticle.h" +#include "DataFormats/PatCandidates/interface/Muon.h" +#include "DataFormats/TrackReco/interface/Track.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" - +#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHAnalyzerTokenWrapper.h" #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHPlusMinusCandidate.h" #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoCandidate.h" #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHTrackReference.h" - -#include "DataFormats/Candidate/interface/VertexCompositeCandidate.h" #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHVertexCompositePtrCandidate.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/PatCandidates/interface/Muon.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/PatCandidates/interface/GenericParticle.h" -#include "DataFormats/PatCandidates/interface/CompositeCandidate.h" - +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "RecoVertex/KinematicFitPrimitives/interface/RefCountedKinematicParticle.h" #include "RecoVertex/KinematicFitPrimitives/interface/RefCountedKinematicVertex.h" @@ -34,7 +31,7 @@ class BPHRecoCandidate; class BPHWriteSpecificDecay : public BPHAnalyzerWrapper { public: explicit BPHWriteSpecificDecay(const edm::ParameterSet& ps); - ~BPHWriteSpecificDecay() override; + ~BPHWriteSpecificDecay() override = default; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); @@ -44,6 +41,7 @@ class BPHWriteSpecificDecay : public BPHAnalyzerWrapper bFieldToken; std::string pVertexLabel; std::string patMuonLabel; std::string ccCandsLabel;