diff --git a/RecoBTag/ImpactParameter/test/IPAnalyzer.cc b/RecoBTag/ImpactParameter/test/IPAnalyzer.cc index 6129966fcf8e2..536033039ea86 100644 --- a/RecoBTag/ImpactParameter/test/IPAnalyzer.cc +++ b/RecoBTag/ImpactParameter/test/IPAnalyzer.cc @@ -18,7 +18,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -49,7 +49,7 @@ using namespace reco; // class decleration // -class IPAnalyzer : public edm::EDAnalyzer { +class IPAnalyzer : public edm::one::EDAnalyzer<> { public: explicit IPAnalyzer(const edm::ParameterSet&); ~IPAnalyzer() {} diff --git a/RecoBTag/Skimming/interface/BTagSkimLeptonJet.h b/RecoBTag/Skimming/interface/BTagSkimLeptonJet.h index 3ad4e3f18e329..9cf386361d507 100644 --- a/RecoBTag/Skimming/interface/BTagSkimLeptonJet.h +++ b/RecoBTag/Skimming/interface/BTagSkimLeptonJet.h @@ -11,13 +11,13 @@ */ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" -class BTagSkimLeptonJet : public edm::EDFilter { +class BTagSkimLeptonJet : public edm::one::EDFilter<> { public: explicit BTagSkimLeptonJet(const edm::ParameterSet&); ~BTagSkimLeptonJet() override; diff --git a/RecoBTag/Skimming/interface/BTagSkimMC.h b/RecoBTag/Skimming/interface/BTagSkimMC.h index 4868be123e32f..17e5607bdd421 100644 --- a/RecoBTag/Skimming/interface/BTagSkimMC.h +++ b/RecoBTag/Skimming/interface/BTagSkimMC.h @@ -1,12 +1,25 @@ -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -class BTagSkimMC : public edm::EDFilter { +namespace BTagSkimMCCount { + struct Counters { + Counters() : nEvents_(0), nAccepted_(0) {} + mutable std::atomic nEvents_, nAccepted_; + }; +} // namespace BTagSkimMCCount + +class BTagSkimMC : public edm::stream::EDFilter > { public: /// constructor - BTagSkimMC(const edm::ParameterSet&); + explicit BTagSkimMC(const edm::ParameterSet&, const BTagSkimMCCount::Counters* count); + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const&) { + return std::make_unique(); + } + bool filter(edm::Event& evt, const edm::EventSetup& es) override; - void endJob() override; + void endStream() override; + static void globalEndJob(const BTagSkimMCCount::Counters* counters); private: bool verbose; diff --git a/RecoBTag/Skimming/src/BTagSkimMC.cc b/RecoBTag/Skimming/src/BTagSkimMC.cc index 5749334a0d588..016358a8a977d 100644 --- a/RecoBTag/Skimming/src/BTagSkimMC.cc +++ b/RecoBTag/Skimming/src/BTagSkimMC.cc @@ -10,7 +10,7 @@ using namespace std; #include "DataFormats/HepMCCandidate/interface/GenParticle.h" using namespace reco; -BTagSkimMC::BTagSkimMC(const ParameterSet& p) : nEvents_(0), nAccepted_(0) { +BTagSkimMC::BTagSkimMC(const ParameterSet& p, const BTagSkimMCCount::Counters* count) : nEvents_(0), nAccepted_(0) { verbose = p.getUntrackedParameter("verbose", false); pthatMin = p.getParameter("pthat_min"); pthatMax = p.getParameter("pthat_max"); @@ -77,12 +77,18 @@ bool BTagSkimMC::filter(Event& evt, const EventSetup& es) { return false; } -void BTagSkimMC::endJob() { +void BTagSkimMC::endStream() { + globalCache()->nEvents_ += nEvents_; + globalCache()->nAccepted_ += nAccepted_; +} + +void BTagSkimMC::globalEndJob(const BTagSkimMCCount::Counters* count) { edm::LogVerbatim("BTagSkimMC") << "=============================================================================\n" - << " Events read: " << nEvents_ << "\n Events accepted by BTagSkimMC: " << nAccepted_ - << "\n Efficiency: " << (double)(nAccepted_) / (double)(nEvents_) + << " Events read: " << count->nEvents_ + << "\n Events accepted by BTagSkimMC: " << count->nAccepted_ + << "\n Efficiency: " << (double)(count->nAccepted_) / (double)(count->nEvents_) << "\n===========================================================================" - << endl; + << std::endl; } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/RecoBTag/SoftLepton/test/testLeptonAssociator.cc b/RecoBTag/SoftLepton/test/testLeptonAssociator.cc index b30a4f1a0af68..d13c306584717 100644 --- a/RecoBTag/SoftLepton/test/testLeptonAssociator.cc +++ b/RecoBTag/SoftLepton/test/testLeptonAssociator.cc @@ -6,7 +6,7 @@ #include #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +28,7 @@ namespace std { }; } // namespace std -class testLeptonAssociator : public edm::EDAnalyzer { +class testLeptonAssociator : public edm::one::EDAnalyzer<> { public: explicit testLeptonAssociator(const edm::ParameterSet& iConfig); virtual void analyze(const edm::Event& iEvent, const edm::EventSetup& setup) override; diff --git a/RecoBTag/SoftLepton/test/testMuonAssociator.cc b/RecoBTag/SoftLepton/test/testMuonAssociator.cc index 29b827645ea80..02a6226b16b99 100644 --- a/RecoBTag/SoftLepton/test/testMuonAssociator.cc +++ b/RecoBTag/SoftLepton/test/testMuonAssociator.cc @@ -5,7 +5,7 @@ #include #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -26,7 +26,7 @@ namespace std { }; } // namespace std -class testMuonAssociator : public edm::EDAnalyzer { +class testMuonAssociator : public edm::one::EDAnalyzer<> { public: explicit testMuonAssociator(const edm::ParameterSet& iConfig); virtual ~testMuonAssociator(); diff --git a/RecoBTag/TrackProbability/test/CalibrationSkeleton.cc b/RecoBTag/TrackProbability/test/CalibrationSkeleton.cc index d8c3abdbe51ba..3bdefec794831 100644 --- a/RecoBTag/TrackProbability/test/CalibrationSkeleton.cc +++ b/RecoBTag/TrackProbability/test/CalibrationSkeleton.cc @@ -24,7 +24,7 @@ using namespace std; // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/RecoBTag/TrackProbability/test/TrackProbabilityAnalyzer.cc b/RecoBTag/TrackProbability/test/TrackProbabilityAnalyzer.cc index d7b6aa697bfca..7eb0ed2388212 100644 --- a/RecoBTag/TrackProbability/test/TrackProbabilityAnalyzer.cc +++ b/RecoBTag/TrackProbability/test/TrackProbabilityAnalyzer.cc @@ -24,7 +24,7 @@ using namespace std; // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -53,7 +53,7 @@ using namespace reco; // class decleration // -class TrackProbabilityAnalyzer : public edm::EDAnalyzer { +class TrackProbabilityAnalyzer : public edm::one::EDAnalyzer<> { public: explicit TrackProbabilityAnalyzer(const edm::ParameterSet&); ~TrackProbabilityAnalyzer() {} diff --git a/RecoBTag/TrackProbability/test/TrackProbabilityXMLtoDB.cc b/RecoBTag/TrackProbability/test/TrackProbabilityXMLtoDB.cc index e1fc52f69d80f..8e8203669c7f5 100644 --- a/RecoBTag/TrackProbability/test/TrackProbabilityXMLtoDB.cc +++ b/RecoBTag/TrackProbability/test/TrackProbabilityXMLtoDB.cc @@ -24,7 +24,7 @@ using namespace std; // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/RecoBTag/XMLCalibration/test/XMLCalibrationTest.cc b/RecoBTag/XMLCalibration/test/XMLCalibrationTest.cc index 80d23726ec162..d0ec4b4afe6e9 100644 --- a/RecoBTag/XMLCalibration/test/XMLCalibrationTest.cc +++ b/RecoBTag/XMLCalibration/test/XMLCalibrationTest.cc @@ -5,7 +5,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -24,7 +24,7 @@ class TestCategory; ///This is an example of how to use the AlgorithmCalibration stuff // to read the calibrated objects from a .xml file -class XMLCalibrationTest : public edm::EDAnalyzer { +class XMLCalibrationTest : public edm::one::EDAnalyzer<> { public: explicit XMLCalibrationTest(const edm::ParameterSet&); ~XMLCalibrationTest();