CMS 3D CMS Logo

MuBaseFlatTableProducer.h
Go to the documentation of this file.
1 #ifndef Mu_MuBaseFlatTableProducer_h
2 #define Mu_MuBaseFlatTableProducer_h
3 
14 
17 
19 
20 #include <string>
21 
23 public:
26 
28  void beginRun(const edm::Run &run, const edm::EventSetup &config) final;
29 
31  void produce(edm::Event &, const edm::EventSetup &) final;
32 
34  void endRun(const edm::Run &, const edm::EventSetup &) final {}
35 
36 protected:
39 
41  virtual void getFromES(const edm::Run &run, const edm::EventSetup &environment) {}
42 
44  virtual void getFromES(const edm::EventSetup &environment) {}
45 
47  virtual void fillTable(edm::Event &ev) = 0;
48 
50  static constexpr int DEFAULT_INT_VAL{-999};
51 
53  static constexpr int8_t DEFAULT_INT8_VAL{-99};
54 
56  static constexpr int DEFAULT_INT_VAL_POS{-1};
57 
59  static constexpr double DEFAULT_DOUBLE_VAL{-999.0};
60 
62  static constexpr double DEFAULT_DOUBLE_VAL_POS{-1.0};
63 
64  template <typename T>
65  void addColumn(std::unique_ptr<nanoaod::FlatTable> &table,
66  const std::string name,
67  const std::vector<T> &vec,
68  const std::string descr) {
69  table->template addColumn<T, std::vector<T>>(name, vec, descr);
70  }
71 };
72 
73 #endif
virtual void fillTable(edm::Event &ev)=0
Fill ntuple.
void endRun(const edm::Run &, const edm::EventSetup &) final
Empty, needed by interface.
virtual void getFromES(const edm::EventSetup &environment)
Get info from the ES for a given event.
Definition: config.py:1
static constexpr double DEFAULT_DOUBLE_VAL
Definition of default values for float variables.
void addColumn(std::unique_ptr< nanoaod::FlatTable > &table, const std::string name, const std::vector< T > &vec, const std::string descr)
void beginRun(const edm::Run &run, const edm::EventSetup &config) final
Configure event setup for each run.
static constexpr int DEFAULT_INT_VAL_POS
Definition of default values for positive int variables.
MuBaseFlatTableProducer(const edm::ParameterSet &)
Constructor.
std::string m_name
The label name of the FlatTableProducer.
static constexpr double DEFAULT_DOUBLE_VAL_POS
Definition of default values for positive float variables.
virtual void getFromES(const edm::Run &run, const edm::EventSetup &environment)
Get info from the ES by run.
void produce(edm::Event &, const edm::EventSetup &) final
Fill ntuples event by event.
static constexpr int DEFAULT_INT_VAL
Definition of default values for int variables.
static constexpr int8_t DEFAULT_INT8_VAL
Definition of default values for int8 variables.
Definition: Run.h:45