Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20065 from bsunanda/Run2-hcx140
Run2-hcx140 Backport PR's #19574 and #20049 which provides two HLT filters (1) for selecting multiple L1 objects; (2) Laser firing in HCAL
- Loading branch information
Showing
5 changed files
with
396 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#ifndef HLTriggerspecialHLTHcalLaserMisfireFilter_h | ||
#define HLTriggerspecialHLTHcalLaserMisfireFilter_h | ||
// -*- C++ -*- | ||
// | ||
// Package: HLTHcalLaserMisfireFilter | ||
// Class: HLTHcalLaserMisfireFilter | ||
// | ||
/**\class HLTHcalLaserMisfireFilter HLTHcalLaserMisfireFilter.cc filter/HLTHcalCalibTypeFilter/src/HLTHcalCalibTypeFilter.cc | ||
Description: Filter to select HCAL Laser fired events | ||
Implementation: | ||
<Notes on implementation> | ||
*/ | ||
|
||
// 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 "DataFormats/HcalDigi/interface/HcalDigiCollections.h" | ||
|
||
namespace edm { | ||
class ConfigurationDescriptions; | ||
} | ||
|
||
// | ||
// class declaration | ||
// | ||
|
||
class HLTHcalLaserMisfireFilter : public edm::global::EDFilter<> { | ||
public: | ||
explicit HLTHcalLaserMisfireFilter(const edm::ParameterSet&); | ||
~HLTHcalLaserMisfireFilter(); | ||
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); | ||
|
||
private: | ||
virtual bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; | ||
virtual void endJob(void) override {} | ||
|
||
// ----------member data --------------------------- | ||
edm::InputTag inputHBHE_, inputHF_; | ||
edm::EDGetTokenT<HBHEDigiCollection> inputTokenHBHE_; | ||
edm::EDGetTokenT<QIE10DigiCollection> inputTokenHF_; | ||
double minFracDiffHBHELaser_, minFracHFLaser_; | ||
int minADCHBHE_, minADCHF_; | ||
bool testMode_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef HLTriggerspecialHLTMultipletFilter_h | ||
#define HLTriggerspecialHLTMultipletFilter_h | ||
|
||
#include "HLTrigger/HLTcore/interface/HLTFilter.h" | ||
#include "DataFormats/L1Trigger/interface/EGamma.h" | ||
#include "DataFormats/L1Trigger/interface/EtSum.h" | ||
#include "DataFormats/L1Trigger/interface/Jet.h" | ||
#include "DataFormats/L1Trigger/interface/Muon.h" | ||
#include "DataFormats/L1Trigger/interface/Tau.h" | ||
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" | ||
|
||
namespace edm { | ||
class ConfigurationDescriptions; | ||
} | ||
|
||
class HLTMultipletFilter : public HLTFilter { | ||
|
||
public: | ||
explicit HLTMultipletFilter(const edm::ParameterSet&); | ||
~HLTMultipletFilter(); | ||
virtual bool hltFilter(edm::Event&, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; | ||
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); | ||
|
||
private: | ||
|
||
static const int nobj_=5; | ||
enum Types {EGamma=0, EtSum=1, Jet=2, Muon=3, Tau=4}; | ||
template<typename T1> | ||
int objects(edm::Event&, edm::EDGetTokenT<T1> const&, edm::InputTag const&, | ||
HLTMultipletFilter::Types) const; | ||
|
||
edm::InputTag hltEGammaSeedLabel_, hltEtSumSeedLabel_; | ||
edm::InputTag hltJetSeedLabel_, hltMuonSeedLabel_; | ||
edm::InputTag hltTauSeedLabel_; | ||
double minEta_, maxEta_; | ||
double minPhi_, maxPhi_; | ||
double minPt_; | ||
int ibxMin_, ibxMax_, minN_; | ||
bool flag_[nobj_]; | ||
edm::EDGetTokenT<l1t::EGammaBxCollection> hltEGammaToken_; | ||
edm::EDGetTokenT<l1t::EtSumBxCollection> hltEtSumToken_; | ||
edm::EDGetTokenT<l1t::JetBxCollection> hltJetToken_; | ||
edm::EDGetTokenT<l1t::MuonBxCollection> hltMuonToken_; | ||
edm::EDGetTokenT<l1t::TauBxCollection> hltTauToken_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
// -*- C++ -*- | ||
// | ||
// Package: HLTHcalLaserMisfireFilter | ||
// Class: HLTHcalLaserMisfireFilter | ||
// | ||
/**\class HLTHcalLaserMisfireFilter HLTHcalLaserMisfireFilter.cc | ||
Description: Filter to select misfires of the HCAL laser. | ||
Implementation: | ||
Three HBHE RBX's ("bad") do not see the laser signal. Laser events are | ||
selected by finding events with a large fraction of digis in HBHE above | ||
a given threshold that do not have signals in the "bad" RBXes. | ||
For HF events are selected if a large fraction of digis in HF are above | ||
a given threshold | ||
*/ | ||
|
||
// system include files | ||
#include <memory> | ||
|
||
// user include files | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
|
||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "DataFormats/Common/interface/RefToBase.h" | ||
#include "DataFormats/FEDRawData/interface/FEDNumbering.h" | ||
#include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h" | ||
#include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h" | ||
#include "HLTrigger/special/interface/HLTHcalLaserMisfireFilter.h" | ||
|
||
// | ||
// constructors and destructor | ||
// | ||
HLTHcalLaserMisfireFilter::HLTHcalLaserMisfireFilter(const edm::ParameterSet& config) { | ||
inputHBHE_ = config.getParameter<edm::InputTag>("InputHBHE"); | ||
inputHF_ = config.getParameter<edm::InputTag>("InputHF"); | ||
minFracDiffHBHELaser_ = config.getParameter<double>("minFracDiffHBHELaser"); | ||
minFracHFLaser_ = config.getParameter<double>("minFracHFLaser"); | ||
minADCHBHE_ = config.getParameter<int>("minADCHBHE"); | ||
minADCHF_ = config.getParameter<int>("minADCHF"), | ||
testMode_ = config.getUntrackedParameter<bool>("testMode",false); | ||
|
||
inputTokenHBHE_ = consumes<HBHEDigiCollection>(inputHBHE_); | ||
inputTokenHF_ = consumes<QIE10DigiCollection>(inputHF_); | ||
|
||
} | ||
|
||
HLTHcalLaserMisfireFilter::~HLTHcalLaserMisfireFilter() { } | ||
|
||
void HLTHcalLaserMisfireFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
desc.add<edm::InputTag>("InputHBHE",edm::InputTag("source")); | ||
desc.add<edm::InputTag>("InputHF",edm::InputTag("source")); | ||
desc.add<int>("minADCHBHE",10); | ||
desc.add<int>("minADCHF",10); | ||
desc.add<double>("minFracDiffHBHELaser",0.3); | ||
desc.add<double>("minFracHFLaser",0.3); | ||
desc.addUntracked<bool>("testMode",false); | ||
descriptions.add("hltHcalLaserMisfireFilter",desc); | ||
} | ||
|
||
bool HLTHcalLaserMisfireFilter::filter(edm::StreamID, edm::Event& iEvent, | ||
const edm::EventSetup& iSetup) const { | ||
|
||
edm::Handle<HBHEDigiCollection> hbhe_digi; | ||
iEvent.getByToken(inputTokenHBHE_, hbhe_digi); | ||
|
||
edm::Handle<QIE10DigiCollection> hf_digi; | ||
iEvent.getByToken(inputTokenHF_, hf_digi); | ||
|
||
// Count digis in good, bad RBXes. ('bad' RBXes see no laser signal) | ||
double badrbxfracHBHE(0), goodrbxfracHBHE(0), allrbxfracHF(0); | ||
int NbadHBHE = 72*3; // 3 bad RBXes, 72 channels each | ||
int NgoodHBHE= 2592*2-NbadHBHE; // remaining HBHE channels are 'good' | ||
int NallHF = 864*4; | ||
|
||
for (auto hbhe = hbhe_digi->begin(); hbhe != hbhe_digi->end(); ++ hbhe){ | ||
const HBHEDataFrame digi = (const HBHEDataFrame)(*hbhe); | ||
HcalDetId myid=(HcalDetId)digi.id(); | ||
bool isbad(false); // assume channel is not bad | ||
|
||
bool passCut(false); | ||
int maxdigiHB(0); | ||
for (int i=0; i<digi.size(); i++) | ||
if(digi.sample(i).adc() > maxdigiHB) maxdigiHB = digi.sample(i).adc(); | ||
if (maxdigiHB > minADCHBHE_) passCut = true; | ||
|
||
// Three RBX's in HB do not receive any laser light (HBM5, HBM8, HBM9) | ||
// They correspond to iphi = 15:18, 27:30, 31:34 respectively and | ||
// ieta < 0 | ||
if ( myid.subdet()==HcalBarrel && myid.ieta()<0 ) { | ||
if (myid.iphi()>=15 && myid.iphi()<=18) isbad=true; | ||
else if (myid.iphi()>=27 && myid.iphi()<=34) isbad=true; | ||
} | ||
|
||
if (passCut) { | ||
if (isbad) { | ||
badrbxfracHBHE += 1.; | ||
} else goodrbxfracHBHE += 1.; | ||
} | ||
} | ||
goodrbxfracHBHE /= NgoodHBHE; | ||
badrbxfracHBHE /= NbadHBHE; | ||
|
||
for (auto hf = hf_digi->begin(); hf != hf_digi->end(); ++hf) { | ||
const QIE10DataFrame digi = (const QIE10DataFrame)(*hf); | ||
bool passCut(false); | ||
int maxdigiHF(0); | ||
for (int i=0; i<digi.samples(); i++) | ||
if(digi[i].adc() > maxdigiHF) maxdigiHF = digi[i].adc(); | ||
if (maxdigiHF > minADCHF_) passCut = true; | ||
|
||
if (passCut) { | ||
allrbxfracHF += 1.; | ||
} | ||
} | ||
allrbxfracHF /= NallHF; | ||
|
||
if (testMode_) | ||
edm::LogVerbatim("Report") | ||
<< "******************************************************************\n" | ||
<< "goodrbxfracHBHE: " << goodrbxfracHBHE << " badrbxfracHBHE: " | ||
<< badrbxfracHBHE << " Size " << hbhe_digi->size() << "\n" | ||
<< "allrbxfracHF: " << allrbxfracHF << " Size " << hf_digi->size() | ||
<< "\n******************************************************************"; | ||
|
||
if (((goodrbxfracHBHE-badrbxfracHBHE) < minFracDiffHBHELaser_) || | ||
(allrbxfracHF < minFracHFLaser_)) return false; | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
#include "HLTrigger/special/interface/HLTMultipletFilter.h" | ||
|
||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "DataFormats/Common/interface/RefToBase.h" | ||
|
||
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" | ||
#include "DataFormats/L1Trigger/interface/L1JetParticle.h" | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
|
||
#include <cmath> | ||
|
||
HLTMultipletFilter::HLTMultipletFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConfig) { | ||
|
||
hltEGammaSeedLabel_= iConfig.getParameter<edm::InputTag>("L1EGammaInputTag"); | ||
hltEtSumSeedLabel_ = iConfig.getParameter<edm::InputTag>("L1EtSumInputTag"); | ||
hltJetSeedLabel_ = iConfig.getParameter<edm::InputTag>("L1JetInputTag"); | ||
hltMuonSeedLabel_ = iConfig.getParameter<edm::InputTag>("L1MuonInputTag"); | ||
hltTauSeedLabel_ = iConfig.getParameter<edm::InputTag>("L1TauInputTag"); | ||
minN_ = iConfig.getParameter<int> ("MinN"); | ||
ibxMin_ = iConfig.getParameter<int> ("IBxMin"); | ||
ibxMax_ = iConfig.getParameter<int> ("IBxMax"); | ||
minEta_ = iConfig.getParameter<double> ("MinEta"); | ||
maxEta_ = iConfig.getParameter<double> ("MaxEta"); | ||
minPhi_ = iConfig.getParameter<double> ("MinPhi"); | ||
maxPhi_ = iConfig.getParameter<double> ("MaxPhi"); | ||
minPt_ = iConfig.getParameter<double> ("MinPt"); | ||
|
||
if (hltEGammaSeedLabel_ == edm::InputTag()) { | ||
flag_[EGamma] = false; | ||
} else { | ||
flag_[EGamma] = true; | ||
hltEGammaToken_ = consumes<l1t::EGammaBxCollection>(hltEGammaSeedLabel_); | ||
} | ||
if (hltEtSumSeedLabel_ == edm::InputTag()) { | ||
flag_[EtSum] = false; | ||
} else { | ||
flag_[EtSum] = true; | ||
hltEtSumToken_ = consumes<l1t::EtSumBxCollection>(hltEtSumSeedLabel_); | ||
} | ||
if (hltJetSeedLabel_ == edm::InputTag()) { | ||
flag_[Jet] = false; | ||
} else { | ||
flag_[Jet] = true; | ||
hltJetToken_ = consumes<l1t::JetBxCollection>(hltJetSeedLabel_); | ||
} | ||
if (hltMuonSeedLabel_ == edm::InputTag()) { | ||
flag_[Muon] = false; | ||
} else { | ||
flag_[Muon] = true; | ||
hltMuonToken_ = consumes<l1t::MuonBxCollection>(hltMuonSeedLabel_); | ||
} | ||
if (hltTauSeedLabel_ == edm::InputTag()) { | ||
flag_[Tau] = false; | ||
} else { | ||
flag_[Tau] = true; | ||
hltTauToken_ = consumes<l1t::TauBxCollection>(hltTauSeedLabel_); | ||
} | ||
edm::LogVerbatim("Report") << "Input Parameters:: minN = " << minN_ | ||
<< " Bx Range = " << ibxMin_ << ":" << ibxMax_ | ||
<< " minPt = " << minPt_ << " Eta " << minEta_ | ||
<< ":" << maxEta_ << " Phi " << minPhi_ << ":" | ||
<< maxPhi_ << " GT Seed for EGamma " | ||
<< hltEGammaSeedLabel_ << ", EtSum " | ||
<< hltEtSumSeedLabel_ << ", Jet " | ||
<< hltJetSeedLabel_ << ", Muon " | ||
<< hltMuonSeedLabel_ << ", and Tau " | ||
<< hltTauSeedLabel_ << std::endl; | ||
} | ||
|
||
HLTMultipletFilter::~HLTMultipletFilter()= default; | ||
|
||
void | ||
HLTMultipletFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
makeHLTFilterDescription(desc); | ||
desc.add<edm::InputTag>("L1EGammaInputTag",edm::InputTag()); | ||
desc.add<edm::InputTag>("L1EtSumInputTag",edm::InputTag()); | ||
desc.add<edm::InputTag>("L1JetInputTag",edm::InputTag("hltCaloStage2Digis:Jet")); | ||
desc.add<edm::InputTag>("L1MuonInputTag",edm::InputTag()); | ||
desc.add<edm::InputTag>("L1TauInputTag",edm::InputTag("hltCaloStage2Digis:Tau")); | ||
desc.add<int>("MinN",1); | ||
desc.add<int>("IBxMin",0); | ||
desc.add<int>("IBxMax",0); | ||
desc.add<double>("MinEta",1.305); | ||
desc.add<double>("MaxEta",3.000); | ||
desc.add<double>("MinPhi",5.4105); | ||
desc.add<double>("MaxPhi",5.5796); | ||
desc.add<double>("MinPt", 20.0); | ||
descriptions.add("hltMultipletFilter",desc); | ||
} | ||
|
||
bool HLTMultipletFilter::hltFilter(edm::Event& iEvent, const edm::EventSetup& iSetup, trigger::TriggerFilterObjectWithRefs & filterproduct) const { | ||
|
||
// the filter object | ||
if (saveTags()) { | ||
if (flag_[EGamma]) filterproduct.addCollectionTag(hltEGammaSeedLabel_); | ||
if (flag_[EtSum]) filterproduct.addCollectionTag(hltEtSumSeedLabel_); | ||
if (flag_[Jet]) filterproduct.addCollectionTag(hltJetSeedLabel_); | ||
if (flag_[Muon]) filterproduct.addCollectionTag(hltMuonSeedLabel_); | ||
if (flag_[Tau]) filterproduct.addCollectionTag(hltTauSeedLabel_); | ||
} | ||
|
||
int nobj(0); | ||
if (flag_[EGamma]) { | ||
nobj += objects(iEvent,hltEGammaToken_,hltEGammaSeedLabel_,EGamma); | ||
if (nobj >= minN_) return true; | ||
} | ||
if (flag_[EtSum]) { | ||
nobj += objects(iEvent,hltEtSumToken_,hltEtSumSeedLabel_,EtSum); | ||
if (nobj >= minN_) return true; | ||
} | ||
if (flag_[Jet]) { | ||
nobj += objects(iEvent,hltJetToken_,hltJetSeedLabel_,Jet); | ||
if (nobj >= minN_) return true; | ||
} | ||
if (flag_[Muon]) { | ||
nobj += objects(iEvent,hltMuonToken_,hltMuonSeedLabel_,Muon); | ||
if (nobj >= minN_) return true; | ||
} | ||
if (flag_[Tau]) { | ||
nobj += objects(iEvent,hltTauToken_,hltTauSeedLabel_,Tau); | ||
if (nobj >= minN_) return true; | ||
} | ||
return false; | ||
} | ||
|
||
template<typename T1> | ||
int HLTMultipletFilter::objects(edm::Event& iEvent, | ||
edm::EDGetTokenT<T1> const& hltToken, | ||
edm::InputTag const& hltSeedLabel, | ||
HLTMultipletFilter::Types type) const { | ||
int nobj(0); | ||
edm::Handle<T1> objs; | ||
iEvent.getByToken(hltToken, objs); | ||
if (!objs.isValid()) { | ||
edm::LogWarning("Report") << "Collection with input tag " << hltSeedLabel | ||
<< " requested, but not found in the event."; | ||
} else { | ||
edm::LogVerbatim("Report") << "Collection for type " << type | ||
<< " has " << objs->size() << " in " | ||
<< ibxMin_ << ":" << ibxMax_ << " BX's"; | ||
for (int ibx=ibxMin_; ibx<=ibxMax_; ++ibx) { | ||
for (auto p = objs->begin(ibx); p != objs->end(ibx); ++p) { | ||
if (p->pt() > minPt_) { | ||
if (p->eta() > minEta_ && p->eta() < maxEta_) { | ||
double phi = p->phi(); | ||
if (phi < 0) phi += 2*M_PI; | ||
if (phi > minPhi_ && phi < maxPhi_) ++nobj; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return nobj; | ||
} |
Oops, something went wrong.