CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
HLTSmartSinglet< T > Class Template Reference

#include <HLTSmartSinglet.h>

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

Public Member Functions

bool hltFilter (edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
 
 HLTSmartSinglet (const edm::ParameterSet &)
 
 ~HLTSmartSinglet () 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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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
 
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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 Attributes

std::string cut_
 
edm::InputTag inputTag_
 
edm::EDGetTokenT< std::vector< T > > inputToken_
 
int min_N_
 
StringCutObjectSelector< T, true > select_
 
int triggerType_
 

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::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

template<typename T>
class HLTSmartSinglet< T >

See header file for documentation

Author
Martin Grunewald

This class is an HLTFilter (-> EDFilter) implementing a smart HLT trigger cut, specified as a string such as "pt>15 && -3<eta<3", for single objects of the same physics type, allowing to cut on variables relating to both the base class T and the derived actual class

Author
Martin Grunewald

Definition at line 30 of file HLTSmartSinglet.h.

Constructor & Destructor Documentation

◆ HLTSmartSinglet()

template<typename T >
HLTSmartSinglet< T >::HLTSmartSinglet ( const edm::ParameterSet iConfig)
explicit

Definition at line 26 of file HLTSmartSinglet.cc.

27  : HLTFilter(iConfig),
28  inputTag_(iConfig.template getParameter<edm::InputTag>("inputTag")),
29  inputToken_(consumes<std::vector<T>>(inputTag_)),
30  triggerType_(iConfig.template getParameter<int>("triggerType")),
31  cut_(iConfig.template getParameter<std::string>("cut")),
32  min_N_(iConfig.template getParameter<int>("MinN")),
33  select_(cut_) {
34  LogDebug("") << "Input/tyre/cut/ncut : " << inputTag_.encode() << " " << triggerType_ << " " << cut_ << " " << min_N_;
35 }

References HLTSmartSinglet< T >::cut_, edm::InputTag::encode(), HLTSmartSinglet< T >::inputTag_, LogDebug, HLTSmartSinglet< T >::min_N_, and HLTSmartSinglet< T >::triggerType_.

◆ ~HLTSmartSinglet()

template<typename T >
HLTSmartSinglet< T >::~HLTSmartSinglet ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

template<typename T >
void HLTSmartSinglet< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 41 of file HLTSmartSinglet.cc.

41  {
44  desc.add<edm::InputTag>("inputTag", edm::InputTag("hltCollection"));
45  desc.add<int>("triggerType", 0);
46  desc.add<std::string>("cut", "1>0");
47  desc.add<int>("MinN", 1);
48  descriptions.add(defaultModuleLabel<HLTSmartSinglet<T>>(), desc);
49 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), defaultModuleLabel(), HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ hltFilter()

template<typename T >
bool HLTSmartSinglet< T >::hltFilter ( edm::Event iEvent,
const edm::EventSetup iSetup,
trigger::TriggerFilterObjectWithRefs filterproduct 
) const
overridevirtual

Implements HLTFilter.

Definition at line 57 of file HLTSmartSinglet.cc.

59  {
60  using namespace std;
61  using namespace edm;
62  using namespace reco;
63  using namespace trigger;
64 
65  typedef vector<T> TCollection;
66  typedef Ref<TCollection> TRef;
67 
68  // All HLT filters must create and fill an HLT filter object,
69  // recording any reconstructed physics objects satisfying (or not)
70  // this HLT filter, and place it in the Event.
71 
72  // The filter object
73  if (saveTags())
74  filterproduct.addCollectionTag(inputTag_);
75 
76  // Ref to Candidate object to be recorded in filter object
77  TRef ref;
78 
79  // get hold of collection of objects
81  iEvent.getByToken(inputToken_, objects);
82 
83  // look at all objects, check cuts and add to filter object
84  int n(0);
85  typename TCollection::const_iterator i(objects->begin());
86  for (; i != objects->end(); i++) {
87  if (select_(*i)) {
88  n++;
89  ref = TRef(objects, distance(objects->begin(), i));
90  filterproduct.addObject(triggerType_, ref);
91  }
92  }
93 
94  // filter decision
95  bool accept(n >= min_N_);
96 
97  return accept;
98 }

References accept(), trigger::TriggerFilterObjectWithRefs::addCollectionTag(), trigger::TriggerRefsCollections::addObject(), HLT_2018_cff::distance, mps_fire::i, iEvent, dqmiodumpmetadata::n, and BeamBkgSkim_cff::saveTags.

Member Data Documentation

◆ cut_

template<typename T >
std::string HLTSmartSinglet< T >::cut_
private

Definition at line 43 of file HLTSmartSinglet.h.

Referenced by HLTSmartSinglet< T >::HLTSmartSinglet().

◆ inputTag_

template<typename T >
edm::InputTag HLTSmartSinglet< T >::inputTag_
private

Definition at line 40 of file HLTSmartSinglet.h.

Referenced by HLTSmartSinglet< T >::HLTSmartSinglet().

◆ inputToken_

template<typename T >
edm::EDGetTokenT<std::vector<T> > HLTSmartSinglet< T >::inputToken_
private

Definition at line 41 of file HLTSmartSinglet.h.

◆ min_N_

template<typename T >
int HLTSmartSinglet< T >::min_N_
private

Definition at line 44 of file HLTSmartSinglet.h.

Referenced by HLTSmartSinglet< T >::HLTSmartSinglet().

◆ select_

template<typename T >
StringCutObjectSelector<T, true> HLTSmartSinglet< T >::select_
private

Definition at line 46 of file HLTSmartSinglet.h.

◆ triggerType_

template<typename T >
int HLTSmartSinglet< T >::triggerType_
private

Definition at line 42 of file HLTSmartSinglet.h.

Referenced by HLTSmartSinglet< T >::HLTSmartSinglet().

trigger::TriggerRefsCollections::addObject
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
Definition: TriggerRefsCollections.h:302
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HLTSmartSinglet::triggerType_
int triggerType_
Definition: HLTSmartSinglet.h:42
edm
HLT enums.
Definition: AlignableModifier.h:19
objects
Definition: __init__.py:1
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
trigger::TriggerFilterObjectWithRefs::addCollectionTag
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
Definition: TriggerFilterObjectWithRefs.h:55
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
HLTSmartSinglet::min_N_
int min_N_
Definition: HLTSmartSinglet.h:44
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
HLTFilter::HLTFilter
HLTFilter(const edm::ParameterSet &config)
Definition: HLTFilter.cc:20
edm::Ref
Definition: AssociativeIterator.h:58
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
HLTSmartSinglet
Definition: HLTSmartSinglet.h:30
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
HLTFilter::saveTags
bool saveTags() const
Definition: HLTFilter.h:46
defaultModuleLabel
std::string defaultModuleLabel()
Definition: defaultModuleLabel.h:16
HLTSmartSinglet::select_
StringCutObjectSelector< T, true > select_
Definition: HLTSmartSinglet.h:46
HLTSmartSinglet::inputTag_
edm::InputTag inputTag_
Definition: HLTSmartSinglet.h:40
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
HLTSmartSinglet::inputToken_
edm::EDGetTokenT< std::vector< T > > inputToken_
Definition: HLTSmartSinglet.h:41
HLTSmartSinglet::cut_
std::string cut_
Definition: HLTSmartSinglet.h:43
std
Definition: JetResolutionObject.h:76
HLTFilter::makeHLTFilterDescription
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:25
trigger
Definition: HLTPrescaleTableCond.h:8
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
edm::InputTag
Definition: InputTag.h:15