CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Protected Types | Protected Attributes
SimpleFlatTableProducer< T > Class Template Reference
Inheritance diagram for SimpleFlatTableProducer< T >:
SimpleFlatTableProducerBase< T, edm::View< T > > edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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 Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

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
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Types

typedef ValueMapVariable< bool, uint8_t > 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 >, uint8_t > 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_
 
boost::ptr_vector< ExtVariableextvars_
 
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_
 
boost::ptr_vector< Variable > vars_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<typename T>
class SimpleFlatTableProducer< T >

Definition at line 106 of file SimpleFlatTableProducer.cc.

Member Typedef Documentation

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

Definition at line 108 of file SimpleFlatTableProducer.cc.

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

Definition at line 187 of file SimpleFlatTableProducer.cc.

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

Definition at line 186 of file SimpleFlatTableProducer.cc.

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

Definition at line 185 of file SimpleFlatTableProducer.cc.

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

Definition at line 184 of file SimpleFlatTableProducer.cc.

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

Definition at line 188 of file SimpleFlatTableProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 110 of file SimpleFlatTableProducer.cc.

References nanoaod::FlatTable::BoolColumn, edm::EDConsumerBase::consumesCollector(), Exception, edm::ParameterSet::existsAs(), nanoaod::FlatTable::FloatColumn, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), nanoaod::FlatTable::IntColumn, AlCaHLTBitMon_QueryRunRegistry::string, and nanoaod::FlatTable::UInt8Column.

110  :
112  singleton_(params.getParameter<bool>("singleton")),
113  maxLen_(params.existsAs<unsigned int>("maxLen") ? params.getParameter<unsigned int>("maxLen") : std::numeric_limits<unsigned int>::max()),
114  cut_(!singleton_ ? params.getParameter<std::string>("cut") : "", true)
115  {
116  if (params.existsAs<edm::ParameterSet>("externalVariables")) {
117  edm::ParameterSet const & extvarsPSet = params.getParameter<edm::ParameterSet>("externalVariables");
118  for (const std::string & vname : extvarsPSet.getParameterNamesForType<edm::ParameterSet>()) {
119  const auto & varPSet = extvarsPSet.getParameter<edm::ParameterSet>(vname);
120  const std::string & type = varPSet.getParameter<std::string>("type");
121  if (type == "int") extvars_.push_back(new IntExtVar(vname, nanoaod::FlatTable::IntColumn, varPSet, this->consumesCollector()));
122  else if (type == "float") extvars_.push_back(new FloatExtVar(vname, nanoaod::FlatTable::FloatColumn, varPSet, this->consumesCollector()));
123  else if (type == "double") extvars_.push_back(new DoubleExtVar(vname, nanoaod::FlatTable::FloatColumn, varPSet, this->consumesCollector()));
124  else if (type == "uint8") extvars_.push_back(new UInt8ExtVar(vname, nanoaod::FlatTable::UInt8Column, varPSet, this->consumesCollector()));
125  else if (type == "bool") extvars_.push_back(new BoolExtVar(vname, nanoaod::FlatTable::BoolColumn, varPSet, this->consumesCollector()));
126  else throw cms::Exception("Configuration", "unsupported type "+type+" for variable "+vname);
127  }
128  }
129  }
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
ValueMapVariable< int > IntExtVar
ValueMapVariable< float > FloatExtVar
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:194
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
ValueMapVariable< bool, uint8_t > BoolExtVar
boost::ptr_vector< ExtVariable > extvars_
ValueMapVariable< double, float > DoubleExtVar
const StringCutObjectSelector< T > cut_
ValueMapVariable< int, uint8_t > UInt8ExtVar
template<typename T >
SimpleFlatTableProducer< T >::~SimpleFlatTableProducer ( )
inlineoverride

Definition at line 131 of file SimpleFlatTableProducer.cc.

131 {}

Member Function Documentation

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 133 of file SimpleFlatTableProducer.cc.

References SimpleFlatTableProducerBase< T, TProd >::extension_, mps_fire::i, gen::n, SimpleFlatTableProducerBase< T, TProd >::VariableBase::name_, NewMuonAssociatorByHits_cfi::obj, MillePedeFileConverter_cfg::out, parseEventContent::prod, JetChargeProducer_cfi::var, and SimpleFlatTableProducerBase< T, TProd >::vars_.

133  {
134  std::vector<const T *> selobjs;
135  std::vector<edm::Ptr<T>> selptrs; // for external variables
136  if (singleton_) {
137  assert(prod->size() == 1);
138  selobjs.push_back(& (*prod)[0] );
139  if (!extvars_.empty()) selptrs.emplace_back(prod->ptrAt(0));
140  } else {
141  for (unsigned int i = 0, n = prod->size(); i < n; ++i) {
142  const auto & obj = (*prod)[i];
143  if (cut_(obj)) {
144  selobjs.push_back(&obj);
145  if (!extvars_.empty()) selptrs.emplace_back(prod->ptrAt(i));
146  }
147  if(selobjs.size()>=maxLen_) break;
148  }
149  }
150  auto out = std::make_unique<nanoaod::FlatTable>(selobjs.size(), this->name_, singleton_, this->extension_);
151  for (const auto & var : this->vars_) var.fill(selobjs, *out);
152  for (const auto & var : this->extvars_) var.fill(iEvent, selptrs, *out);
153  return out;
154  }
boost::ptr_vector< ExtVariable > extvars_
const StringCutObjectSelector< T > cut_

Member Data Documentation

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

Definition at line 159 of file SimpleFlatTableProducer.cc.

template<typename T >
boost::ptr_vector<ExtVariable> SimpleFlatTableProducer< T >::extvars_
protected

Definition at line 189 of file SimpleFlatTableProducer.cc.

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

Definition at line 158 of file SimpleFlatTableProducer.cc.

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

Definition at line 157 of file SimpleFlatTableProducer.cc.