CMS 3D CMS Logo

List of all members | Classes | 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<>

Classes

class  FuncVariable
 
class  Variable
 
class  VariableBase
 

Public Member Functions

virtual std::unique_ptr< nanoaod::FlatTablefillTable (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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Protected Types

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

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 > > vars_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

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

Definition at line 15 of file SimpleFlatTableProducer.h.

Member Typedef Documentation

◆ BoolVar

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

Definition at line 121 of file SimpleFlatTableProducer.h.

◆ FloatVar

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

Definition at line 119 of file SimpleFlatTableProducer.h.

◆ IntVar

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

Definition at line 118 of file SimpleFlatTableProducer.h.

◆ UInt8Var

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

Definition at line 120 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

◆ SimpleFlatTableProducerBase()

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

Definition at line 17 of file SimpleFlatTableProducer.h.

18  : name_(params.getParameter<std::string>("name")),
19  doc_(params.existsAs<std::string>("doc") ? params.getParameter<std::string>("doc") : ""),
20  extension_(params.existsAs<bool>("extension") ? params.getParameter<bool>("extension") : false),
22  params.existsAs<bool>("skipNonExistingSrc") ? params.getParameter<bool>("skipNonExistingSrc") : false),
23  src_(skipNonExistingSrc_ ? mayConsume<TProd>(params.getParameter<edm::InputTag>("src"))
24  : consumes<TProd>(params.getParameter<edm::InputTag>("src"))) {
25  edm::ParameterSet const &varsPSet = params.getParameter<edm::ParameterSet>("variables");
26  for (const std::string &vname : varsPSet.getParameterNamesForType<edm::ParameterSet>()) {
27  const auto &varPSet = varsPSet.getParameter<edm::ParameterSet>(vname);
28  const std::string &type = varPSet.getParameter<std::string>("type");
29  if (type == "int")
30  vars_.push_back(std::make_unique<IntVar>(vname, varPSet));
31  else if (type == "float")
32  vars_.push_back(std::make_unique<FloatVar>(vname, varPSet));
33  else if (type == "uint8")
34  vars_.push_back(std::make_unique<UInt8Var>(vname, varPSet));
35  else if (type == "bool")
36  vars_.push_back(std::make_unique<BoolVar>(vname, varPSet));
37  else
38  throw cms::Exception("Configuration", "unsupported type " + type + " for variable " + vname);
39  }
40 
41  produces<nanoaod::FlatTable>();
42  }

◆ ~SimpleFlatTableProducerBase()

template<typename T, typename TProd>
SimpleFlatTableProducerBase< T, TProd >::~SimpleFlatTableProducerBase ( )
inlineoverride

Definition at line 44 of file SimpleFlatTableProducer.h.

44 {}

Member Function Documentation

◆ fillTable()

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

◆ produce()

template<typename T, typename TProd>
void SimpleFlatTableProducerBase< T, TProd >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlineoverride

Definition at line 50 of file SimpleFlatTableProducer.h.

50  {
52  iEvent.getByToken(src_, src);
53 
54  std::unique_ptr<nanoaod::FlatTable> out = fillTable(iEvent, src);
55  out->setDoc(doc_);
56 
57  iEvent.put(std::move(out));
58  }

Member Data Documentation

◆ doc_

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

◆ extension_

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

Definition at line 63 of file SimpleFlatTableProducer.h.

◆ name_

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

Definition at line 61 of file SimpleFlatTableProducer.h.

◆ skipNonExistingSrc_

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

Definition at line 64 of file SimpleFlatTableProducer.h.

◆ src_

template<typename T, typename TProd>
const edm::EDGetTokenT<TProd> SimpleFlatTableProducerBase< T, TProd >::src_
protected

◆ vars_

template<typename T, typename TProd>
std::vector<std::unique_ptr<Variable> > SimpleFlatTableProducerBase< T, TProd >::vars_
protected
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
edm::Handle
Definition: AssociativeIterator.h:50
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SimpleFlatTableProducerBase::skipNonExistingSrc_
const bool skipNonExistingSrc_
Definition: SimpleFlatTableProducer.h:64
edm::ParameterSet
Definition: ParameterSet.h:47
SimpleFlatTableProducerBase::name_
const std::string name_
Definition: SimpleFlatTableProducer.h:61
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
edm::ParameterSet::getParameterNamesForType
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
iEvent
int iEvent
Definition: GenABIO.cc:224
SimpleFlatTableProducerBase::src_
const edm::EDGetTokenT< TProd > src_
Definition: SimpleFlatTableProducer.h:65
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:245
SimpleFlatTableProducerBase::fillTable
virtual std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::Event &iEvent, const edm::Handle< TProd > &prod) const =0
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
SimpleFlatTableProducerBase::doc_
const std::string doc_
Definition: SimpleFlatTableProducer.h:62
edm::InputTag
Definition: InputTag.h:15
SimpleFlatTableProducerBase::vars_
std::vector< std::unique_ptr< Variable > > vars_
Definition: SimpleFlatTableProducer.h:122
SimpleFlatTableProducerBase::extension_
const bool extension_
Definition: SimpleFlatTableProducer.h:63