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

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
 
 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 ValueMapVariable< bool > 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 >, bool > 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_
 
std::vector< std::unique_ptr< ExtVariable > > extvars_
 
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 bool skipNonExistingSrc_
 
const edm::EDGetTokenT< edm::View< T > > src_
 
std::vector< std::unique_ptr< Variable > > vars_
 

Detailed Description

template<typename T>
class SimpleFlatTableProducer< T >

Definition at line 126 of file SimpleFlatTableProducer.h.

Member Typedef Documentation

◆ base

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

Definition at line 128 of file SimpleFlatTableProducer.h.

◆ BoolExtVar

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

Definition at line 236 of file SimpleFlatTableProducer.h.

◆ DoubleExtVar

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

Definition at line 235 of file SimpleFlatTableProducer.h.

◆ FloatExtVar

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

Definition at line 234 of file SimpleFlatTableProducer.h.

◆ IntExtVar

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

Definition at line 233 of file SimpleFlatTableProducer.h.

◆ UInt8ExtVar

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

Definition at line 237 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

◆ SimpleFlatTableProducer()

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

Definition at line 130 of file SimpleFlatTableProducer.h.

132  singleton_(params.getParameter<bool>("singleton")),
133  maxLen_(params.existsAs<unsigned int>("maxLen") ? params.getParameter<unsigned int>("maxLen")
135  cut_(!singleton_ ? params.getParameter<std::string>("cut") : "", true) {
136  if (params.existsAs<edm::ParameterSet>("externalVariables")) {
137  edm::ParameterSet const &extvarsPSet = params.getParameter<edm::ParameterSet>("externalVariables");
138  for (const std::string &vname : extvarsPSet.getParameterNamesForType<edm::ParameterSet>()) {
139  const auto &varPSet = extvarsPSet.getParameter<edm::ParameterSet>(vname);
140  const std::string &type = varPSet.getParameter<std::string>("type");
141  if (type == "int")
142  extvars_.push_back(
143  std::make_unique<IntExtVar>(vname, varPSet, this->consumesCollector(), this->skipNonExistingSrc_));
144  else if (type == "float")
145  extvars_.push_back(
146  std::make_unique<FloatExtVar>(vname, varPSet, this->consumesCollector(), this->skipNonExistingSrc_));
147  else if (type == "double")
148  extvars_.push_back(
149  std::make_unique<DoubleExtVar>(vname, varPSet, this->consumesCollector(), this->skipNonExistingSrc_));
150  else if (type == "uint8")
151  extvars_.push_back(
152  std::make_unique<UInt8ExtVar>(vname, varPSet, this->consumesCollector(), this->skipNonExistingSrc_));
153  else if (type == "bool")
154  extvars_.push_back(
155  std::make_unique<BoolExtVar>(vname, varPSet, this->consumesCollector(), this->skipNonExistingSrc_));
156  else
157  throw cms::Exception("Configuration", "unsupported type " + type + " for variable " + vname);
158  }
159  }
160  }

References Exception, SimpleFlatTableProducer< T >::extvars_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), CalibrationSummaryClient_cfi::params, SimpleFlatTableProducerBase< T, edm::View< T > >::skipNonExistingSrc_, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~SimpleFlatTableProducer()

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

Definition at line 162 of file SimpleFlatTableProducer.h.

162 {}

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 164 of file SimpleFlatTableProducer.h.

165  {
166  std::vector<const T *> selobjs;
167  std::vector<edm::Ptr<T>> selptrs; // for external variables
168  if (prod.isValid() || !(this->skipNonExistingSrc_)) {
169  if (singleton_) {
170  assert(prod->size() == 1);
171  selobjs.push_back(&(*prod)[0]);
172  if (!extvars_.empty())
173  selptrs.emplace_back(prod->ptrAt(0));
174  } else {
175  for (unsigned int i = 0, n = prod->size(); i < n; ++i) {
176  const auto &obj = (*prod)[i];
177  if (cut_(obj)) {
178  selobjs.push_back(&obj);
179  if (!extvars_.empty())
180  selptrs.emplace_back(prod->ptrAt(i));
181  }
182  if (selobjs.size() >= maxLen_)
183  break;
184  }
185  }
186  }
187  auto out = std::make_unique<nanoaod::FlatTable>(selobjs.size(), this->name_, singleton_, this->extension_);
188  for (const auto &var : this->vars_)
189  var->fill(selobjs, *out);
190  for (const auto &var : this->extvars_)
191  var->fill(iEvent, selptrs, *out);
192  return out;
193  }

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_, SimpleFlatTableProducerBase< T, edm::View< T > >::skipNonExistingSrc_, 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 198 of file SimpleFlatTableProducer.h.

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

◆ extvars_

template<typename T >
std::vector<std::unique_ptr<ExtVariable> > SimpleFlatTableProducer< T >::extvars_
protected

◆ maxLen_

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

Definition at line 197 of file SimpleFlatTableProducer.h.

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

◆ singleton_

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

Definition at line 196 of file SimpleFlatTableProducer.h.

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

mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
cms::cuda::assert
assert(be >=bs)
SimpleFlatTableProducer::singleton_
bool singleton_
Definition: SimpleFlatTableProducer.h:196
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
SimpleFlatTableProducer::maxLen_
const unsigned int maxLen_
Definition: SimpleFlatTableProducer.h:197
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
SimpleFlatTableProducerBase< T, edm::View< T > >::skipNonExistingSrc_
const bool skipNonExistingSrc_
Definition: SimpleFlatTableProducer.h:64
SimpleFlatTableProducer::extvars_
std::vector< std::unique_ptr< ExtVariable > > extvars_
Definition: SimpleFlatTableProducer.h:238
edm::ParameterSet
Definition: ParameterSet.h:47
SimpleFlatTableProducerBase< T, edm::View< T > >::name_
const std::string name_
Definition: SimpleFlatTableProducer.h:61
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
edm::ParameterSet::getParameterNamesForType
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
SimpleFlatTableProducer::cut_
const StringCutObjectSelector< T > cut_
Definition: SimpleFlatTableProducer.h:198
SimpleFlatTableProducerBase
Definition: SimpleFlatTableProducer.h:15
SimpleFlatTableProducerBase< T, edm::View< T > >::vars_
std::vector< std::unique_ptr< Variable > > vars_
Definition: SimpleFlatTableProducer.h:122
SimpleFlatTableProducerBase< T, edm::View< T > >::extension_
const bool extension_
Definition: SimpleFlatTableProducer.h:63