00001 #ifndef FWCore_PrescaleService_PrescaleService_h 00002 #define FWCore_PrescaleService_PrescaleService_h 00003 00004 00005 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00006 #include "FWCore/ServiceRegistry/interface/SaveConfiguration.h" 00007 00008 00009 #include <string> 00010 #include <vector> 00011 #include <map> 00012 00013 00014 namespace edm { 00015 class ActivityRegistry; 00016 class Event; 00017 class EventID; 00018 class EventSetup; 00019 class Timestamp; 00020 class ConfigurationDescriptions; 00021 class ModuleDescription; 00022 00023 namespace service { 00024 00025 class PrescaleService : public edm::serviceregistry::SaveConfiguration 00026 { 00027 public: 00028 // 00029 // construction/destruction 00030 // 00031 PrescaleService(ParameterSet const&, ActivityRegistry&); 00032 ~PrescaleService(); 00033 00034 00035 // 00036 // member functions 00037 // 00038 00039 void reconfigure(ParameterSet const& ps); 00040 00041 unsigned int getPrescale(unsigned int lvl1Index, 00042 std::string const& prescaledPath); 00043 unsigned int getPrescale(std::string const& prescaledPath); 00044 00045 void setIndex(unsigned int lvl1Index){iLvl1IndexDefault_ = lvl1Index;} 00046 void postBeginJob(); 00047 void postEndJob() {} 00048 void preEventProcessing(EventID const&, Timestamp const&) {} 00049 void postEventProcessing(Event const&, EventSetup const&) {} 00050 void preModule(ModuleDescription const&) {} 00051 void postModule(ModuleDescription const&) {} 00052 00053 typedef std::vector<std::string> VString_t; 00054 typedef std::map<std::string, std::vector<unsigned int> > PrescaleTable_t; 00055 unsigned int getLvl1IndexDefault() const {return iLvl1IndexDefault_;} 00056 const VString_t& getLvl1Labels() const {return lvl1Labels_;} 00057 const PrescaleTable_t& getPrescaleTable() const {return prescaleTable_;} 00058 00059 static unsigned int findDefaultIndex(std::string const & label, std::vector<std::string> const & labels); 00060 static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); 00061 00062 private: 00063 // 00064 // private member functions 00065 // 00066 00067 void configure(); 00068 00069 // 00070 // member data 00071 // 00072 00073 bool configured_; 00074 bool forceDefault_; 00075 VString_t lvl1Labels_; 00076 unsigned int nLvl1Index_; 00077 unsigned int iLvl1IndexDefault_; 00078 std::vector<ParameterSet> vpsetPrescales_; 00079 PrescaleTable_t prescaleTable_; 00080 }; 00081 } 00082 } 00083 00084 #endif