HLTPrescaleRecorder

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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
#ifndef HLTcore_HLTPrescaleRecorder_h
#define HLTcore_HLTPrescaleRecorder_h

/** \class HLTPrescaleRecorder
 *
 *  
 *  This class is an EDProducer making the HLTPrescaleTable object
 *
 *
 *  \author Martin Grunewald
 *
 */

#include "FWCore/Framework/interface/Run.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/one/EDProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/PrescaleService/interface/PrescaleService.h"
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"

#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"

#include "DataFormats/HLTReco/interface/HLTPrescaleTable.h"
#include "CondFormats/HLTObjects/interface/HLTPrescaleTableCond.h"
#include "CondFormats/DataRecord/interface/HLTPrescaleTableRcd.h"

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

namespace edm {
  class ConfigurationDescriptions;
}

//
// class declaration
//

class HLTPrescaleRecorder : public edm::one::EDProducer<edm::EndRunProducer,
                                                        edm::EndLuminosityBlockProducer,
                                                        edm::one::WatchRuns,
                                                        edm::one::WatchLuminosityBlocks> {
public:
  explicit HLTPrescaleRecorder(const edm::ParameterSet&);
  ~HLTPrescaleRecorder() override;
  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
  void beginRun(edm::Run const& iRun, const edm::EventSetup& iSetup) final;
  void endRun(edm::Run const& iRun, const edm::EventSetup& iSetup) final;
  void endRunProduce(edm::Run& iRun, const edm::EventSetup& iSetup) final;
  void beginLuminosityBlock(edm::LuminosityBlock const& iLumi, const edm::EventSetup& iSetup) final;
  void endLuminosityBlock(edm::LuminosityBlock const& iLumi, const edm::EventSetup& iSetup) final;
  void endLuminosityBlockProduce(edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup) final;
  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) final;

private:
  /// (Single) source: -1:PrescaleServicePSet 0:PrescaleService,
  /// 1:Run, 2:Lumi, 3:Event, 4:CondDB
  int src_;

  /// (Multiple) Destinations
  bool run_;
  bool lumi_;
  bool event_;
  bool condDB_;

  /// Source configs
  /// name of PrescaleServicePSet (src=-1)
  std::string psetName_;
  /// InputTag   of HLTPrescaleTable product (src=1,2,3)
  edm::InputTag hltInputTag_;
  /// InputToken of HLTPrescaleTable product (src=1,2,3)
  edm::EDGetTokenT<trigger::HLTPrescaleTable> hltInputToken_;
  /// Tag of DB entry (HLT Key Name) (src=4)
  std::string hltDBTag_;
  edm::ESGetToken<trigger::HLTPrescaleTableCond, HLTPrescaleTableRcd> const hltPrescaleTableCondToken_;

  /// Prescale service
  edm::service::PrescaleService* ps_;
  /// Pool DB service
  cond::service::PoolDBOutputService* db_;

  /// Handle and ESHandle for existing HLT object
  edm::Handle<trigger::HLTPrescaleTable> hltHandle_;

  /// payload HLT object
  trigger::HLTPrescaleTable hlt_;
};
#endif