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
 
- 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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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::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

template<typename T>
class HLTSmartSinglet< T >

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

See header file for documentation

Author
Martin Grunewald

Definition at line 30 of file HLTSmartSinglet.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file HLTSmartSinglet.cc.

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

26  : HLTFilter(iConfig),
27  inputTag_ (iConfig.template getParameter<edm::InputTag>("inputTag")),
28  inputToken_ (consumes<std::vector<T> >(inputTag_)),
29  triggerType_ (iConfig.template getParameter<int>("triggerType")),
30  cut_ (iConfig.template getParameter<std::string> ("cut" )),
31  min_N_ (iConfig.template getParameter<int> ("MinN" )),
32  select_ (cut_ )
33 {
34  LogDebug("") << "Input/tyre/cut/ncut : "
35  << inputTag_.encode() << " "
36  << triggerType_ << " "
37  << cut_<< " "
38  << min_N_ ;
39 }
#define LogDebug(id)
edm::InputTag inputTag_
std::string encode() const
Definition: InputTag.cc:166
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::string cut_
HLTFilter(const edm::ParameterSet &config)
Definition: HLTFilter.cc:20
StringCutObjectSelector< T, true > select_
edm::EDGetTokenT< std::vector< T > > inputToken_
template<typename T >
HLTSmartSinglet< T >::~HLTSmartSinglet ( )
overridedefault

Member Function Documentation

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

Definition at line 46 of file HLTSmartSinglet.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), defaultModuleLabel(), HLTFilter::makeHLTFilterDescription(), and AlCaHLTBitMon_QueryRunRegistry::string.

46  {
49  desc.add<edm::InputTag>("inputTag",edm::InputTag("hltCollection"));
50  desc.add<int>("triggerType",0);
51  desc.add<std::string>("cut","1>0");
52  desc.add<int>("MinN",1);
53  descriptions.add(defaultModuleLabel<HLTSmartSinglet<T>>(), desc);
54 }
std::string defaultModuleLabel()
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)
template<typename T >
bool HLTSmartSinglet< T >::hltFilter ( edm::Event iEvent,
const edm::EventSetup iSetup,
trigger::TriggerFilterObjectWithRefs filterproduct 
) const
overridevirtual

Implements HLTFilter.

Definition at line 63 of file HLTSmartSinglet.cc.

References accept(), trigger::TriggerFilterObjectWithRefs::addCollectionTag(), trigger::TriggerRefsCollections::addObject(), SoftLeptonByDistance_cfi::distance, edm::Event::getByToken(), mps_fire::i, HLTSmartSinglet< T >::inputTag_, HLTSmartSinglet< T >::inputToken_, HLTSmartSinglet< T >::min_N_, gen::n, HLTFilter::saveTags(), HLTSmartSinglet< T >::select_, and HLTSmartSinglet< T >::triggerType_.

64 {
65  using namespace std;
66  using namespace edm;
67  using namespace reco;
68  using namespace trigger;
69 
70  typedef vector<T> TCollection;
71  typedef Ref<TCollection> TRef;
72 
73  // All HLT filters must create and fill an HLT filter object,
74  // recording any reconstructed physics objects satisfying (or not)
75  // this HLT filter, and place it in the Event.
76 
77  // The filter object
78  if (saveTags()) filterproduct.addCollectionTag(inputTag_);
79 
80  // Ref to Candidate object to be recorded in filter object
81  TRef ref;
82 
83  // get hold of collection of objects
85  iEvent.getByToken (inputToken_,objects);
86 
87  // look at all objects, check cuts and add to filter object
88  int n(0);
89  typename TCollection::const_iterator i ( objects->begin() );
90  for (; i!=objects->end(); i++) {
91  if (select_(*i)) {
92  n++;
93  ref=TRef(objects,distance(objects->begin(),i));
94  filterproduct.addObject(triggerType_,ref);
95  }
96  }
97 
98  // filter decision
99  bool accept(n>=min_N_);
100 
101  return accept;
102 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
edm::InputTag inputTag_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
StringCutObjectSelector< T, true > select_
fixed size matrix
bool saveTags() const
Definition: HLTFilter.h:45
edm::EDGetTokenT< std::vector< T > > inputToken_
HLT enums.

Member Data Documentation

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

Definition at line 43 of file HLTSmartSinglet.h.

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

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

Definition at line 41 of file HLTSmartSinglet.h.

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

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

Definition at line 46 of file HLTSmartSinglet.h.

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

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