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

Constructor & Destructor Documentation

◆ BXVectorSimpleFlatTableProducer()

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

Definition at line 349 of file SimpleFlatTableProducer.h.

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

351  maxLen_(params.existsAs<unsigned int>("maxLen") ? params.getParameter<unsigned int>("maxLen")
353  cut_(params.getParameter<std::string>("cut"), true),
354  minBX_(params.getParameter<int>("minBX")),
355  maxBX_(params.getParameter<int>("maxBX")),
356  alwaysWriteBXValue_(params.getParameter<bool>("alwaysWriteBXValue")),
357  bxVarName_("bx") {
358  edm::ParameterSet const &varsPSet = params.getParameter<edm::ParameterSet>("variables");
360  if (std::find(varNames.begin(), varNames.end(), bxVarName_) != varNames.end()) {
361  throw cms::Exception("Configuration",
362  "BXVectorSimpleFlatTableProducer already defines the " + bxVarName_ +
363  "internally and thus you should not specify it yourself");
364  }
365  }
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:180

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 367 of file SimpleFlatTableProducer.h.

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

367  {
369  desc.add<std::string>("cut", "")->setComment(
370  "selection on the main input collection (but selection can not be bx based)");
371  desc.addOptional<unsigned int>("maxLen")->setComment(
372  "define the maximum length of the input collection to put in the branch");
373  desc.add<int>("minBX", -2)->setComment("min bx (inclusive) to include");
374  desc.add<int>("maxBX", 2)->setComment("max bx (inclusive) to include");
375  desc.add<bool>("alwaysWriteBXValue", true)
376  ->setComment("always write the bx number (event when only one bx can be present, ie minBX==maxBX)");
377  descriptions.addWithDefaultLabel(desc);
378  }
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 380 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_.

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