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

Constructor & Destructor Documentation

◆ BXVectorSimpleFlatTableProducer()

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

Definition at line 492 of file SimpleFlatTableProducer.h.

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

494  maxLen_(params.existsAs<unsigned int>("maxLen") ? params.getParameter<unsigned int>("maxLen")
496  cut_(params.getParameter<std::string>("cut"), false),
497  minBX_(params.getParameter<int>("minBX")),
498  maxBX_(params.getParameter<int>("maxBX")),
499  alwaysWriteBXValue_(params.getParameter<bool>("alwaysWriteBXValue")),
500  bxVarName_("bx") {
501  edm::ParameterSet const &varsPSet = params.getParameter<edm::ParameterSet>("variables");
503  if (std::find(varNames.begin(), varNames.end(), bxVarName_) != varNames.end()) {
504  throw cms::Exception("Configuration",
505  "BXVectorSimpleFlatTableProducer already defines the " + bxVarName_ +
506  "internally and thus you should not specify it yourself");
507  }
508  }
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 510 of file SimpleFlatTableProducer.h.

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

510  {
512  desc.add<std::string>("cut", "")->setComment(
513  "selection on the main input collection (but selection can not be bx based)");
514  desc.addOptional<unsigned int>("maxLen")->setComment(
515  "define the maximum length of the input collection to put in the branch");
516  desc.add<int>("minBX", -2)->setComment("min bx (inclusive) to include");
517  desc.add<int>("maxBX", 2)->setComment("max bx (inclusive) to include");
518  desc.add<bool>("alwaysWriteBXValue", true)
519  ->setComment("always write the bx number (event when only one bx can be present, ie minBX==maxBX)");
520  descriptions.addWithDefaultLabel(desc);
521  }
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 523 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_.

524  {
525  std::vector<const T *> selObjs;
526  std::vector<int> selObjBXs;
527 
528  if (prod.isValid() || !(this->skipNonExistingSrc_)) {
529  const int minBX = std::max(minBX_, prod->getFirstBX());
530  const int maxBX = std::min(maxBX_, prod->getLastBX());
531  for (int bx = minBX; bx <= maxBX; bx++) {
532  for (size_t objNr = 0, nrObjs = prod->size(bx); objNr < nrObjs; ++objNr) {
533  const auto &obj = prod->at(bx, objNr);
534  if (cut_(obj)) {
535  selObjs.push_back(&obj);
536  selObjBXs.push_back(bx);
537  }
538  if (selObjs.size() >= maxLen_)
539  break;
540  }
541  }
542  }
543  auto out = std::make_unique<nanoaod::FlatTable>(selObjs.size(), this->name_, false, this->extension_);
544  for (const auto &var : this->vars_)
545  var->fill(selObjs, *out);
546  if (alwaysWriteBXValue_ || minBX_ != maxBX_) {
547  out->template addColumn<int16_t>(bxVarName_, selObjBXs, "BX of the L1 candidate");
548  }
549  return out;
550  }
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