CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
BXVectorSimpleFlatTableProducer< T > Class Template Reference

#include <SimpleFlatTableProducer.h>

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

Public Member Functions

 BXVectorSimpleFlatTableProducer (edm::ParameterSet const &params)
 
std::unique_ptr< nanoaod::FlatTablefillTable (const edm::Event &iEvent, const edm::Handle< BXVector< T >> &prod) const override
 
- Public Member Functions inherited from SimpleFlatTableProducerBase< T, BXVector< T > >
virtual std::unique_ptr< nanoaod::FlatTablefillTable (const edm::Event &iEvent, const edm::Handle< BXVector< 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from SimpleFlatTableProducerBase< T, BXVector< T > >
static edm::ParameterSetDescription baseDescriptions ()
 

Protected Attributes

const bool alwaysWriteBXValue_
 
const std::string bxVarName_
 
const StringCutObjectSelector< Tcut_
 
const int maxBX_
 
const unsigned int maxLen_
 
const int minBX_
 
- Protected Attributes inherited from SimpleFlatTableProducerBase< T, BXVector< T > >
const std::string doc_
 
const bool extension_
 
const std::string name_
 
const bool skipNonExistingSrc_
 
const edm::EDGetTokenT< BXVector< T > > 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
 
- Protected Types inherited from SimpleFlatTableProducerBase< T, BXVector< T > >
typedef FuncVariable< T, StringCutObjectSelector< T >, bool > BoolVar
 
typedef FuncVariable< T, StringObjectFunction< T >, double > DoubleVar
 
typedef FuncVariable< T, StringObjectFunction< T >, float > FloatVar
 
typedef FuncVariable< T, StringObjectFunction< T >, int16_t > Int16Var
 
typedef FuncVariable< T, StringObjectFunction< T >, int8_t > Int8Var
 
typedef FuncVariable< T, StringObjectFunction< T >, int32_t > IntVar
 
typedef FuncVariable< T, StringObjectFunction< T >, uint16_t > UInt16Var
 
typedef FuncVariable< T, StringObjectFunction< T >, uint8_t > UInt8Var
 
typedef FuncVariable< T, StringObjectFunction< T >, uint32_t > UIntVar
 

Detailed Description

template<typename T>
class BXVectorSimpleFlatTableProducer< T >

Definition at line 354 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

◆ BXVectorSimpleFlatTableProducer()

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

Definition at line 356 of file SimpleFlatTableProducer.h.

References BXVectorSimpleFlatTableProducer< T >::bxVarName_, Exception, spr::find(), edm::ParameterSet::getParameterNamesForType(), submitPVValidationJobs::params, and varNames.

358  maxLen_(params.existsAs<unsigned int>("maxLen") ? params.getParameter<unsigned int>("maxLen")
360  cut_(params.getParameter<std::string>("cut"), true),
361  minBX_(params.getParameter<int>("minBX")),
362  maxBX_(params.getParameter<int>("maxBX")),
363  alwaysWriteBXValue_(params.getParameter<bool>("alwaysWriteBXValue")),
364  bxVarName_("bx") {
365  edm::ParameterSet const &varsPSet = params.getParameter<edm::ParameterSet>("variables");
367  if (std::find(varNames.begin(), varNames.end(), bxVarName_) != varNames.end()) {
368  throw cms::Exception("Configuration",
369  "BXVectorSimpleFlatTableProducer already defines the " + bxVarName_ +
370  "internally and thus you should not specify it yourself");
371  }
372  }
constexpr char const * varNames[]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const StringCutObjectSelector< T > cut_
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179

Member Function Documentation

◆ fillDescriptions()

template<typename T >
static void BXVectorSimpleFlatTableProducer< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 374 of file SimpleFlatTableProducer.h.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), SimpleFlatTableProducerBase< T, BXVector< T > >::baseDescriptions(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

374  {
376  desc.add<std::string>("cut", "")->setComment(
377  "selection on the main input collection (but selection can not be bx based)");
378  desc.addOptional<unsigned int>("maxLen")->setComment(
379  "define the maximum length of the input collection to put in the branch");
380  desc.add<int>("minBX", -2)->setComment("min bx (inclusive) to include");
381  desc.add<int>("maxBX", 2)->setComment("max bx (inclusive) to include");
382  desc.add<bool>("alwaysWriteBXValue", true)
383  ->setComment("always write the bx number (event when only one bx can be present, ie minBX==maxBX)");
384  descriptions.addWithDefaultLabel(desc);
385  }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static edm::ParameterSetDescription baseDescriptions()

◆ fillTable()

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

Definition at line 387 of file SimpleFlatTableProducer.h.

References BXVectorSimpleFlatTableProducer< T >::alwaysWriteBXValue_, nano_mu_digi_cff::bx, BXVectorSimpleFlatTableProducer< T >::bxVarName_, BXVectorSimpleFlatTableProducer< T >::cut_, SimpleFlatTableProducerBase< T, BXVector< T > >::extension_, SiStripPI::max, hltL1TEGammaFilteredCollectionProducer_cfi::maxBX, BXVectorSimpleFlatTableProducer< T >::maxBX_, BXVectorSimpleFlatTableProducer< T >::maxLen_, SiStripPI::min, hltL1TEGammaFilteredCollectionProducer_cfi::minBX, BXVectorSimpleFlatTableProducer< T >::minBX_, SimpleFlatTableProducerBase< T, BXVector< T > >::name_, getGTfromDQMFile::obj, MillePedeFileConverter_cfg::out, dumpMFGeometry_cfg::prod, SimpleFlatTableProducerBase< T, BXVector< T > >::skipNonExistingSrc_, trigObjTnPSource_cfi::var, and SimpleFlatTableProducerBase< T, BXVector< T > >::vars_.

388  {
389  std::vector<const T *> selObjs;
390  std::vector<int> selObjBXs;
391 
392  if (prod.isValid() || !(this->skipNonExistingSrc_)) {
393  const int minBX = std::max(minBX_, prod->getFirstBX());
394  const int maxBX = std::min(maxBX_, prod->getLastBX());
395  for (int bx = minBX; bx <= maxBX; bx++) {
396  for (size_t objNr = 0, nrObjs = prod->size(bx); objNr < nrObjs; ++objNr) {
397  const auto &obj = prod->at(bx, objNr);
398  if (cut_(obj)) {
399  selObjs.push_back(&obj);
400  selObjBXs.push_back(bx);
401  }
402  if (selObjs.size() >= maxLen_)
403  break;
404  }
405  }
406  }
407  auto out = std::make_unique<nanoaod::FlatTable>(selObjs.size(), this->name_, false, this->extension_);
408  for (const auto &var : this->vars_)
409  var->fill(selObjs, *out);
410  if (alwaysWriteBXValue_ || minBX_ != maxBX_) {
411  out->template addColumn<int16_t>(bxVarName_, selObjBXs, "BX of the L1 candidate");
412  }
413  return out;
414  }
const StringCutObjectSelector< T > cut_
std::vector< std::unique_ptr< Variable< T > > > vars_

Member Data Documentation

◆ alwaysWriteBXValue_

template<typename T >
const bool BXVectorSimpleFlatTableProducer< T >::alwaysWriteBXValue_
protected

◆ bxVarName_

template<typename T >
const std::string BXVectorSimpleFlatTableProducer< T >::bxVarName_
protected

◆ cut_

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

◆ maxBX_

template<typename T >
const int BXVectorSimpleFlatTableProducer< T >::maxBX_
protected

◆ maxLen_

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

◆ minBX_

template<typename T >
const int BXVectorSimpleFlatTableProducer< T >::minBX_
protected