From 55532cfc70aa7bc16259eee30b0dd14850c7090c Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 30 May 2023 04:48:40 +0200 Subject: [PATCH] Remove the source code of one obsolete AlCaReco producer: HcalCalIsolatedBunchFilter --- .../plugins/AlCaIsolatedBunchFilter.cc | 207 ------------------ ...COHcalCalIsolatedBunchFilter_Output_cff.py | 26 --- .../ALCARECOHcalCalIsolatedBunchFilter_cff.py | 15 -- 3 files changed, 248 deletions(-) delete mode 100644 Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc delete mode 100644 Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsolatedBunchFilter_Output_cff.py delete mode 100644 Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsolatedBunchFilter_cff.py diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc deleted file mode 100644 index 3e3f8ac0625e4..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc +++ /dev/null @@ -1,207 +0,0 @@ -// system include files -#include -#include -#include -#include -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDFilter.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/Run.h" -#include "FWCore/Framework/interface/LuminosityBlock.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/Common/interface/TriggerNames.h" - -#include "DataFormats/Common/interface/Handle.h" -//Triggers -#include "DataFormats/Common/interface/TriggerResults.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" -// -// class declaration -// - -//#define EDM_ML_DEBUG - -namespace alCaIsolatedBunchFilter { - struct Counters { - Counters() : nAll_(0), nGood_(0) {} - mutable std::atomic nAll_, nGood_; - }; -} // namespace alCaIsolatedBunchFilter - -class AlCaIsolatedBunchFilter : public edm::stream::EDFilter > { -public: - explicit AlCaIsolatedBunchFilter(edm::ParameterSet const&, const alCaIsolatedBunchFilter::Counters* count); - ~AlCaIsolatedBunchFilter() override; - - static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& iConfig) { - return std::make_unique(); - } - - bool filter(edm::Event&, edm::EventSetup const&) override; - void endStream() override; - static void globalEndJob(const alCaIsolatedBunchFilter::Counters* counters); - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void beginRun(edm::Run const&, edm::EventSetup const&) override; - void endRun(edm::Run const&, edm::EventSetup const&) override; - - // ----------member data --------------------------- - HLTConfigProvider hltConfig_; - unsigned int nRun_, nAll_, nGood_; - const std::vector trigJetNames_, trigIsoBunchNames_; - const std::string processName_; - const edm::InputTag theTriggerResultsLabel_; - const edm::EDGetTokenT tok_trigRes_; -}; - -// -// constructors and destructor -// -AlCaIsolatedBunchFilter::AlCaIsolatedBunchFilter(const edm::ParameterSet& iConfig, - const alCaIsolatedBunchFilter::Counters* count) - : nRun_(0), - nAll_(0), - nGood_(0), - trigJetNames_(iConfig.getParameter >("triggerJet")), - trigIsoBunchNames_(iConfig.getParameter >("triggerIsoBunch")), - processName_(iConfig.getParameter("processName")), - theTriggerResultsLabel_(iConfig.getParameter("triggerResultLabel")), - tok_trigRes_(consumes(theTriggerResultsLabel_)) { - edm::LogVerbatim("AlCaIsoBunch") << "Input tag for trigger results " << theTriggerResultsLabel_ << " with " - << trigIsoBunchNames_.size() << ":" << trigJetNames_.size() << " trigger names and" - << " process " << processName_ << std::endl; - for (unsigned int k = 0; k < trigIsoBunchNames_.size(); ++k) - edm::LogVerbatim("AlCaIsoBunch") << "Isolated Bunch[" << k << "] " << trigIsoBunchNames_[k] << std::endl; - for (unsigned int k = 0; k < trigJetNames_.size(); ++k) - edm::LogVerbatim("AlCaIsoBunch") << "Jet Trigger[" << k << "] " << trigJetNames_[k] << std::endl; -} - -AlCaIsolatedBunchFilter::~AlCaIsolatedBunchFilter() {} - -// -// member functions -// - -// ------------ method called on each new Event ------------ -bool AlCaIsolatedBunchFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) { - bool accept(false); - ++nAll_; -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("AlCaIsoBunch") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity " - << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() << std::endl; -#endif - //Step1: Find if the event passes one of the chosen triggers - if ((trigIsoBunchNames_.empty()) && (trigJetNames_.empty())) { - accept = true; - } else { - /////////////////////////////TriggerResults - auto const& triggerResults = iEvent.getHandle(tok_trigRes_); - if (triggerResults.isValid()) { - const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults); - const std::vector& triggerNames_ = triggerNames.triggerNames(); - bool jet(false), isobunch(false); - for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) { - int hlt = triggerResults->accept(iHLT); - if (!jet) { - for (unsigned int i = 0; i < trigJetNames_.size(); ++i) { - if (triggerNames_[iHLT].find(trigJetNames_[i]) != std::string::npos) { - if (hlt > 0) - jet = true; - if (jet) { -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("AlCaIsoBunch") - << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << jet << ":" << isobunch << std::endl; -#endif - break; - } - } - } - } - if (!isobunch) { - for (unsigned int i = 0; i < trigIsoBunchNames_.size(); ++i) { - if (triggerNames_[iHLT].find(trigIsoBunchNames_[i]) != std::string::npos) { - if (hlt > 0) - isobunch = true; - if (isobunch) { -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("AlCaIsoBunch") - << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << jet << ":" << isobunch << std::endl; -#endif - break; - } - } - } - } - if (jet && isobunch) { - accept = true; - break; - } - } - } - } - - // Step 2: Return the acceptance flag - if (accept) - ++nGood_; - return accept; - -} // AlCaIsolatedBunchFilter::filter -// ------------ method called once each job just after ending the event loop ------------ -void AlCaIsolatedBunchFilter::endStream() { - globalCache()->nAll_ += nAll_; - globalCache()->nGood_ += nGood_; -} - -void AlCaIsolatedBunchFilter::globalEndJob(const alCaIsolatedBunchFilter::Counters* count) { - edm::LogVerbatim("AlCaIsoBunch") << "Selects " << count->nGood_ << " in " << count->nAll_ << " events" << std::endl; -} - -// ------------ method called when starting to processes a run ------------ -void AlCaIsolatedBunchFilter::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { - bool changed(false); - edm::LogVerbatim("AlCaIsoBunch") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " - << hltConfig_.init(iRun, iSetup, processName_, changed) << std::endl; -} -// ------------ method called when ending the processing of a run ------------ -void AlCaIsolatedBunchFilter::endRun(edm::Run const& iRun, edm::EventSetup const&) { - ++nRun_; - edm::LogVerbatim("AlCaIsoBunch") << "endRun[" << nRun_ << "] " << iRun.run() << std::endl; -} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void AlCaIsolatedBunchFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - desc.add("triggerResultLabel", edm::InputTag("TriggerResults", "", "HLT")); - desc.add("processName", "HLT"); - std::vector isobunch = {"HLT_ZeroBias_IsolatedBunches"}; - desc.add >("triggerIsoBunch", isobunch); - std::vector triggers = {"HLT_AK8PFJet", - "HLT_AK8PFHT", - "HLT_CaloJet", - "HLT_HT", - "HLT_JetE", - "HLT_PFHT", - "HLT_DiPFJet", - "HLT_PFJet", - "HLT_DiCentralPFJet", - "HLT_QuadPFJet", - "HLT_L1_TripleJet_VBF", - "HLT_QuadJet", - "HLT_DoubleJet", - "HLT_AK8DiPFJet", - "HLT_AK4CaloJet", - "HLT_AK4PFJet"}; - desc.add >("triggerJet", triggers); - descriptions.add("alcaIsolatedBunchFilter", desc); -} - -//define this as a plug-in -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(AlCaIsolatedBunchFilter); diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsolatedBunchFilter_Output_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsolatedBunchFilter_Output_cff.py deleted file mode 100644 index 785c0528bf5b1..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsolatedBunchFilter_Output_cff.py +++ /dev/null @@ -1,26 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# output block for alcastream HCAL IsolatedBunch -# output module -# module alcastreamHcalIsolatedBunchOutput = PoolOutputModule - -OutALCARECOHcalCalIsolatedBunchFilter_noDrop = cms.PSet( - # use this in case of filter available - SelectEvents = cms.untracked.PSet( - SelectEvents = cms.vstring('pathALCARECOHcalCalIsolatedBunchFilter') - ), - outputCommands = cms.untracked.vstring( - 'keep *_hbhereco_*_*', - 'keep *_ecalRecHit_*_*', - 'keep *_hltTriggerSummaryAOD_*_*', - 'keep *_TriggerResults_*_*', - 'keep HcalNoiseSummary_hcalnoise_*_*', - 'keep *_HBHEChannelInfo_*_*', - 'keep FEDRawDataCollection_rawDataCollector_*_*', - 'keep FEDRawDataCollection_source_*_*', - ) -) - -import copy -OutALCARECOHcalCalIsolatedBunchFilter=copy.deepcopy(OutALCARECOHcalCalIsolatedBunchFilter_noDrop) -OutALCARECOHcalCalIsolatedBunchFilter.outputCommands.insert(0, "drop *") diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsolatedBunchFilter_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsolatedBunchFilter_cff.py deleted file mode 100644 index 70e2c4dd7da71..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsolatedBunchFilter_cff.py +++ /dev/null @@ -1,15 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -#------------------------------------------------- -#AlCaReco filtering for HCAL isotrk:isolated bunch: -#------------------------------------------------- -import HLTrigger.HLTfilters.hltHighLevel_cfi -ALCARECOHcalCalIsolatedBunchFilterHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone( - eventSetupPathsKey = 'HcalCalIsolatedBunchFilter', - throw = False #dont throw except on unknown path name -) - -from Calibration.HcalAlCaRecoProducers.alcaIsolatedBunchFilter_cfi import * - -seqALCARECOHcalCalIsolatedBunchFilter = cms.Sequence(ALCARECOHcalCalIsolatedBunchFilterHLT * - alcaIsolatedBunchFilter)