CMS 3D CMS Logo

HLTSmartSinglet< T, Tid > Class Template Reference

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 their 4-momentum representation. More...

#include <HLTrigger/HLTfilters/interface/HLTSmartSinglet.h>

Inheritance diagram for HLTSmartSinglet< T, Tid >:

HLTFilter edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 HLTSmartSinglet (const edm::ParameterSet &)
 ~HLTSmartSinglet ()

Private Attributes

std::string cut_
edm::InputTag inputTag_
int min_N_
bool saveTag_
StringCutObjectSelector< T > select_


Detailed Description

template<typename T, int Tid>
class HLTSmartSinglet< T, Tid >

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 their 4-momentum representation.

See header file for documentation.

Date
2008/05/05 15:48:33
Revision
1.4

Author:
Martin Grunewald
Date
2008/05/05 15:48:34
Revision
1.6

Author:
Martin Grunewald

Definition at line 30 of file HLTSmartSinglet.h.


Constructor & Destructor Documentation

template<typename T, int Tid>
HLTSmartSinglet< T, Tid >::HLTSmartSinglet ( const edm::ParameterSet iConfig  )  [inline, explicit]

Definition at line 26 of file HLTSmartSinglet.cc.

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

00026                                                                       :
00027   inputTag_ (iConfig.template getParameter<edm::InputTag>("inputTag")),
00028   saveTag_  (iConfig.template getUntrackedParameter<bool>("saveTag",false)),
00029   cut_      (iConfig.template getParameter<std::string>  ("cut"     )),
00030   min_N_    (iConfig.template getParameter<int>          ("MinN"    )),
00031   select_   (cut_                                                    )
00032 {
00033    LogDebug("") << "Input/cut/ncut : " << inputTag_.encode() << " " << cut_<< " " << min_N_ ;
00034 
00035    //register your products
00036    produces<trigger::TriggerFilterObjectWithRefs>();
00037 }

template<typename T, int Tid>
HLTSmartSinglet< T, Tid >::~HLTSmartSinglet (  )  [inline]

Definition at line 40 of file HLTSmartSinglet.cc.

00041 {
00042 }


Member Function Documentation

template<typename T, int Tid>
bool HLTSmartSinglet< T, Tid >::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [inline, virtual]

Implements HLTFilter.

Definition at line 51 of file HLTSmartSinglet.cc.

References edm::Event::getByLabel(), i, HLTSmartSinglet< T, Tid >::inputTag_, HLTSmartSinglet< T, Tid >::min_N_, module(), n, path(), edm::Event::put(), HcalSimpleRecAlgoImpl::reco(), HLTSmartSinglet< T, Tid >::saveTag_, HLTSmartSinglet< T, Tid >::select_, and std.

00052 {
00053    using namespace std;
00054    using namespace edm;
00055    using namespace reco;
00056    using namespace trigger;
00057 
00058    typedef vector<T> TCollection;
00059    typedef Ref<TCollection> TRef;
00060 
00061    // All HLT filters must create and fill an HLT filter object,
00062    // recording any reconstructed physics objects satisfying (or not)
00063    // this HLT filter, and place it in the Event.
00064 
00065    // The filter object
00066    auto_ptr<TriggerFilterObjectWithRefs>
00067      filterObject (new TriggerFilterObjectWithRefs(path(),module()));
00068    if (saveTag_) filterObject->addCollectionTag(inputTag_);
00069    // Ref to Candidate object to be recorded in filter object
00070    TRef ref;
00071 
00072 
00073    // get hold of collection of objects
00074    Handle<TCollection> objects;
00075    iEvent.getByLabel (inputTag_,objects);
00076 
00077    // look at all objects, check cuts and add to filter object
00078    int n(0);
00079    typename TCollection::const_iterator i ( objects->begin() );
00080    for (; i!=objects->end(); i++) {
00081      if (select_(*i)) {
00082        n++;
00083        ref=TRef(objects,distance(objects->begin(),i));
00084        filterObject->addObject(Tid,ref);
00085      }
00086    }
00087 
00088    // filter decision
00089    bool accept(n>=min_N_);
00090 
00091    // put filter object into the Event
00092    iEvent.put(filterObject);
00093 
00094    return accept;
00095 }


Member Data Documentation

template<typename T, int Tid>
std::string HLTSmartSinglet< T, Tid >::cut_ [private]

Definition at line 41 of file HLTSmartSinglet.h.

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

template<typename T, int Tid>
edm::InputTag HLTSmartSinglet< T, Tid >::inputTag_ [private]

Definition at line 39 of file HLTSmartSinglet.h.

Referenced by HLTSmartSinglet< T, Tid >::filter(), and HLTSmartSinglet< T, Tid >::HLTSmartSinglet().

template<typename T, int Tid>
int HLTSmartSinglet< T, Tid >::min_N_ [private]

Definition at line 42 of file HLTSmartSinglet.h.

Referenced by HLTSmartSinglet< T, Tid >::filter(), and HLTSmartSinglet< T, Tid >::HLTSmartSinglet().

template<typename T, int Tid>
bool HLTSmartSinglet< T, Tid >::saveTag_ [private]

Definition at line 40 of file HLTSmartSinglet.h.

Referenced by HLTSmartSinglet< T, Tid >::filter().

template<typename T, int Tid>
StringCutObjectSelector<T> HLTSmartSinglet< T, Tid >::select_ [private]

Definition at line 44 of file HLTSmartSinglet.h.

Referenced by HLTSmartSinglet< T, Tid >::filter().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:41 2009 for CMSSW by  doxygen 1.5.4