CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
HLTHcalMETNoiseCleaner Class Reference

#include <HLTHcalMETNoiseCleaner.h>

Inheritance diagram for HLTHcalMETNoiseCleaner:
edm::global::EDFilter<> edm::global::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  noisedatacomp
 

Public Member Functions

bool filter (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 HLTHcalMETNoiseCleaner (const edm::ParameterSet &)
 
 ~HLTHcalMETNoiseCleaner () override
 
- Public Member Functions inherited from edm::global::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDFilteroperator= (const EDFilter &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilterBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

typedef std::set< CommonHcalNoiseRBXData, noisedatacompnoisedataset_t
 

Private Member Functions

reco::CaloMET BuildCaloMet (float sumet, float pt, float phi) const
 

Private Attributes

const bool accept2NoiseRBXEvents_
 
const edm::InputTag CaloMetCollectionTag_
 
const double CaloMetCut_
 
const edm::InputTag HcalNoiseRBXCollectionTag_
 
edm::EDGetTokenT< reco::CaloMETCollectionm_theCaloMetToken
 
edm::EDGetTokenT< reco::HcalNoiseRBXCollectionm_theHcalNoiseToken
 
const double maxHighEHitTime_
 
const int maxNumRBXs_
 
const double maxRatio_
 
const double maxRBXEMF_
 
const double minHighEHitTime_
 
const double minHighHitE_
 
const int minHPDHits_
 
const int minHPDNoOtherHits_
 
const double minLowHitE_
 
const double minR45HitE_
 
const double minRatio_
 
const double minRBXEnergy_
 
const int minRBXHits_
 
const double minRecHitE_
 
const int minZeros_
 
const bool needEMFCoincidence_
 
const int numRBXsToConsider_
 
const int severity_
 
const double TS4TS5EnergyThreshold_
 
std::vector< std::pair< double, double > > TS4TS5LowerCut_
 
std::vector< std::pair< double, double > > TS4TS5UpperCut_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDFilterBase
typedef EDFilterBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: HLT filter module for cleaning HCal Noise from MET or MHT

Implementation: <Notes on="" implementation>="">

Definition at line 20 of file HLTHcalMETNoiseCleaner.h.

Member Typedef Documentation

◆ noisedataset_t

Definition at line 68 of file HLTHcalMETNoiseCleaner.h.

Constructor & Destructor Documentation

◆ HLTHcalMETNoiseCleaner()

HLTHcalMETNoiseCleaner::HLTHcalMETNoiseCleaner ( const edm::ParameterSet iConfig)
explicit

Definition at line 47 of file HLTHcalMETNoiseCleaner.cc.

References CaloMetCollectionTag_, edm::ParameterSet::getParameter(), HcalNoiseRBXCollectionTag_, mps_fire::i, createfilelist::int, m_theCaloMetToken, m_theHcalNoiseToken, jetUpdater_cfi::sort, TS4TS5LowerCut_, and TS4TS5UpperCut_.

48  : HcalNoiseRBXCollectionTag_(iConfig.getParameter<edm::InputTag>("HcalNoiseRBXCollection")),
49  CaloMetCollectionTag_(iConfig.getParameter<edm::InputTag>("CaloMetCollection")),
50  CaloMetCut_(iConfig.getParameter<double>("CaloMetCut")),
51  severity_(iConfig.getParameter<int>("severity")),
52  maxNumRBXs_(iConfig.getParameter<int>("maxNumRBXs")),
53  numRBXsToConsider_(iConfig.getParameter<int>("numRBXsToConsider")),
54  accept2NoiseRBXEvents_(iConfig.getParameter<bool>("accept2NoiseRBXEvents")),
55  needEMFCoincidence_(iConfig.getParameter<bool>("needEMFCoincidence")),
56  minRBXEnergy_(iConfig.getParameter<double>("minRBXEnergy")),
57  minRatio_(iConfig.getParameter<double>("minRatio")),
58  maxRatio_(iConfig.getParameter<double>("maxRatio")),
59  minHPDHits_(iConfig.getParameter<int>("minHPDHits")),
60  minRBXHits_(iConfig.getParameter<int>("minRBXHits")),
61  minHPDNoOtherHits_(iConfig.getParameter<int>("minHPDNoOtherHits")),
62  minZeros_(iConfig.getParameter<int>("minZeros")),
63  minHighEHitTime_(iConfig.getParameter<double>("minHighEHitTime")),
64  maxHighEHitTime_(iConfig.getParameter<double>("maxHighEHitTime")),
65  maxRBXEMF_(iConfig.getParameter<double>("maxRBXEMF")),
66  minRecHitE_(iConfig.getParameter<double>("minRecHitE")),
67  minLowHitE_(iConfig.getParameter<double>("minLowHitE")),
68  minHighHitE_(iConfig.getParameter<double>("minHighHitE")),
69  minR45HitE_(iConfig.getParameter<double>("minR45HitE")),
70  TS4TS5EnergyThreshold_(iConfig.getParameter<double>("TS4TS5EnergyThreshold")) {
71  std::vector<double> TS4TS5UpperThresholdTemp = iConfig.getParameter<std::vector<double> >("TS4TS5UpperThreshold");
72  std::vector<double> TS4TS5UpperCutTemp = iConfig.getParameter<std::vector<double> >("TS4TS5UpperCut");
73  std::vector<double> TS4TS5LowerThresholdTemp = iConfig.getParameter<std::vector<double> >("TS4TS5LowerThreshold");
74  std::vector<double> TS4TS5LowerCutTemp = iConfig.getParameter<std::vector<double> >("TS4TS5LowerCut");
75 
76  for (int i = 0; i < (int)TS4TS5UpperThresholdTemp.size() && i < (int)TS4TS5UpperCutTemp.size(); i++)
77  TS4TS5UpperCut_.push_back(std::pair<double, double>(TS4TS5UpperThresholdTemp[i], TS4TS5UpperCutTemp[i]));
78  sort(TS4TS5UpperCut_.begin(), TS4TS5UpperCut_.end());
79 
80  for (int i = 0; i < (int)TS4TS5LowerThresholdTemp.size() && i < (int)TS4TS5LowerCutTemp.size(); i++)
81  TS4TS5LowerCut_.push_back(std::pair<double, double>(TS4TS5LowerThresholdTemp[i], TS4TS5LowerCutTemp[i]));
82  sort(TS4TS5LowerCut_.begin(), TS4TS5LowerCut_.end());
83 
84  m_theCaloMetToken = consumes<reco::CaloMETCollection>(CaloMetCollectionTag_);
85  m_theHcalNoiseToken = consumes<reco::HcalNoiseRBXCollection>(HcalNoiseRBXCollectionTag_);
86 
87  produces<reco::CaloMETCollection>();
88 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::InputTag HcalNoiseRBXCollectionTag_
std::vector< std::pair< double, double > > TS4TS5UpperCut_
edm::EDGetTokenT< reco::CaloMETCollection > m_theCaloMetToken
edm::EDGetTokenT< reco::HcalNoiseRBXCollection > m_theHcalNoiseToken
const edm::InputTag CaloMetCollectionTag_
std::vector< std::pair< double, double > > TS4TS5LowerCut_

◆ ~HLTHcalMETNoiseCleaner()

HLTHcalMETNoiseCleaner::~HLTHcalMETNoiseCleaner ( )
overridedefault

Member Function Documentation

◆ BuildCaloMet()

reco::CaloMET HLTHcalMETNoiseCleaner::BuildCaloMet ( float  sumet,
float  pt,
float  phi 
) const
private

Definition at line 339 of file HLTHcalMETNoiseCleaner.cc.

References phi, DiDispStaMuonMonitor_cfi::pt, timingPdfMaker::specific, and extraflags_cff::vtx.

Referenced by filter().

339  {
340  // Instantiate the container to hold the calorimeter specific information
341 
342  typedef math::XYZPoint Point;
344 
346  // Initialise the container
347  specific.MaxEtInEmTowers = 0.0; // Maximum energy in EM towers
348  specific.MaxEtInHadTowers = 0.0; // Maximum energy in HCAL towers
349  specific.HadEtInHO = 0.0; // Hadronic energy fraction in HO
350  specific.HadEtInHB = 0.0; // Hadronic energy in HB
351  specific.HadEtInHF = 0.0; // Hadronic energy in HF
352  specific.HadEtInHE = 0.0; // Hadronic energy in HE
353  specific.EmEtInEB = 0.0; // Em energy in EB
354  specific.EmEtInEE = 0.0; // Em energy in EE
355  specific.EmEtInHF = 0.0; // Em energy in HF
356  specific.EtFractionHadronic = 0.0; // Hadronic energy fraction
357  specific.EtFractionEm = 0.0; // Em energy fraction
358  specific.CaloSETInpHF = 0.0; // CaloSET in HF+
359  specific.CaloSETInmHF = 0.0; // CaloSET in HF-
360  specific.CaloMETInpHF = 0.0; // CaloMET in HF+
361  specific.CaloMETInmHF = 0.0; // CaloMET in HF-
362  specific.CaloMETPhiInpHF = 0.0; // CaloMET-phi in HF+
363  specific.CaloMETPhiInmHF = 0.0; // CaloMET-phi in HF-
364  specific.METSignificance = 0.0;
365 
366  TLorentzVector p4TL;
367  p4TL.SetPtEtaPhiM(pt, 0., phi, 0.);
368  const LorentzVector p4(p4TL.X(), p4TL.Y(), 0, p4TL.T());
369  const Point vtx(0.0, 0.0, 0.0);
370  reco::CaloMET specificmet(specific, sumet, p4, vtx);
371  return specificmet;
372 }
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
math::XYZPoint Point
math::XYZTLorentzVector LorentzVector
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
Structure Point Contains parameters of Gaussian fits to DMRs.
math::PtEtaPhiELorentzVectorF LorentzVector

◆ fillDescriptions()

void HLTHcalMETNoiseCleaner::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 92 of file HLTHcalMETNoiseCleaner.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, HLT_2023v12_cff::TS4TS5LowerCut, HLT_2023v12_cff::TS4TS5LowerThreshold, HLT_2023v12_cff::TS4TS5UpperCut, and HLT_2023v12_cff::TS4TS5UpperThreshold.

92  {
94  desc.add<edm::InputTag>("HcalNoiseRBXCollection", edm::InputTag("hltHcalNoiseInfoProducer"));
95  desc.add<edm::InputTag>("CaloMetCollection", edm::InputTag("hltMet"));
96  desc.add<double>("CaloMetCut", 0.0);
97  desc.add<int>("severity", 1);
98  desc.add<int>("maxNumRBXs", 2);
99  desc.add<int>("numRBXsToConsider", 2);
100  desc.add<bool>("accept2NoiseRBXEvents", true);
101  desc.add<bool>("needEMFCoincidence", true);
102  desc.add<double>("minRBXEnergy", 50.0);
103  desc.add<double>("minRatio", -999.);
104  desc.add<double>("maxRatio", 999.);
105  desc.add<int>("minHPDHits", 17);
106  desc.add<int>("minRBXHits", 999);
107  desc.add<int>("minHPDNoOtherHits", 10);
108  desc.add<int>("minZeros", 10);
109  desc.add<double>("minHighEHitTime", -9999.0);
110  desc.add<double>("maxHighEHitTime", 9999.0);
111  desc.add<double>("maxRBXEMF", 0.02);
112  desc.add<double>("minRecHitE", 1.5);
113  desc.add<double>("minLowHitE", 10.0);
114  desc.add<double>("minHighHitE", 25.0);
115  desc.add<double>("minR45HitE", 5.0);
116  desc.add<double>("TS4TS5EnergyThreshold", 50.0);
117 
118  double TS4TS5UpperThresholdArray[5] = {70, 90, 100, 400, 4000};
119  double TS4TS5UpperCutArray[5] = {1, 0.8, 0.75, 0.72, 0.72};
120  double TS4TS5LowerThresholdArray[7] = {100, 120, 150, 200, 300, 400, 500};
121  double TS4TS5LowerCutArray[7] = {-1, -0.7, -0.4, -0.2, -0.08, 0, 0.1};
122  std::vector<double> TS4TS5UpperThreshold(TS4TS5UpperThresholdArray, TS4TS5UpperThresholdArray + 5);
123  std::vector<double> TS4TS5UpperCut(TS4TS5UpperCutArray, TS4TS5UpperCutArray + 5);
124  std::vector<double> TS4TS5LowerThreshold(TS4TS5LowerThresholdArray, TS4TS5LowerThresholdArray + 7);
125  std::vector<double> TS4TS5LowerCut(TS4TS5LowerCutArray, TS4TS5LowerCutArray + 7);
126 
127  desc.add<std::vector<double> >("TS4TS5UpperThreshold", TS4TS5UpperThreshold);
128  desc.add<std::vector<double> >("TS4TS5UpperCut", TS4TS5UpperCut);
129  desc.add<std::vector<double> >("TS4TS5LowerThreshold", TS4TS5LowerThreshold);
130  desc.add<std::vector<double> >("TS4TS5LowerCut", TS4TS5LowerCut);
131  descriptions.add("hltHcalMETNoiseCleaner", desc);
132 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ filter()

bool HLTHcalMETNoiseCleaner::filter ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDFilterBase.

Definition at line 138 of file HLTHcalMETNoiseCleaner.cc.

References accept2NoiseRBXEvents_, edm::RefVector< C, T, F >::begin(), BuildCaloMet(), CaloMetCut_, ztail::d, data, edm::RefVector< C, T, F >::end(), HcalNoiseRBXCollectionTag_, iEvent, edm::HandleBase::isValid(), LogDebug, m_theCaloMetToken, m_theHcalNoiseToken, maxHighEHitTime_, maxRatio_, maxRBXEMF_, minHighEHitTime_, minHighHitE_, minHPDHits_, minHPDNoOtherHits_, minLowHitE_, minR45HitE_, minRatio_, minRBXEnergy_, minRBXHits_, minRecHitE_, minZeros_, eostools::move(), needEMFCoincidence_, numRBXsToConsider_, or, reco::LeafCandidate::pt(), severity_, TS4TS5EnergyThreshold_, TS4TS5LowerCut_, and TS4TS5UpperCut_.

138  {
139  using namespace reco;
140 
141  //output collection
142  std::unique_ptr<CaloMETCollection> CleanedMET(new CaloMETCollection);
143 
144  //get the calo MET / MHT
146  iEvent.getByToken(m_theCaloMetToken, met_h);
147 
148  if (not met_h.isValid() or met_h->empty() or
149  met_h->front().pt() < 0) { //No Valid MET, don't do anything and accept the event
150  return true; // we shouldn't get here, but lets not crash
151  }
152 
153  reco::CaloMET inCaloMet = met_h->front();
154 
155  // in this case, do not filter anything
156  if (severity_ == 0) {
157  CleanedMET->push_back(inCaloMet);
158  iEvent.put(std::move(CleanedMET));
159  return true;
160  }
161 
162  // get the RBXs produced by RecoMET/METProducers/HcalNoiseInfoProducer
164  iEvent.getByToken(m_theHcalNoiseToken, rbxs_h);
165  if (!rbxs_h.isValid()) {
166  edm::LogError("DataNotFound") << "HLTHcalMETNoiseCleaner: Could not find HcalNoiseRBXCollection product named "
167  << HcalNoiseRBXCollectionTag_ << "." << std::endl;
168  CleanedMET->push_back(inCaloMet);
169  iEvent.put(std::move(CleanedMET));
170  return true; // no valid RBXs
171  }
172 
173  // create a sorted set of the RBXs, ordered by energy
175  for (auto const& rbx : *rbxs_h) {
177  minRecHitE_,
178  minLowHitE_,
179  minHighHitE_,
183  minR45HitE_);
184  data.insert(d);
185  }
186  //if 0 RBXs are in the list, just accept
187  if (data.empty()) {
188  CleanedMET->push_back(inCaloMet);
189  iEvent.put(std::move(CleanedMET));
190  return true;
191  }
192  // data is now sorted by RBX energy
193  // only consider top N=numRBXsToConsider_ energy RBXs
194  int cntr = 0;
195  int nNoise = 0;
196 
197  TVector3 metVec;
198  metVec.SetPtEtaPhi(met_h->front().pt(), 0, met_h->front().phi());
199 
200  TVector3 noiseHPDVector(0, 0, 0);
201  TVector3 secondHPDVector(0, 0, 0);
202  for (auto it = data.begin(); it != data.end() && cntr < numRBXsToConsider_; it++, cntr++) {
203  bool isNoise = false;
204  bool passFilter = true;
205  bool passEMF = true;
206  if (it->energy() > minRBXEnergy_) {
207  if (it->validRatio() && it->ratio() < minRatio_)
208  passFilter = false;
209  else if (it->validRatio() && it->ratio() > maxRatio_)
210  passFilter = false;
211  else if (it->numHPDHits() >= minHPDHits_)
212  passFilter = false;
213  else if (it->numRBXHits() >= minRBXHits_)
214  passFilter = false;
215  else if (it->numHPDNoOtherHits() >= minHPDNoOtherHits_)
216  passFilter = false;
217  else if (it->numZeros() >= minZeros_)
218  passFilter = false;
219  else if (it->minHighEHitTime() < minHighEHitTime_)
220  passFilter = false;
221  else if (it->maxHighEHitTime() > maxHighEHitTime_)
222  passFilter = false;
223  else if (!it->PassTS4TS5())
224  passFilter = false;
225 
226  if (it->RBXEMF() < maxRBXEMF_) {
227  passEMF = false;
228  }
229  }
230 
231  if ((needEMFCoincidence_ && !passEMF && !passFilter) || (!needEMFCoincidence_ && !passFilter)) { // check for noise
232  LogDebug("") << "HLTHcalMETNoiseCleaner debug: Found a noisy RBX: "
233  << "energy=" << it->energy() << "; "
234  << "ratio=" << it->ratio() << "; "
235  << "# RBX hits=" << it->numRBXHits() << "; "
236  << "# HPD hits=" << it->numHPDHits() << "; "
237  << "# Zeros=" << it->numZeros() << "; "
238  << "min time=" << it->minHighEHitTime() << "; "
239  << "max time=" << it->maxHighEHitTime() << "; "
240  << "passTS4TS5=" << it->PassTS4TS5() << "; "
241  << "RBX EMF=" << it->RBXEMF() << std::endl;
242  nNoise++;
243  isNoise = true;
244  } // OK, checked for noise
245 
246  //------------First Noisy RBX-----------------------
247  if (isNoise && nNoise == 1) {
248  edm::RefVector<CaloTowerCollection> noiseTowers = it->rbxTowers();
250  // get the energy vector for this RBX from the calotowers
251  for (noiseTowersIt = noiseTowers.begin(); noiseTowersIt != noiseTowers.end(); noiseTowersIt++) {
252  TVector3 towerVec;
253  towerVec.SetPtEtaPhi((*noiseTowersIt)->pt(), (*noiseTowersIt)->eta(), (*noiseTowersIt)->phi());
254  noiseHPDVector += towerVec; // add this tower to the vector for the RBX
255  }
256  if (noiseHPDVector.Mag() > 0)
257  noiseHPDVector.SetPtEtaPhi(noiseHPDVector.Pt(), 0, noiseHPDVector.Phi()); // make the noise transverse
258  else
259  noiseHPDVector.SetPtEtaPhi(0, 0, 0);
260  }
261  //-----------FOUND a SECOND NOISY RBX-------------------
262  if (isNoise && cntr > 0) {
263  CleanedMET->push_back(inCaloMet);
264  iEvent.put(std::move(CleanedMET));
265  return accept2NoiseRBXEvents_; // don't try to clean these for the moment, just keep or throw away
266  }
267  //----------LEADING RBX is NOT NOISY--------------------
268  if (!isNoise && cntr == 0) {
269  CleanedMET->push_back(inCaloMet);
270  iEvent.put(std::move(CleanedMET));
271  return true; // don't reject the event if the leading RBX isn't noise
272  }
273  //-----------SUBLEADING RBX is NOT NOISY: STORE INFO----
274  if (!isNoise && nNoise > 0) { //second RBX isn't noisy (and first one was), so clean
275  edm::RefVector<CaloTowerCollection> noiseTowers = it->rbxTowers();
277  for (noiseTowersIt = noiseTowers.begin(); noiseTowersIt != noiseTowers.end(); noiseTowersIt++) {
278  TVector3 towerVec;
279  towerVec.SetPtEtaPhi((*noiseTowersIt)->pt(), (*noiseTowersIt)->eta(), (*noiseTowersIt)->phi());
280  secondHPDVector += towerVec; // add this tower to the vector for the RBX
281  }
282  if (secondHPDVector.Mag() > 0)
283  secondHPDVector.SetPtEtaPhi(secondHPDVector.Pt(), 0, secondHPDVector.Phi()); // make the second transverse
284  else
285  secondHPDVector.SetPtEtaPhi(0, 0, 0);
286  break;
287  }
288  } // end RBX loop
289 
290  if (noiseHPDVector.Mag() == 0) {
291  CleanedMET->push_back(inCaloMet);
292  iEvent.put(std::move(CleanedMET));
293  return true; // don't reject the event if the leading RBX isn't noise
294  }
295 
296  //********************************************************************************
297  //The Event gets here only if it had exactly 1 noisy RBX in the lead position
298  //********************************************************************************
299 
300  float METsumet = met_h->front().energy();
301 
302  metVec += noiseHPDVector;
303 
304  float ZMETsumet = METsumet - noiseHPDVector.Mag();
305  float ZMETpt = metVec.Pt();
306  float ZMETphi = metVec.Phi();
307 
308  //put the second RBX vector in the eta phi position of the leading RBX vector
309 
310  float SMETsumet = 0;
311  float SMETpt = 0;
312  float SMETphi = 0;
313  if (secondHPDVector.Mag() > 0.) {
314  secondHPDVector.SetPtEtaPhi(secondHPDVector.Pt(), noiseHPDVector.Eta(), noiseHPDVector.Phi());
315  metVec -= secondHPDVector;
316  SMETsumet = METsumet - noiseHPDVector.Mag();
317  SMETpt = metVec.Pt();
318  SMETphi = metVec.Phi();
319  }
320  //Get the maximum MET:
321  float CorMetSumEt, CorMetPt, CorMetPhi;
322  if (ZMETpt > SMETpt) {
323  CorMetSumEt = ZMETsumet;
324  CorMetPt = ZMETpt;
325  CorMetPhi = ZMETphi;
326  } else {
327  CorMetSumEt = SMETsumet;
328  CorMetPt = SMETpt;
329  CorMetPhi = SMETphi;
330  }
331 
332  reco::CaloMET corMet = BuildCaloMet(CorMetSumEt, CorMetPt, CorMetPhi);
333  CleanedMET->push_back(corMet);
334  iEvent.put(std::move(CleanedMET));
335 
336  return (corMet.pt() > CaloMetCut_);
337 }
const edm::InputTag HcalNoiseRBXCollectionTag_
double pt() const final
transverse momentum
std::vector< std::pair< double, double > > TS4TS5UpperCut_
edm::EDGetTokenT< reco::CaloMETCollection > m_theCaloMetToken
std::set< CommonHcalNoiseRBXData, noisedatacomp > noisedataset_t
Log< level::Error, false > LogError
Collection of Calo MET.
int iEvent
Definition: GenABIO.cc:224
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
reco::CaloMET BuildCaloMet(float sumet, float pt, float phi) const
d
Definition: ztail.py:151
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
edm::EDGetTokenT< reco::HcalNoiseRBXCollection > m_theHcalNoiseToken
bool isValid() const
Definition: HandleBase.h:70
fixed size matrix
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
def move(src, dest)
Definition: eostools.py:511
std::vector< std::pair< double, double > > TS4TS5LowerCut_
#define LogDebug(id)

Member Data Documentation

◆ accept2NoiseRBXEvents_

const bool HLTHcalMETNoiseCleaner::accept2NoiseRBXEvents_
private

Definition at line 37 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ CaloMetCollectionTag_

const edm::InputTag HLTHcalMETNoiseCleaner::CaloMetCollectionTag_
private

Definition at line 32 of file HLTHcalMETNoiseCleaner.h.

Referenced by HLTHcalMETNoiseCleaner().

◆ CaloMetCut_

const double HLTHcalMETNoiseCleaner::CaloMetCut_
private

Definition at line 33 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ HcalNoiseRBXCollectionTag_

const edm::InputTag HLTHcalMETNoiseCleaner::HcalNoiseRBXCollectionTag_
private

Definition at line 31 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter(), and HLTHcalMETNoiseCleaner().

◆ m_theCaloMetToken

edm::EDGetTokenT<reco::CaloMETCollection> HLTHcalMETNoiseCleaner::m_theCaloMetToken
private

Definition at line 28 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter(), and HLTHcalMETNoiseCleaner().

◆ m_theHcalNoiseToken

edm::EDGetTokenT<reco::HcalNoiseRBXCollection> HLTHcalMETNoiseCleaner::m_theHcalNoiseToken
private

Definition at line 29 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter(), and HLTHcalMETNoiseCleaner().

◆ maxHighEHitTime_

const double HLTHcalMETNoiseCleaner::maxHighEHitTime_
private

Definition at line 47 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ maxNumRBXs_

const int HLTHcalMETNoiseCleaner::maxNumRBXs_
private

Definition at line 35 of file HLTHcalMETNoiseCleaner.h.

◆ maxRatio_

const double HLTHcalMETNoiseCleaner::maxRatio_
private

Definition at line 41 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ maxRBXEMF_

const double HLTHcalMETNoiseCleaner::maxRBXEMF_
private

Definition at line 48 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minHighEHitTime_

const double HLTHcalMETNoiseCleaner::minHighEHitTime_
private

Definition at line 46 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minHighHitE_

const double HLTHcalMETNoiseCleaner::minHighHitE_
private

Definition at line 53 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minHPDHits_

const int HLTHcalMETNoiseCleaner::minHPDHits_
private

Definition at line 42 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minHPDNoOtherHits_

const int HLTHcalMETNoiseCleaner::minHPDNoOtherHits_
private

Definition at line 44 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minLowHitE_

const double HLTHcalMETNoiseCleaner::minLowHitE_
private

Definition at line 52 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minR45HitE_

const double HLTHcalMETNoiseCleaner::minR45HitE_
private

Definition at line 54 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minRatio_

const double HLTHcalMETNoiseCleaner::minRatio_
private

Definition at line 40 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minRBXEnergy_

const double HLTHcalMETNoiseCleaner::minRBXEnergy_
private

Definition at line 39 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minRBXHits_

const int HLTHcalMETNoiseCleaner::minRBXHits_
private

Definition at line 43 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minRecHitE_

const double HLTHcalMETNoiseCleaner::minRecHitE_
private

Definition at line 51 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ minZeros_

const int HLTHcalMETNoiseCleaner::minZeros_
private

Definition at line 45 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ needEMFCoincidence_

const bool HLTHcalMETNoiseCleaner::needEMFCoincidence_
private

Definition at line 38 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ numRBXsToConsider_

const int HLTHcalMETNoiseCleaner::numRBXsToConsider_
private

Definition at line 36 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ severity_

const int HLTHcalMETNoiseCleaner::severity_
private

Definition at line 34 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ TS4TS5EnergyThreshold_

const double HLTHcalMETNoiseCleaner::TS4TS5EnergyThreshold_
private

Definition at line 56 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter().

◆ TS4TS5LowerCut_

std::vector<std::pair<double, double> > HLTHcalMETNoiseCleaner::TS4TS5LowerCut_
private

Definition at line 58 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter(), and HLTHcalMETNoiseCleaner().

◆ TS4TS5UpperCut_

std::vector<std::pair<double, double> > HLTHcalMETNoiseCleaner::TS4TS5UpperCut_
private

Definition at line 57 of file HLTHcalMETNoiseCleaner.h.

Referenced by filter(), and HLTHcalMETNoiseCleaner().