32 template <
typename ObjType>
39 template <
typename ObjType,
typename StringFunctor,
typename ValType>
49 std::vector<ValType> vals(selobjs.size());
50 for (
unsigned int i = 0,
n = vals.size();
i <
n; ++
i) {
51 if constexpr (std::is_same<ValType, float>()) {
70 template <
typename ObjType>
78 template <
typename ObjType,
typename TIn,
typename ValType = TIn>
91 std::vector<ValType> vals;
93 vals.resize(selptrs.size());
94 for (
unsigned int i = 0,
n = vals.size();
i <
n; ++
i) {
95 vals[
i] = (*vmap)[selptrs[
i]];
110 template <
typename T,
typename TProd>
125 vars_.push_back(std::make_unique<IntVar>(vname, varPSet));
126 else if (
type ==
"uint")
127 vars_.push_back(std::make_unique<UIntVar>(vname, varPSet));
128 else if (
type ==
"float")
129 vars_.push_back(std::make_unique<FloatVar>(vname, varPSet));
130 else if (
type ==
"int8")
131 vars_.push_back(std::make_unique<Int8Var>(vname, varPSet));
132 else if (
type ==
"uint8")
133 vars_.push_back(std::make_unique<UInt8Var>(vname, varPSet));
134 else if (
type ==
"bool")
135 vars_.push_back(std::make_unique<BoolVar>(vname, varPSet));
137 throw cms::Exception(
"Configuration",
"unsupported type " +
type +
" for variable " + vname);
140 produces<nanoaod::FlatTable>();
172 std::vector<std::unique_ptr<Variable<T>>>
vars_;
175 template <
typename T>
182 :
std::numeric_limits<unsigned
int>::
max()),
191 std::make_unique<IntExtVar>(vname, varPSet, this->consumesCollector(), this->
skipNonExistingSrc_));
192 else if (type ==
"float")
194 std::make_unique<FloatExtVar>(vname, varPSet, this->consumesCollector(), this->
skipNonExistingSrc_));
195 else if (type ==
"double")
197 std::make_unique<DoubleExtVar>(vname, varPSet, this->consumesCollector(), this->
skipNonExistingSrc_));
198 else if (type ==
"int8")
200 std::make_unique<Int8ExtVar>(vname, varPSet, this->consumesCollector(), this->
skipNonExistingSrc_));
201 else if (type ==
"uint8")
203 std::make_unique<UInt8ExtVar>(vname, varPSet, this->consumesCollector(), this->
skipNonExistingSrc_));
204 else if (type ==
"bool")
206 std::make_unique<BoolExtVar>(vname, varPSet, this->consumesCollector(), this->
skipNonExistingSrc_));
208 throw cms::Exception(
"Configuration",
"unsupported type " + type +
" for variable " + vname);
217 std::vector<const T *> selobjs;
218 std::vector<edm::Ptr<T>> selptrs;
222 selobjs.push_back(&(*
prod)[0]);
224 selptrs.emplace_back(
prod->ptrAt(0));
226 for (
unsigned int i = 0,
n =
prod->size();
i <
n; ++
i) {
227 const auto &
obj = (*prod)[
i];
229 selobjs.push_back(&
obj);
231 selptrs.emplace_back(
prod->ptrAt(
i));
242 var->fill(iEvent, selptrs, *
out);
257 std::vector<std::unique_ptr<ExtVariable<T>>>
extvars_;
260 template <
typename T>
268 auto out = std::make_unique<nanoaod::FlatTable>(1, this->
name_,
true, this->
extension_);
269 std::vector<const T *> selobjs(1,
prod.product());
276 template <
typename T>
286 auto out = std::make_unique<nanoaod::FlatTable>(1, this->
name_,
true, this->
extension_);
287 std::vector<const T *> selobjs(1, &(*
prod)[0]);
298 template <
typename T,
typename TProd>
300 :
public edm::one::EDProducer<edm::EndLuminosityBlockProducer, edm::LuminosityBlockCache<int>> {
315 vars_.push_back(std::make_unique<IntVar>(vname, varPSet));
316 else if (
type ==
"float")
317 vars_.push_back(std::make_unique<FloatVar>(vname, varPSet));
318 else if (
type ==
"uint8")
319 vars_.push_back(std::make_unique<UInt8Var>(vname, varPSet));
320 else if (
type ==
"bool")
321 vars_.push_back(std::make_unique<BoolVar>(vname, varPSet));
323 throw cms::Exception(
"Configuration",
"unsupported type " +
type +
" for variable " + vname);
326 produces<nanoaod::FlatTable, edm::Transition::EndLuminosityBlock>();
367 std::vector<std::unique_ptr<Variable<T>>>
vars_;
371 template <
typename T>
381 auto out = std::make_unique<nanoaod::FlatTable>(1, this->
name_,
true, this->
extension_);
382 std::vector<const T *> selobjs(1,
prod.product());
390 template <
typename T,
typename TProd>
396 :
std::numeric_limits<unsigned
int>::
max()),
403 std::vector<const T *> selobjs;
405 for (
unsigned int i = 0,
n = prod->size();
i <
n; ++
i) {
406 const auto &
obj = (*prod)[
i];
408 selobjs.push_back(&
obj);
414 auto out = std::make_unique<nanoaod::FlatTable>(selobjs.size(), this->
name_,
false, this->
extension_);
429 template <
typename T,
typename TProd>
445 vars_.push_back(std::make_unique<IntVar>(vname, varPSet));
446 else if (
type ==
"float")
447 vars_.push_back(std::make_unique<FloatVar>(vname, varPSet));
448 else if (
type ==
"uint8")
449 vars_.push_back(std::make_unique<UInt8Var>(vname, varPSet));
450 else if (
type ==
"bool")
451 vars_.push_back(std::make_unique<BoolVar>(vname, varPSet));
453 throw cms::Exception(
"Configuration",
"unsupported type " +
type +
" for variable " + vname);
456 produces<nanoaod::FlatTable, edm::Transition::EndRun>();
493 std::vector<std::unique_ptr<Variable<T>>>
vars_;
497 template <
typename T>
505 auto out = std::make_unique<nanoaod::FlatTable>(1, this->
name_,
true, this->
extension_);
506 std::vector<const T *> selobjs(1,
prod.product());
514 template <
typename T,
typename TProd>
520 :
std::numeric_limits<unsigned
int>::
max()),
526 std::vector<const T *> selobjs;
528 for (
unsigned int i = 0,
n = prod->size();
i <
n; ++
i) {
529 const auto &
obj = (*prod)[
i];
531 selobjs.push_back(&
obj);
537 auto out = std::make_unique<nanoaod::FlatTable>(selobjs.size(), this->
name_,
false, this->
extension_);
ValueMapVariable< T, double, float > DoubleExtVar
Variable(const std::string &aname, const edm::ParameterSet &cfg)
T getParameter(std::string const &) const
ValueMapVariable< T, bool > BoolExtVar
FuncVariable< T, StringObjectFunction< T >, int > IntVar
~SimpleFlatTableProducerBase() override
std::vector< std::unique_ptr< Variable< T > > > vars_
std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::LuminosityBlock &, const edm::Handle< T > &prod) const override
~RunSingletonSimpleFlatTableProducer() override
FuncVariable< T, StringCutObjectSelector< T >, bool > BoolVar
virtual void fill(const edm::Event &iEvent, std::vector< edm::Ptr< ObjType >> selptrs, nanoaod::FlatTable &out) const =0
std::shared_ptr< int > globalBeginRun(edm::Run const &, edm::EventSetup const &) const override
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
ValueMapVariable< T, int, uint8_t > UInt8ExtVar
const edm::EDGetTokenT< TProd > src_
FuncVariable< T, StringObjectFunction< T >, unsigned int > UIntVar
~FirstObjectSimpleFlatTableProducer() override
void globalEndRun(edm::Run const &, edm::EventSetup const &) override
const StringCutObjectSelector< T > cut_
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::Event &iEvent, const edm::Handle< edm::View< T >> &prod) const override
FuncVariable< T, StringObjectFunction< T >, uint8_t > UInt8Var
FuncVariable< T, StringCutObjectSelector< T >, bool > BoolVar
VariableBase(const std::string &aname, const edm::ParameterSet &cfg)
~LumiSimpleFlatTableProducer() override
const bool skipNonExistingSrc_
SimpleFlatTableProducerBase(edm::ParameterSet const ¶ms)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ValueMapVariable< T, int, int8_t > Int8ExtVar
virtual std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::Run &iRun, const edm::Handle< TProd > &prod) const =0
~LumiSingletonSimpleFlatTableProducer() override
std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::Event &, const edm::Handle< T > &prod) const override
FuncVariable< T, StringObjectFunction< T >, uint8_t > UInt8Var
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
~EventSingletonSimpleFlatTableProducer() override
std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::LuminosityBlock &iLumi, const edm::Handle< TProd > &prod) const override
const StringCutObjectSelector< T > cut_
void fill(const edm::Event &iEvent, std::vector< edm::Ptr< ObjType >> selptrs, nanoaod::FlatTable &out) const override
~SimpleFlatTableProducer() override
const bool skipNonExistingSrc_
const unsigned int maxLen_
FuncVariable< T, StringObjectFunction< T >, float > FloatVar
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
const unsigned int maxLen_
std::vector< std::unique_ptr< ExtVariable< T > > > extvars_
LumiSingletonSimpleFlatTableProducer(edm::ParameterSet const ¶ms)
RunSingletonSimpleFlatTableProducer(edm::ParameterSet const ¶ms)
edm::EDGetTokenT< edm::ValueMap< TIn > > token_
ExtVariable(const std::string &aname, const edm::ParameterSet &cfg)
SimpleFlatTableProducer(edm::ParameterSet const ¶ms)
std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::Run &iRun, const edm::Handle< TProd > &prod) const override
FuncVariable< T, StringObjectFunction< T >, int8_t > Int8Var
const unsigned int maxLen_
void endRunProduce(edm::Run &iRun, const edm::EventSetup &iSetup) final
const bool skipNonExistingSrc_
const edm::EDGetTokenT< TProd > src_
FuncVariable< T, StringObjectFunction< T >, float > FloatVar
~SimpleFlatTableProducerBaseLumi() override
void fill(std::vector< const ObjType *> &selobjs, nanoaod::FlatTable &out) const override
FuncVariable< T, StringObjectFunction< T >, int > IntVar
FuncVariable< T, StringObjectFunction< T >, int > IntVar
StringFunctor precisionFunc_
RunSimpleFlatTableProducer(edm::ParameterSet const ¶ms)
const std::string & name() const
SimpleFlatTableProducerBaseRun(edm::ParameterSet const ¶ms)
FuncVariable< T, StringObjectFunction< T >, uint8_t > UInt8Var
FuncVariable< T, StringObjectFunction< T >, float > FloatVar
SimpleFlatTableProducerBaseLumi(edm::ParameterSet const ¶ms)
virtual std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::Event &iEvent, const edm::Handle< TProd > &prod) const =0
std::vector< std::unique_ptr< Variable< T > > > vars_
std::shared_ptr< int > globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override
std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::Event &iEvent, const edm::Handle< edm::View< T >> &prod) const override
static float reduceMantissaToNbitsRounding(const float &f)
ValueMapVariable(const std::string &aname, const edm::ParameterSet &cfg, edm::ConsumesCollector &&cc, bool skipNonExistingSrc=false)
FirstObjectSimpleFlatTableProducer(edm::ParameterSet const ¶ms)
EventSingletonSimpleFlatTableProducer(edm::ParameterSet const ¶ms)
ValueMapVariable< T, float > FloatExtVar
FuncVariable(const std::string &aname, const edm::ParameterSet &cfg)
~RunSimpleFlatTableProducer() override
virtual void fill(std::vector< const ObjType *> &selobjs, nanoaod::FlatTable &out) const =0
const bool skipNonExistingSrc_
std::vector< std::unique_ptr< Variable< T > > > vars_
LumiSimpleFlatTableProducer(edm::ParameterSet const ¶ms)
std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::Run &, const edm::Handle< T > &prod) const override
void endLuminosityBlockProduce(edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) final
~SimpleFlatTableProducerBaseRun() override
const StringCutObjectSelector< T > cut_
FuncVariable< T, StringCutObjectSelector< T >, bool > BoolVar
virtual std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::LuminosityBlock &iLumi, const edm::Handle< TProd > &prod) const =0
const edm::EDGetTokenT< TProd > src_
ValueMapVariable< T, int > IntExtVar