#include <HLTrigger/HLTfilters/interface/HLTSmartSinglet.h>
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_ |
See header file for documentation.
Definition at line 30 of file HLTSmartSinglet.h.
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 }
HLTSmartSinglet< T, Tid >::~HLTSmartSinglet | ( | ) | [inline] |
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 }
std::string HLTSmartSinglet< T, Tid >::cut_ [private] |
Definition at line 41 of file HLTSmartSinglet.h.
Referenced by HLTSmartSinglet< T, Tid >::HLTSmartSinglet().
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().
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().
bool HLTSmartSinglet< T, Tid >::saveTag_ [private] |
StringCutObjectSelector<T> HLTSmartSinglet< T, Tid >::select_ [private] |