CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Types | Protected Attributes
SimpleFlatTableProducerBase< T, TProd > Class Template Referenceabstract

#include <SimpleFlatTableProducer.h>

Inheritance diagram for SimpleFlatTableProducerBase< T, TProd >:
edm::stream::EDProducer<>

Public Member Functions

virtual std::unique_ptr
< nanoaod::FlatTable
fillTable (const edm::Event &iEvent, const edm::Handle< TProd > &prod) const =0
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 SimpleFlatTableProducerBase (edm::ParameterSet const &params)
 
 ~SimpleFlatTableProducerBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Protected Types

typedef FuncVariable< T,
StringCutObjectSelector< T >
, bool > 
BoolVar
 
typedef FuncVariable< T,
StringObjectFunction< T >
, float > 
FloatVar
 
typedef FuncVariable< T,
StringObjectFunction< T >
, int8_t > 
Int8Var
 
typedef FuncVariable< T,
StringObjectFunction< T >, int > 
IntVar
 
typedef FuncVariable< T,
StringObjectFunction< T >
, uint8_t > 
UInt8Var
 
typedef FuncVariable< T,
StringObjectFunction< T >
, unsigned int > 
UIntVar
 

Protected Attributes

const std::string doc_
 
const bool extension_
 
const std::string name_
 
const bool skipNonExistingSrc_
 
const edm::EDGetTokenT< TProd > src_
 
std::vector< std::unique_ptr
< Variable< T > > > 
vars_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

template<typename T, typename TProd>
class SimpleFlatTableProducerBase< T, TProd >

Definition at line 111 of file SimpleFlatTableProducer.h.

Member Typedef Documentation

template<typename T, typename TProd>
typedef FuncVariable<T, StringCutObjectSelector<T>, bool> SimpleFlatTableProducerBase< T, TProd >::BoolVar
protected

Definition at line 171 of file SimpleFlatTableProducer.h.

template<typename T, typename TProd>
typedef FuncVariable<T, StringObjectFunction<T>, float> SimpleFlatTableProducerBase< T, TProd >::FloatVar
protected

Definition at line 168 of file SimpleFlatTableProducer.h.

template<typename T, typename TProd>
typedef FuncVariable<T, StringObjectFunction<T>, int8_t> SimpleFlatTableProducerBase< T, TProd >::Int8Var
protected

Definition at line 169 of file SimpleFlatTableProducer.h.

template<typename T, typename TProd>
typedef FuncVariable<T, StringObjectFunction<T>, int> SimpleFlatTableProducerBase< T, TProd >::IntVar
protected

Definition at line 166 of file SimpleFlatTableProducer.h.

template<typename T, typename TProd>
typedef FuncVariable<T, StringObjectFunction<T>, uint8_t> SimpleFlatTableProducerBase< T, TProd >::UInt8Var
protected

Definition at line 170 of file SimpleFlatTableProducer.h.

template<typename T, typename TProd>
typedef FuncVariable<T, StringObjectFunction<T>, unsigned int> SimpleFlatTableProducerBase< T, TProd >::UIntVar
protected

Definition at line 167 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

template<typename T, typename TProd>
SimpleFlatTableProducerBase< T, TProd >::SimpleFlatTableProducerBase ( edm::ParameterSet const &  params)
inline

Definition at line 113 of file SimpleFlatTableProducer.h.

114  : name_(params.getParameter<std::string>("name")),
115  doc_(params.existsAs<std::string>("doc") ? params.getParameter<std::string>("doc") : ""),
116  extension_(params.existsAs<bool>("extension") ? params.getParameter<bool>("extension") : false),
118  params.existsAs<bool>("skipNonExistingSrc") ? params.getParameter<bool>("skipNonExistingSrc") : false),
119  src_(consumes<TProd>(params.getParameter<edm::InputTag>("src"))) {
120  edm::ParameterSet const &varsPSet = params.getParameter<edm::ParameterSet>("variables");
121  for (const std::string &vname : varsPSet.getParameterNamesForType<edm::ParameterSet>()) {
122  const auto &varPSet = varsPSet.getParameter<edm::ParameterSet>(vname);
123  const std::string &type = varPSet.getParameter<std::string>("type");
124  if (type == "int")
125  vars_.push_back(std::make_unique<IntVar>(vname, varPSet));
126  else if (type == "uint")
127  vars_.push_back(std::make_unique<UIntVar>(vname, varPSet));
128  else if (type == "float")
129  vars_.push_back(std::make_unique<FloatVar>(vname, varPSet));
130  else if (type == "int8")
131  vars_.push_back(std::make_unique<Int8Var>(vname, varPSet));
132  else if (type == "uint8")
133  vars_.push_back(std::make_unique<UInt8Var>(vname, varPSet));
134  else if (type == "bool")
135  vars_.push_back(std::make_unique<BoolVar>(vname, varPSet));
136  else
137  throw cms::Exception("Configuration", "unsupported type " + type + " for variable " + vname);
138  }
139 
140  produces<nanoaod::FlatTable>();
141  }
const edm::EDGetTokenT< TProd > src_
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< std::unique_ptr< Variable< T > > > vars_
template<typename T, typename TProd>
SimpleFlatTableProducerBase< T, TProd >::~SimpleFlatTableProducerBase ( )
inlineoverride

Definition at line 143 of file SimpleFlatTableProducer.h.

143 {}

Member Function Documentation

template<typename T, typename TProd>
virtual std::unique_ptr<nanoaod::FlatTable> SimpleFlatTableProducerBase< T, TProd >::fillTable ( const edm::Event iEvent,
const edm::Handle< TProd > &  prod 
) const
pure virtual
template<typename T, typename TProd>
void SimpleFlatTableProducerBase< T, TProd >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlineoverride

Definition at line 149 of file SimpleFlatTableProducer.h.

149  {
151  iEvent.getByToken(src_, src);
152 
153  std::unique_ptr<nanoaod::FlatTable> out = fillTable(iEvent, src);
154  out->setDoc(doc_);
155 
156  iEvent.put(std::move(out));
157  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const edm::EDGetTokenT< TProd > src_
def move
Definition: eostools.py:511
virtual std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::Event &iEvent, const edm::Handle< TProd > &prod) const =0

Member Data Documentation

template<typename T, typename TProd>
const std::string SimpleFlatTableProducerBase< T, TProd >::doc_
protected
template<typename T, typename TProd>
const bool SimpleFlatTableProducerBase< T, TProd >::extension_
protected

Definition at line 162 of file SimpleFlatTableProducer.h.

template<typename T, typename TProd>
const std::string SimpleFlatTableProducerBase< T, TProd >::name_
protected

Definition at line 160 of file SimpleFlatTableProducer.h.

template<typename T, typename TProd>
const bool SimpleFlatTableProducerBase< T, TProd >::skipNonExistingSrc_
protected

Definition at line 163 of file SimpleFlatTableProducer.h.

template<typename T, typename TProd>
const edm::EDGetTokenT<TProd> SimpleFlatTableProducerBase< T, TProd >::src_
protected
template<typename T, typename TProd>
std::vector<std::unique_ptr<Variable<T> > > SimpleFlatTableProducerBase< T, TProd >::vars_
protected