CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Protected Types | Protected Attributes
SimpleFlatTableProducer< T > Class Template Reference

#include <SimpleFlatTableProducer.h>

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

Classes

class  ExtVariable
 
class  ValueMapVariable
 

Public Types

typedef SimpleFlatTableProducerBase< T, edm::View< T > > base
 
- 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
 

Public Member Functions

std::unique_ptr< nanoaod::FlatTablefillTable (const edm::Event &iEvent, const edm::Handle< edm::View< T >> &prod) const override
 
 SimpleFlatTableProducer (edm::ParameterSet const &params)
 
 ~SimpleFlatTableProducer () override
 
- Public Member Functions inherited from SimpleFlatTableProducerBase< T, edm::View< T > >
virtual std::unique_ptr< nanoaod::FlatTablefillTable (const edm::Event &iEvent, const edm::Handle< edm::View< T > > &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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Protected Types

typedef ValueMapVariable< bool, uint8_t > BoolExtVar
 
typedef ValueMapVariable< double, float > DoubleExtVar
 
typedef ValueMapVariable< float > FloatExtVar
 
typedef ValueMapVariable< int > IntExtVar
 
typedef ValueMapVariable< int, uint8_t > UInt8ExtVar
 
- Protected Types inherited from SimpleFlatTableProducerBase< T, edm::View< T > >
typedef FuncVariable< StringCutObjectSelector< T >, uint8_t > BoolVar
 
typedef FuncVariable< StringObjectFunction< T >, float > FloatVar
 
typedef FuncVariable< StringObjectFunction< T >, int > IntVar
 
typedef FuncVariable< StringObjectFunction< T >, uint8_t > UInt8Var
 

Protected Attributes

const StringCutObjectSelector< Tcut_
 
boost::ptr_vector< ExtVariableextvars_
 
const unsigned int maxLen_
 
bool singleton_
 
- Protected Attributes inherited from SimpleFlatTableProducerBase< T, edm::View< T > >
const std::string doc_
 
const bool extension_
 
const std::string name_
 
const edm::EDGetTokenT< edm::View< T > > src_
 
boost::ptr_vector< Variable > vars_
 

Detailed Description

template<typename T>
class SimpleFlatTableProducer< T >

Definition at line 118 of file SimpleFlatTableProducer.h.

Member Typedef Documentation

◆ base

template<typename T >
typedef SimpleFlatTableProducerBase<T, edm::View<T> > SimpleFlatTableProducer< T >::base

Definition at line 120 of file SimpleFlatTableProducer.h.

◆ BoolExtVar

template<typename T >
typedef ValueMapVariable<bool, uint8_t> SimpleFlatTableProducer< T >::BoolExtVar
protected

Definition at line 219 of file SimpleFlatTableProducer.h.

◆ DoubleExtVar

template<typename T >
typedef ValueMapVariable<double, float> SimpleFlatTableProducer< T >::DoubleExtVar
protected

Definition at line 218 of file SimpleFlatTableProducer.h.

◆ FloatExtVar

template<typename T >
typedef ValueMapVariable<float> SimpleFlatTableProducer< T >::FloatExtVar
protected

Definition at line 217 of file SimpleFlatTableProducer.h.

◆ IntExtVar

template<typename T >
typedef ValueMapVariable<int> SimpleFlatTableProducer< T >::IntExtVar
protected

Definition at line 216 of file SimpleFlatTableProducer.h.

◆ UInt8ExtVar

template<typename T >
typedef ValueMapVariable<int, uint8_t> SimpleFlatTableProducer< T >::UInt8ExtVar
protected

Definition at line 220 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

◆ SimpleFlatTableProducer()

template<typename T >
SimpleFlatTableProducer< T >::SimpleFlatTableProducer ( edm::ParameterSet const &  params)
inline

Definition at line 122 of file SimpleFlatTableProducer.h.

124  singleton_(params.getParameter<bool>("singleton")),
125  maxLen_(params.existsAs<unsigned int>("maxLen") ? params.getParameter<unsigned int>("maxLen")
127  cut_(!singleton_ ? params.getParameter<std::string>("cut") : "", true) {
128  if (params.existsAs<edm::ParameterSet>("externalVariables")) {
129  edm::ParameterSet const &extvarsPSet = params.getParameter<edm::ParameterSet>("externalVariables");
130  for (const std::string &vname : extvarsPSet.getParameterNamesForType<edm::ParameterSet>()) {
131  const auto &varPSet = extvarsPSet.getParameter<edm::ParameterSet>(vname);
132  const std::string &type = varPSet.getParameter<std::string>("type");
133  if (type == "int")
134  extvars_.push_back(new IntExtVar(vname, nanoaod::FlatTable::IntColumn, varPSet, this->consumesCollector()));
135  else if (type == "float")
136  extvars_.push_back(
137  new FloatExtVar(vname, nanoaod::FlatTable::FloatColumn, varPSet, this->consumesCollector()));
138  else if (type == "double")
139  extvars_.push_back(
140  new DoubleExtVar(vname, nanoaod::FlatTable::FloatColumn, varPSet, this->consumesCollector()));
141  else if (type == "uint8")
142  extvars_.push_back(
143  new UInt8ExtVar(vname, nanoaod::FlatTable::UInt8Column, varPSet, this->consumesCollector()));
144  else if (type == "bool")
145  extvars_.push_back(new BoolExtVar(vname, nanoaod::FlatTable::BoolColumn, varPSet, this->consumesCollector()));
146  else
147  throw cms::Exception("Configuration", "unsupported type " + type + " for variable " + vname);
148  }
149  }
150  }

References nanoaod::FlatTable::BoolColumn, Exception, SimpleFlatTableProducer< T >::extvars_, nanoaod::FlatTable::FloatColumn, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), nanoaod::FlatTable::IntColumn, CalibrationSummaryClient_cfi::params, AlCaHLTBitMon_QueryRunRegistry::string, and nanoaod::FlatTable::UInt8Column.

◆ ~SimpleFlatTableProducer()

template<typename T >
SimpleFlatTableProducer< T >::~SimpleFlatTableProducer ( )
inlineoverride

Definition at line 152 of file SimpleFlatTableProducer.h.

152 {}

Member Function Documentation

◆ fillTable()

template<typename T >
std::unique_ptr<nanoaod::FlatTable> SimpleFlatTableProducer< T >::fillTable ( const edm::Event iEvent,
const edm::Handle< edm::View< T >> &  prod 
) const
inlineoverride

Definition at line 154 of file SimpleFlatTableProducer.h.

155  {
156  std::vector<const T *> selobjs;
157  std::vector<edm::Ptr<T>> selptrs; // for external variables
158  if (singleton_) {
159  assert(prod->size() == 1);
160  selobjs.push_back(&(*prod)[0]);
161  if (!extvars_.empty())
162  selptrs.emplace_back(prod->ptrAt(0));
163  } else {
164  for (unsigned int i = 0, n = prod->size(); i < n; ++i) {
165  const auto &obj = (*prod)[i];
166  if (cut_(obj)) {
167  selobjs.push_back(&obj);
168  if (!extvars_.empty())
169  selptrs.emplace_back(prod->ptrAt(i));
170  }
171  if (selobjs.size() >= maxLen_)
172  break;
173  }
174  }
175  auto out = std::make_unique<nanoaod::FlatTable>(selobjs.size(), this->name_, singleton_, this->extension_);
176  for (const auto &var : this->vars_)
177  var.fill(selobjs, *out);
178  for (const auto &var : this->extvars_)
179  var.fill(iEvent, selptrs, *out);
180  return out;
181  }

References cms::cuda::assert(), SimpleFlatTableProducer< T >::cut_, SimpleFlatTableProducerBase< T, edm::View< T > >::extension_, SimpleFlatTableProducer< T >::extvars_, mps_fire::i, SimpleFlatTableProducer< T >::maxLen_, dqmiodumpmetadata::n, SimpleFlatTableProducerBase< T, edm::View< T > >::name_, getGTfromDQMFile::obj, MillePedeFileConverter_cfg::out, dumpMFGeometry_cfg::prod, SimpleFlatTableProducer< T >::singleton_, trigObjTnPSource_cfi::var, and SimpleFlatTableProducerBase< T, edm::View< T > >::vars_.

Member Data Documentation

◆ cut_

template<typename T >
const StringCutObjectSelector<T> SimpleFlatTableProducer< T >::cut_
protected

Definition at line 186 of file SimpleFlatTableProducer.h.

Referenced by SimpleFlatTableProducer< T >::fillTable().

◆ extvars_

template<typename T >
boost::ptr_vector<ExtVariable> SimpleFlatTableProducer< T >::extvars_
protected

◆ maxLen_

template<typename T >
const unsigned int SimpleFlatTableProducer< T >::maxLen_
protected

Definition at line 185 of file SimpleFlatTableProducer.h.

Referenced by SimpleFlatTableProducer< T >::fillTable().

◆ singleton_

template<typename T >
bool SimpleFlatTableProducer< T >::singleton_
protected

Definition at line 184 of file SimpleFlatTableProducer.h.

Referenced by SimpleFlatTableProducer< T >::fillTable().

nanoaod::FlatTable::FloatColumn
Definition: FlatTable.h:39
mps_fire.i
i
Definition: mps_fire.py:355
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
SimpleFlatTableProducer::IntExtVar
ValueMapVariable< int > IntExtVar
Definition: SimpleFlatTableProducer.h:216
cms::cuda::assert
assert(be >=bs)
SimpleFlatTableProducer::UInt8ExtVar
ValueMapVariable< int, uint8_t > UInt8ExtVar
Definition: SimpleFlatTableProducer.h:220
SimpleFlatTableProducer::singleton_
bool singleton_
Definition: SimpleFlatTableProducer.h:184
SimpleFlatTableProducer::FloatExtVar
ValueMapVariable< float > FloatExtVar
Definition: SimpleFlatTableProducer.h:217
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
SimpleFlatTableProducerBase< T, edm::View< T > >::vars_
boost::ptr_vector< Variable > vars_
Definition: SimpleFlatTableProducer.h:114
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
SimpleFlatTableProducer::maxLen_
const unsigned int maxLen_
Definition: SimpleFlatTableProducer.h:185
SimpleFlatTableProducer::extvars_
boost::ptr_vector< ExtVariable > extvars_
Definition: SimpleFlatTableProducer.h:221
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
SimpleFlatTableProducerBase< T, edm::View< T > >::name_
const std::string name_
Definition: SimpleFlatTableProducer.h:58
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::ParameterSet::getParameterNamesForType
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:168
nanoaod::FlatTable::UInt8Column
Definition: FlatTable.h:41
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
nanoaod::FlatTable::IntColumn
Definition: FlatTable.h:40
type
type
Definition: HCALResponse.h:21
nanoaod::FlatTable::BoolColumn
Definition: FlatTable.h:42
Exception
Definition: hltDiff.cc:246
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
SimpleFlatTableProducer::BoolExtVar
ValueMapVariable< bool, uint8_t > BoolExtVar
Definition: SimpleFlatTableProducer.h:219
SimpleFlatTableProducer::cut_
const StringCutObjectSelector< T > cut_
Definition: SimpleFlatTableProducer.h:186
SimpleFlatTableProducerBase
Definition: SimpleFlatTableProducer.h:15
SimpleFlatTableProducer::DoubleExtVar
ValueMapVariable< double, float > DoubleExtVar
Definition: SimpleFlatTableProducer.h:218
SimpleFlatTableProducerBase< T, edm::View< T > >::extension_
const bool extension_
Definition: SimpleFlatTableProducer.h:60