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 hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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 edm::EDGetTokenT< edm::View< T > > src_
 
std::vector< std::unique_ptr< Variable > > vars_
 

Detailed Description

template<typename T>
class SimpleFlatTableProducer< T >

Definition at line 122 of file SimpleFlatTableProducer.h.

Member Typedef Documentation

◆ base

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

Definition at line 124 of file SimpleFlatTableProducer.h.

◆ BoolExtVar

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

Definition at line 215 of file SimpleFlatTableProducer.h.

◆ DoubleExtVar

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

Definition at line 214 of file SimpleFlatTableProducer.h.

◆ FloatExtVar

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

Definition at line 213 of file SimpleFlatTableProducer.h.

◆ IntExtVar

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

Definition at line 212 of file SimpleFlatTableProducer.h.

◆ UInt8ExtVar

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

Definition at line 216 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

◆ SimpleFlatTableProducer()

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

Definition at line 126 of file SimpleFlatTableProducer.h.

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

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

◆ ~SimpleFlatTableProducer()

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

Definition at line 153 of file SimpleFlatTableProducer.h.

153 {}

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

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

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

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

◆ singleton_

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

Definition at line 185 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:185
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:186
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SimpleFlatTableProducer::extvars_
std::vector< std::unique_ptr< ExtVariable > > extvars_
Definition: SimpleFlatTableProducer.h:217
edm::ParameterSet
Definition: ParameterSet.h:47
SimpleFlatTableProducerBase< T, edm::View< T > >::name_
const std::string name_
Definition: SimpleFlatTableProducer.h:58
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
edm::ParameterSet::getParameterNamesForType
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
Exception
Definition: hltDiff.cc:246
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:187
SimpleFlatTableProducerBase
Definition: SimpleFlatTableProducer.h:15
SimpleFlatTableProducerBase< T, edm::View< T > >::vars_
std::vector< std::unique_ptr< Variable > > vars_
Definition: SimpleFlatTableProducer.h:118
SimpleFlatTableProducerBase< T, edm::View< T > >::extension_
const bool extension_
Definition: SimpleFlatTableProducer.h:60