CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HLTHcalSimpleRecHitFilter Class Reference

#include <Work/HLTHcalSimpleRecHitFilter/src/HLTHcalSimpleRecHitFilter.cc>

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

Public Member Functions

 HLTHcalSimpleRecHitFilter (const edm::ParameterSet &)
 
 ~HLTHcalSimpleRecHitFilter () override
 
- Public Member Functions inherited from HLTFilter
 HLTFilter (const edm::ParameterSet &config)
 
int module (edm::Event const &) const
 
const std::string * moduleLabel () const
 
int path (edm::Event const &) const
 
const std::string * pathName (edm::Event const &) const
 
std::pair< int, int > pmid (edm::Event const &) const
 
bool saveTags () const
 
 ~HLTFilter () override
 
- Public Member Functions inherited from edm::global::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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)
 
 ~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
 
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::vector< ModuleDescription const * > &modules, 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
 
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 HLTFilter
static void makeHLTFilterDescription (edm::ParameterSetDescription &desc)
 
- 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 Member Functions

bool hltFilter (edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
 

Private Attributes

bool doCoincidence_
 
edm::InputTag HcalRecHitCollection_
 
edm::EDGetTokenT< HFRecHitCollectionHcalRecHitsToken_
 
std::vector< unsigned int > maskedList_
 
int minNHitsNeg_
 
int minNHitsPos_
 
double threshold_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDFilterBase
typedef EDFilterBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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::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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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: <one line="" class="" summary>="">

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

Definition at line 41 of file HLTHcalSimpleRecHitFilter.cc.

Constructor & Destructor Documentation

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

Definition at line 64 of file HLTHcalSimpleRecHitFilter.cc.

References doCoincidence_, Exception, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), HcalRecHitCollection_, HcalRecHitsToken_, maskedList_, minNHitsNeg_, minNHitsPos_, and threshold_.

64  : HLTFilter(iConfig)
65 {
66  //now do what ever initialization is needed
67  threshold_ = iConfig.getParameter<double>("threshold");
68  minNHitsNeg_ = iConfig.getParameter<int>("minNHitsNeg");
69  minNHitsPos_ = iConfig.getParameter<int>("minNHitsPos");
70  doCoincidence_ = iConfig.getParameter<bool>("doCoincidence");
71  if (iConfig.existsAs<std::vector<unsigned int> >("maskedChannels"))
72  maskedList_ = iConfig.getParameter<std::vector<unsigned int> >("maskedChannels"); //this is using the raw DetId index
73  else
74  //worry about possible user menus with the old interface
75  if (iConfig.existsAs<std::vector<int> >("maskedChannels")) {
76  std::vector<int> tVec=iConfig.getParameter<std::vector<int> >("maskedChannels");
77  if ( !tVec.empty() ) {
78  edm::LogError("cfg error") << "masked list of channels missing from HLT menu. Migration from vector of ints to vector of uints needed for this release";
79  cms::Exception("Invalid/obsolete masked list of channels");
80  }
81  }
82  HcalRecHitCollection_ = iConfig.getParameter<edm::InputTag>("HFRecHitCollection");
83  HcalRecHitsToken_ = consumes<HFRecHitCollection>(HcalRecHitCollection_);
84 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:161
std::vector< unsigned int > maskedList_
HLTFilter(const edm::ParameterSet &config)
Definition: HLTFilter.cc:20
edm::EDGetTokenT< HFRecHitCollection > HcalRecHitsToken_
HLTHcalSimpleRecHitFilter::~HLTHcalSimpleRecHitFilter ( )
override

Definition at line 87 of file HLTHcalSimpleRecHitFilter.cc.

88 {
89 
90  // do anything here that needs to be done at desctruction time
91  // (e.g. close files, deallocate resources etc.)
92 
93 }

Member Function Documentation

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

Definition at line 97 of file HLTHcalSimpleRecHitFilter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), HLTFilter::makeHLTFilterDescription(), and groupFilesInBlocks::temp.

97  {
100  desc.add<edm::InputTag>("HFRecHitCollection",edm::InputTag("hltHfreco"));
101  desc.add<double>("threshold",3.0);
102  desc.add<int>("minNHitsNeg",1);
103  desc.add<int>("minNHitsPos",1);
104  desc.add<bool>("doCoincidence",true);
105  std::vector<unsigned int> temp;
106  desc.add<std::vector<unsigned int> >("maskedChannels",temp)->
107  setComment(" # now by raw detid, not hashed id");
108  descriptions.add("hltHcalSimpleRecHitFilter",desc);
109 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:29
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool HLTHcalSimpleRecHitFilter::hltFilter ( edm::Event iEvent,
const edm::EventSetup iSetup,
trigger::TriggerFilterObjectWithRefs filterproduct 
) const
overrideprivatevirtual

Implements HLTFilter.

Definition at line 117 of file HLTHcalSimpleRecHitFilter.cc.

References accept(), DEFINE_FWK_MODULE, doCoincidence_, cppFunctionSkipper::exception, funct::false, spr::find(), edm::Event::getByToken(), HcalRecHitCollection_, HcalRecHitsToken_, hit::id, maskedList_, minNHitsNeg_, minNHitsPos_, and threshold_.

117  {
118  // using namespace edm;
119 
120  // getting very basic uncalRH
122  try {
123  iEvent.getByToken(HcalRecHitsToken_, crudeHits);
124  } catch ( std::exception& ex) {
125  edm::LogWarning("HLTHcalSimpleRecHitFilter") << HcalRecHitCollection_ << " not available";
126  }
127 
128  bool accept = false ;
129 
130  int nHitsNeg=0, nHitsPos=0;
131  for (auto hit : *crudeHits) {
132  // masking noisy channels
133  if (std::find( maskedList_.begin(), maskedList_.end(), hit.id().rawId() ) != maskedList_.end())
134  continue;
135 
136  // only count tower above threshold
137  if ( hit.energy() < threshold_ ) continue;
138 
139  // count
140  if (hit.id().zside()<0) ++nHitsNeg;
141  else ++nHitsPos;
142  }
143 
144  // Logic
145  if (!doCoincidence_) accept = (nHitsNeg>=minNHitsNeg_) || (nHitsPos>=minNHitsPos_);
146  else accept = (nHitsNeg>=minNHitsNeg_) && (nHitsPos>=minNHitsPos_);
147 // edm::LogInfo("HcalFilter") << "at evet: " << iEvent.id().event()
148 // << " and run: " << iEvent.id().run()
149 // << " Total HF hits: " << crudeHits->size() << " Above Threshold - nNeg: " << nHitsNeg << " nPos " << nHitsPos
150 // << " doCoinc: " << doCoincidence_ << " accept: " << accept << std::endl;
151 
152  // result
153  return accept;
154 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< unsigned int > maskedList_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
unsigned int id
edm::EDGetTokenT< HFRecHitCollection > HcalRecHitsToken_

Member Data Documentation

bool HLTHcalSimpleRecHitFilter::doCoincidence_
private

Definition at line 56 of file HLTHcalSimpleRecHitFilter.cc.

Referenced by hltFilter(), and HLTHcalSimpleRecHitFilter().

edm::InputTag HLTHcalSimpleRecHitFilter::HcalRecHitCollection_
private

Definition at line 52 of file HLTHcalSimpleRecHitFilter.cc.

Referenced by hltFilter(), and HLTHcalSimpleRecHitFilter().

edm::EDGetTokenT<HFRecHitCollection> HLTHcalSimpleRecHitFilter::HcalRecHitsToken_
private

Definition at line 51 of file HLTHcalSimpleRecHitFilter.cc.

Referenced by hltFilter(), and HLTHcalSimpleRecHitFilter().

std::vector<unsigned int> HLTHcalSimpleRecHitFilter::maskedList_
private

Definition at line 57 of file HLTHcalSimpleRecHitFilter.cc.

Referenced by hltFilter(), and HLTHcalSimpleRecHitFilter().

int HLTHcalSimpleRecHitFilter::minNHitsNeg_
private

Definition at line 54 of file HLTHcalSimpleRecHitFilter.cc.

Referenced by hltFilter(), and HLTHcalSimpleRecHitFilter().

int HLTHcalSimpleRecHitFilter::minNHitsPos_
private

Definition at line 55 of file HLTHcalSimpleRecHitFilter.cc.

Referenced by hltFilter(), and HLTHcalSimpleRecHitFilter().

double HLTHcalSimpleRecHitFilter::threshold_
private

Definition at line 53 of file HLTHcalSimpleRecHitFilter.cc.

Referenced by hltFilter(), and HLTHcalSimpleRecHitFilter().