diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 2abc5cce7e82c..01b08a9b7a69c 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -129,10 +129,20 @@ def customiseFor2018Input(process): return process +def customiseFor35315(process): + """Update the HLT configuration for the changes in #35315""" + for module in filters_by_type(process, "HLTHcalCalibTypeFilter"): + if hasattr(module, "FilterSummary"): + delattr(module, "FilterSummary") + + return process + # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) + process = customiseFor35315(process) + return process diff --git a/HLTrigger/special/plugins/HLTHcalCalibTypeFilter.cc b/HLTrigger/special/plugins/HLTHcalCalibTypeFilter.cc index f887fc7f6f5a8..e02ef614f7c73 100644 --- a/HLTrigger/special/plugins/HLTHcalCalibTypeFilter.cc +++ b/HLTrigger/special/plugins/HLTHcalCalibTypeFilter.cc @@ -21,49 +21,51 @@ Description: Filter to select HCAL abort gap events #include #include -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" - -#include "HLTrigger/HLTcore/interface/HLTFilter.h" +// CMSSW include files +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h" +#include "EventFilter/HcalRawToDigi/interface/AMC13Header.h" +#include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h" +#include "EventFilter/HcalRawToDigi/interface/HcalUHTRData.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/global/EDFilter.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "HLTrigger/HLTcore/interface/HLTFilter.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h" -#include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h" -#include "EventFilter/HcalRawToDigi/interface/HcalUHTRData.h" -#include "EventFilter/HcalRawToDigi/interface/AMC13Header.h" -#include "HLTHcalCalibTypeFilter.h" +// +// class declaration +// + +class HLTHcalCalibTypeFilter : public edm::global::EDFilter<> { +public: + explicit HLTHcalCalibTypeFilter(const edm::ParameterSet&); + ~HLTHcalCalibTypeFilter() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + + // ----------member data --------------------------- + const edm::EDGetTokenT inputToken_; + const std::vector calibTypes_; +}; // // constructors and destructor // HLTHcalCalibTypeFilter::HLTHcalCalibTypeFilter(const edm::ParameterSet& config) - : DataInputToken_(consumes(config.getParameter("InputTag"))), - CalibTypes_(config.getParameter >("CalibTypes")), - Summary_(config.getUntrackedParameter("FilterSummary", false)), - eventsByType_() { - for (auto& i : eventsByType_) - i = 0; -} - -HLTHcalCalibTypeFilter::~HLTHcalCalibTypeFilter() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} + : inputToken_(consumes(config.getParameter("InputTag"))), + calibTypes_(config.getParameter >("CalibTypes")) {} void HLTHcalCalibTypeFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("InputTag", edm::InputTag("source")); - std::vector temp; - for (int i = 1; i <= 5; i++) - temp.push_back(i); - desc.add >("CalibTypes", temp); - desc.addUntracked("FilterSummary", false); + desc.add >("CalibTypes", {1, 2, 3, 4, 5}); descriptions.add("hltHcalCalibTypeFilter", desc); } @@ -73,34 +75,31 @@ void HLTHcalCalibTypeFilter::fillDescriptions(edm::ConfigurationDescriptions& de // ------------ method called on each new Event ------------ bool HLTHcalCalibTypeFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - using namespace edm; + auto const& rawdata = iEvent.get(inputToken_); - edm::Handle rawdata; - iEvent.getByToken(DataInputToken_, rawdata); + // some inits + int numZeroes = 0, numPositives = 0; - // some inits - int numZeroes(0), numPositives(0); - - // loop over all HCAL FEDs + // loop over all HCAL FEDs for (int fed = FEDNumbering::MINHCALFEDID; fed <= FEDNumbering::MAXHCALuTCAFEDID; fed++) { - // skip FEDs in between VME and uTCA + // skip FEDs in between VME and uTCA if (fed > FEDNumbering::MAXHCALFEDID && fed < FEDNumbering::MINHCALuTCAFEDID) continue; - // get raw data and check if there are empty feds - const FEDRawData& fedData = rawdata->FEDData(fed); + // get raw data and check if there are empty feds + const FEDRawData& fedData = rawdata.FEDData(fed); if (fedData.size() < 24) continue; if (fed <= FEDNumbering::MAXHCALFEDID) { - // VME get event type + // VME get event type int eventtype = ((const HcalDCCHeader*)(fedData.data()))->getCalibType(); if (eventtype == 0) numZeroes++; else numPositives++; } else { - // UTCA + // UTCA hcal::AMC13Header const* hamc13 = (hcal::AMC13Header const*)fedData.data(); for (int iamc = 0; iamc < hamc13->NAMC(); iamc++) { HcalUHTRData uhtr(hamc13->AMCPayload(iamc), hamc13->AMCSize(iamc)); @@ -113,11 +112,9 @@ bool HLTHcalCalibTypeFilter::filter(edm::StreamID, edm::Event& iEvent, const edm } } - // - // if there are FEDs with Non-Collission event type, check what the majority is - // if calibs - true - // if 0s - false - // + // if there are FEDs with Non-Collision event type, check what the majority is + // if calibs - true + // if 0s - false if (numPositives > 0) { if (numPositives > numZeroes) return true; @@ -125,21 +122,11 @@ bool HLTHcalCalibTypeFilter::filter(edm::StreamID, edm::Event& iEvent, const edm edm::LogWarning("HLTHcalCalibTypeFilter") << "Conflicting Calibration Types found"; } - // return false if there are no positives - // and if the majority has 0 calib type + // return false if there are no positives + // and if the majority has 0 calib type return false; } -// ------------ method called once each job just after ending the event loop ------------ -void HLTHcalCalibTypeFilter::endJob() { - if (Summary_) - edm::LogWarning("HLTHcalCalibTypeFilter") - << "Summary of filter decisions: " << eventsByType_.at(hc_Null) << "(No Calib), " - << eventsByType_.at(hc_Pedestal) << "(Pedestal), " << eventsByType_.at(hc_RADDAM) << "(RADDAM), " - << eventsByType_.at(hc_HBHEHPD) << "(HBHE/HPD), " << eventsByType_.at(hc_HOHPD) << "(HO/HPD), " - << eventsByType_.at(hc_HFPMT) << "(HF/PMT)"; -} - // declare this class as a framework plugin #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(HLTHcalCalibTypeFilter); diff --git a/HLTrigger/special/plugins/HLTHcalCalibTypeFilter.h b/HLTrigger/special/plugins/HLTHcalCalibTypeFilter.h deleted file mode 100644 index 499cc8f19b292..0000000000000 --- a/HLTrigger/special/plugins/HLTHcalCalibTypeFilter.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef HLTHcalCalibTypeFilter_h -#define HLTHcalCalibTypeFilter_h -// -*- C++ -*- -// -// Package: HLTHcalCalibTypeFilter -// Class: HLTHcalCalibTypeFilter -// -/**\class HLTHcalCalibTypeFilter HLTHcalCalibTypeFilter.cc filter/HLTHcalCalibTypeFilter/src/HLTHcalCalibTypeFilter.cc - -Description: Filter to select HCAL abort gap events - -Implementation: - -*/ -// -// Original Author: Bryan DAHMES -// Created: Tue Jan 22 13:55:00 CET 2008 -// -// - -// include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/global/EDFilter.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" - -#include -#include -#include - -namespace edm { - class ConfigurationDescriptions; -} - -// -// class declaration -// - -class HLTHcalCalibTypeFilter : public edm::global::EDFilter<> { -public: - explicit HLTHcalCalibTypeFilter(const edm::ParameterSet&); - ~HLTHcalCalibTypeFilter() override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - void endJob(void) override; - - // ----------member data --------------------------- - const edm::EDGetTokenT DataInputToken_; - const std::vector CalibTypes_; - const bool Summary_; - mutable std::array, 8> eventsByType_; -}; - -#endif