CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes
HLTHcalTowerNoiseCleaner Class Reference

#include <HLTHcalTowerNoiseCleaner.h>

Inheritance diagram for HLTHcalTowerNoiseCleaner:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  noisedatacomp
 

Public Member Functions

 HLTHcalTowerNoiseCleaner (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~HLTHcalTowerNoiseCleaner ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

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

Private Types

typedef std::set
< CommonHcalNoiseRBXData,
noisedatacomp
noisedataset_t
 

Private Attributes

edm::InputTag HcalNoiseRBXCollectionTag_
 
edm::EDGetTokenT
< CaloTowerCollection
m_theCaloTowerCollectionToken
 
edm::EDGetTokenT
< reco::HcalNoiseRBXCollection
m_theHcalNoiseToken
 
double maxHighEHitTime_
 
int maxNumRBXs_
 
double maxRatio_
 
double maxRBXEMF_
 
double minHighEHitTime_
 
double minHighHitE_
 
int minHPDHits_
 
int minHPDNoOtherHits_
 
double minLowHitE_
 
double minRatio_
 
double minRBXEnergy_
 
int minRBXHits_
 
double minRecHitE_
 
int minZeros_
 
bool needEMFCoincidence_
 
int numRBXsToConsider_
 
int severity_
 
edm::InputTag TowerCollectionTag_
 
double TS4TS5EnergyThreshold_
 
std::vector< std::pair< double,
double > > 
TS4TS5LowerCut_
 
std::vector< std::pair< double,
double > > 
TS4TS5UpperCut_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

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

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

Definition at line 23 of file HLTHcalTowerNoiseCleaner.h.

Member Typedef Documentation

Definition at line 65 of file HLTHcalTowerNoiseCleaner.h.

Constructor & Destructor Documentation

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

Definition at line 50 of file HLTHcalTowerNoiseCleaner.cc.

References edm::ParameterSet::getParameter(), HcalNoiseRBXCollectionTag_, i, m_theCaloTowerCollectionToken, m_theHcalNoiseToken, python.multivaluedict::sort(), TowerCollectionTag_, TS4TS5LowerCut_, and TS4TS5UpperCut_.

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

Definition at line 93 of file HLTHcalTowerNoiseCleaner.cc.

93 {}

Member Function Documentation

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

Definition at line 96 of file HLTHcalTowerNoiseCleaner.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

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

Implements edm::EDProducer.

Definition at line 140 of file HLTHcalTowerNoiseCleaner.cc.

References edm::RefVector< C, T, F >::begin(), data, edm::RefVector< C, T, F >::end(), edm::Event::getByToken(), HcalNoiseRBXCollectionTag_, CaloTower::id(), edm::Ref< C, T, F >::id(), LogDebug, m_theCaloTowerCollectionToken, m_theHcalNoiseToken, maxHighEHitTime_, maxRatio_, maxRBXEMF_, minHighEHitTime_, minHighHitE_, minHPDHits_, minHPDNoOtherHits_, minLowHitE_, minRatio_, minRBXEnergy_, minRBXHits_, minRecHitE_, minZeros_, needEMFCoincidence_, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, severity_, TS4TS5EnergyThreshold_, TS4TS5LowerCut_, and TS4TS5UpperCut_.

141 {
142  using namespace reco;
143 
144  //get the calo MET / MHT
147 
148  std::set<unsigned int> noisyTowers;
149 
150  if(not tower_h.isValid()){ //No towers MET, don't do anything and accept the event
151  edm::LogError("HLTHcalTowerNoiseCleaner") << "Input Tower Collection is not Valid";
152  return;
153  }
154 
155 
156  // get the RBXs produced by RecoMET/METProducers/HcalNoiseInfoProducer
158  iEvent.getByToken(m_theHcalNoiseToken,rbxs_h);
159  if(!rbxs_h.isValid()) {
160  edm::LogWarning("HLTHcalTowerNoiseCleaner") << "Could not find HcalNoiseRBXCollection product named "
161  << HcalNoiseRBXCollectionTag_ << "." << std::endl;
162  severity_=0;
163  }
164 
165  // create a sorted set of the RBXs, ordered by energy
167  for(HcalNoiseRBXCollection::const_iterator it=rbxs_h->begin(); it!=rbxs_h->end(); ++it) {
168  const HcalNoiseRBX &rbx=(*it);
171  data.insert(d);
172  }
173 
174  // data is now sorted by RBX energy
175  // only consider top N=numRBXsToConsider_ energy RBXs
176  if(severity_>0){
177  for(noisedataset_t::const_iterator it=data.begin();
178  it!=data.end();
179  it++) {
180 
181 
182  bool passFilter=true;
183  bool passEMF=true;
184  if(it->energy()>minRBXEnergy_) {
185  if(it->validRatio() && it->ratio()<minRatio_) passFilter=false;
186  else if(it->validRatio() && it->ratio()>maxRatio_) passFilter=false;
187  else if(it->numHPDHits()>=minHPDHits_) passFilter=false;
188  else if(it->numRBXHits()>=minRBXHits_) passFilter=false;
189  else if(it->numHPDNoOtherHits()>=minHPDNoOtherHits_) passFilter=false;
190  else if(it->numZeros()>=minZeros_) passFilter=false;
191  else if(it->minHighEHitTime()<minHighEHitTime_) passFilter=false;
192  else if(it->maxHighEHitTime()>maxHighEHitTime_) passFilter=false;
193  else if(!it->PassTS4TS5()) passFilter=false;
194 
195  if(it->RBXEMF()<maxRBXEMF_){
196  passEMF=false;
197  }
198  }
199 
200  if((needEMFCoincidence_ && !passEMF && !passFilter) ||
201  (!needEMFCoincidence_ && !passFilter)) { // check for noise
202  LogDebug("") << "HLTHcalTowerNoiseCleaner debug: Found a noisy RBX: "
203  << "energy=" << it->energy() << "; "
204  << "ratio=" << it->ratio() << "; "
205  << "# RBX hits=" << it->numRBXHits() << "; "
206  << "# HPD hits=" << it->numHPDHits() << "; "
207  << "# Zeros=" << it->numZeros() << "; "
208  << "min time=" << it->minHighEHitTime() << "; "
209  << "max time=" << it->maxHighEHitTime() << "; "
210  << "passTS4TS5=" << it->PassTS4TS5() << "; "
211  << "RBX EMF=" << it->RBXEMF()
212  << std::endl;
213  // add calotowers associated with this RBX to the noise list
214  edm::RefVector<CaloTowerCollection> noiseTowers = it->rbxTowers();
216  //add these calotowers to the noisy list
217  for( noiseTowersIt = noiseTowers.begin(); noiseTowersIt != noiseTowers.end(); noiseTowersIt++){
218  edm::Ref<edm::SortedCollection<CaloTower> > tower_ref = *noiseTowersIt;
219  CaloTowerDetId id = tower_ref->id();
220  noisyTowers.insert( id.denseIndex() );
221  }}
222  } // done with noise loop
223  }//if(severity_>0)
224 
225  //output collection
226  std::auto_ptr<CaloTowerCollection> OutputTowers(new CaloTowerCollection() );
227 
229 
230  for(inTowersIt = tower_h->begin(); inTowersIt != tower_h->end(); inTowersIt++){
231  const CaloTower & tower = (*inTowersIt);
232  CaloTowerDetId id = tower.id();
233  if(noisyTowers.find( id.denseIndex() ) == noisyTowers.end()){ // the tower is not noisy
234  OutputTowers->push_back(*inTowersIt);
235  }
236  }
237  iEvent.put(OutputTowers);
238 
239 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::set< CommonHcalNoiseRBXData, noisedatacomp > noisedataset_t
std::vector< CaloTower >::const_iterator const_iterator
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
std::vector< std::pair< double, double > > TS4TS5UpperCut_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< CaloTowerCollection > m_theCaloTowerCollectionToken
CaloTowerDetId id() const
Definition: CaloTower.h:87
edm::EDGetTokenT< reco::HcalNoiseRBXCollection > m_theHcalNoiseToken
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
edm::SortedCollection< CaloTower > CaloTowerCollection
Definition: CaloTowerFwd.h:15
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
std::vector< std::pair< double, double > > TS4TS5LowerCut_

Member Data Documentation

edm::InputTag HLTHcalTowerNoiseCleaner::HcalNoiseRBXCollectionTag_
private

Definition at line 35 of file HLTHcalTowerNoiseCleaner.h.

Referenced by HLTHcalTowerNoiseCleaner(), and produce().

edm::EDGetTokenT<CaloTowerCollection> HLTHcalTowerNoiseCleaner::m_theCaloTowerCollectionToken
private

Definition at line 33 of file HLTHcalTowerNoiseCleaner.h.

Referenced by HLTHcalTowerNoiseCleaner(), and produce().

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

Definition at line 32 of file HLTHcalTowerNoiseCleaner.h.

Referenced by HLTHcalTowerNoiseCleaner(), and produce().

double HLTHcalTowerNoiseCleaner::maxHighEHitTime_
private

Definition at line 49 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

int HLTHcalTowerNoiseCleaner::maxNumRBXs_
private

Definition at line 38 of file HLTHcalTowerNoiseCleaner.h.

double HLTHcalTowerNoiseCleaner::maxRatio_
private

Definition at line 43 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

double HLTHcalTowerNoiseCleaner::maxRBXEMF_
private

Definition at line 50 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

double HLTHcalTowerNoiseCleaner::minHighEHitTime_
private

Definition at line 48 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

double HLTHcalTowerNoiseCleaner::minHighHitE_
private

Definition at line 53 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

int HLTHcalTowerNoiseCleaner::minHPDHits_
private

Definition at line 44 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

int HLTHcalTowerNoiseCleaner::minHPDNoOtherHits_
private

Definition at line 46 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

double HLTHcalTowerNoiseCleaner::minLowHitE_
private

Definition at line 53 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

double HLTHcalTowerNoiseCleaner::minRatio_
private

Definition at line 42 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

double HLTHcalTowerNoiseCleaner::minRBXEnergy_
private

Definition at line 41 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

int HLTHcalTowerNoiseCleaner::minRBXHits_
private

Definition at line 45 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

double HLTHcalTowerNoiseCleaner::minRecHitE_
private

Definition at line 53 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

int HLTHcalTowerNoiseCleaner::minZeros_
private

Definition at line 47 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

bool HLTHcalTowerNoiseCleaner::needEMFCoincidence_
private

Definition at line 40 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

int HLTHcalTowerNoiseCleaner::numRBXsToConsider_
private

Definition at line 39 of file HLTHcalTowerNoiseCleaner.h.

int HLTHcalTowerNoiseCleaner::severity_
private

Definition at line 37 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

edm::InputTag HLTHcalTowerNoiseCleaner::TowerCollectionTag_
private

Definition at line 36 of file HLTHcalTowerNoiseCleaner.h.

Referenced by HLTHcalTowerNoiseCleaner().

double HLTHcalTowerNoiseCleaner::TS4TS5EnergyThreshold_
private

Definition at line 55 of file HLTHcalTowerNoiseCleaner.h.

Referenced by produce().

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

Definition at line 57 of file HLTHcalTowerNoiseCleaner.h.

Referenced by HLTHcalTowerNoiseCleaner(), and produce().

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

Definition at line 56 of file HLTHcalTowerNoiseCleaner.h.

Referenced by HLTHcalTowerNoiseCleaner(), and produce().