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

Constructor & Destructor Documentation

◆ BXVectorSimpleFlatTableProducer()

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

Definition at line 481 of file SimpleFlatTableProducer.h.

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

483  maxLen_(params.existsAs<unsigned int>("maxLen") ? params.getParameter<unsigned int>("maxLen")
485  cut_(params.getParameter<std::string>("cut"), true),
486  minBX_(params.getParameter<int>("minBX")),
487  maxBX_(params.getParameter<int>("maxBX")),
488  alwaysWriteBXValue_(params.getParameter<bool>("alwaysWriteBXValue")),
489  bxVarName_("bx") {
490  edm::ParameterSet const &varsPSet = params.getParameter<edm::ParameterSet>("variables");
492  if (std::find(varNames.begin(), varNames.end(), bxVarName_) != varNames.end()) {
493  throw cms::Exception("Configuration",
494  "BXVectorSimpleFlatTableProducer already defines the " + bxVarName_ +
495  "internally and thus you should not specify it yourself");
496  }
497  }
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 499 of file SimpleFlatTableProducer.h.

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

499  {
501  desc.add<std::string>("cut", "")->setComment(
502  "selection on the main input collection (but selection can not be bx based)");
503  desc.addOptional<unsigned int>("maxLen")->setComment(
504  "define the maximum length of the input collection to put in the branch");
505  desc.add<int>("minBX", -2)->setComment("min bx (inclusive) to include");
506  desc.add<int>("maxBX", 2)->setComment("max bx (inclusive) to include");
507  desc.add<bool>("alwaysWriteBXValue", true)
508  ->setComment("always write the bx number (event when only one bx can be present, ie minBX==maxBX)");
509  descriptions.addWithDefaultLabel(desc);
510  }
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 512 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_.

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