CMS 3D CMS Logo

DummySelector.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_UtilAlgos_DummySelector_h
00002 #define PhysicsTools_UtilAlgos_DummySelector_h
00003 /* \class DummySelector
00004  *
00005  * Dummy generic selector following the
00006  * interface proposed in the document:
00007  *
00008  * httpss://twiki.cern.ch/twiki/bin/view/CMS/SelectorInterface
00009  *
00010  * \author Luca Lista, INFN
00011  */
00012 #include "FWCore/Utilities/interface/EDMException.h"
00013 
00014 namespace edm { 
00015   class ParameterSet; 
00016   class Event;
00017   class EventSetup;
00018 }
00019 
00020 class DummySelector {
00021 public:
00022   explicit DummySelector(const edm::ParameterSet&) : updated_(false) { }
00023   void newEvent(const edm::Event&, const edm::EventSetup&) { updated_ = true; }
00024   template<typename T>
00025   bool operator()(const T&) { 
00026     if(!updated_)     
00027       throw edm::Exception(edm::errors::Configuration)
00028         << "DummySelector: forgot to call newEvent\n"; 
00029     return true; 
00030   }  
00031 private:
00032   bool updated_;
00033 };
00034 
00035 namespace dummy {
00036   template<typename T>
00037   inline bool select(const T&) { return true; }
00038 }
00039 
00040 EVENTSETUP_STD_INIT(DummySelector);
00041 
00042 #endif

Generated on Tue Jun 9 17:42:07 2009 for CMSSW by  doxygen 1.5.4