PrescaleService

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#ifndef FWCore_PrescaleService_PrescaleService_h
#define FWCore_PrescaleService_PrescaleService_h

#include "DataFormats/Provenance/interface/ParameterSetID.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/SaveConfiguration.h"

#include <string>
#include <vector>
#include <map>

namespace edm {
  class ActivityRegistry;
  class ConfigurationDescriptions;
  class ProcessContext;

  namespace service {

    class PrescaleService : public edm::serviceregistry::SaveConfiguration {
    public:
      //
      // construction/destruction
      //

      PrescaleService(ParameterSet const&, ActivityRegistry&);
      ~PrescaleService();

      //
      // member functions
      //

      unsigned int getPrescale(std::string const& prescaledPath) const;
      unsigned int getPrescale(unsigned int lvl1Index, std::string const& prescaledPath) const;

      typedef std::vector<std::string> VString_t;
      typedef std::map<std::string, std::vector<unsigned int> > PrescaleTable_t;
      unsigned int getLvl1IndexDefault() const { return lvl1Default_; }
      const VString_t& getLvl1Labels() const { return lvl1Labels_; }
      const PrescaleTable_t& getPrescaleTable() const { return prescaleTable_; }

      static unsigned int findDefaultIndex(std::string const& label, std::vector<std::string> const& labels);
      static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

    private:
      //
      // private member functions
      //
      void preBeginJob(ProcessContext const&);
      void postBeginJob();

      //
      // member data
      //
      const bool forceDefault_;
      const VString_t lvl1Labels_;
      const unsigned int lvl1Default_;
      const std::vector<ParameterSet> vpsetPrescales_;
      PrescaleTable_t prescaleTable_;
      ParameterSetID processParameterSetID_;
    };
  }  // namespace service
}  // namespace edm

#endif