9 #include <boost/ptr_container/ptr_vector.hpp> 20 else if (type ==
"float")
22 else if (type ==
"double")
24 else if (type ==
"bool")
26 else if (type ==
"candidatescalarsum")
29 else if (type ==
"candidatesize")
31 else if (type ==
"candidatesummass")
34 throw cms::Exception(
"Configuration",
"unsupported type " + type +
" for variable " + vname);
37 produces<nanoaod::FlatTable>();
43 auto out = std::make_unique<nanoaod::FlatTable>(1,
"",
true);
65 template <
typename ValType>
70 template <
typename ValType>
73 static int convert(ValType
x) {
return x.size(); }
76 template <
typename ColType,
typename ValType>
81 for (
const auto&
i : x)
87 template <
typename ColType,
typename ValType>
92 for (
const auto&
i : x)
98 template <
typename ColType,
typename ValType>
103 for (
const auto&
i : x)
108 template <
typename ColType,
typename ValType>
115 for (
const auto&
i : x)
120 template <
typename ColType,
typename ValType>
128 for (
const auto&
i : x)
134 template <
typename ValType,
typename ColType = ValType,
typename Converter = Identity<ValType>>
141 :
Variable(aname, atype, cfg), src_(cc.consumes<ValType>(cfg.getParameter<
edm::
InputTag>(
"src"))) {}
T getParameter(std::string const &) const
VariableT(const std::string &aname, nanoaod::FlatTable::ColumnType atype, const edm::ParameterSet &cfg, edm::ConsumesCollector &&cc)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void fill(const edm::Event &iEvent, nanoaod::FlatTable &out) const override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static ColType convert(ValType x)
const std::string & name() const
VariableT< edm::View< reco::Candidate >, int, Size< edm::View< reco::Candidate > > > CandidateSizeVar
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
#define DEFINE_FWK_MODULE(type)
const nanoaod::FlatTable::ColumnType & type() const
nanoaod::FlatTable::ColumnType type_
static ColType convert(ValType x)
def convert(infile, ofile)
static ColType convert(ValType x)
static ValType convert(ValType x)
static ColType convert(ValType x)
~GlobalVariablesTableProducer() override
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
static ColType convert(ValType x)
edm::EDGetTokenT< ValType > src_
VariableT< edm::View< reco::Candidate >, float, ScalarPtSum< float, edm::View< reco::Candidate > > > CandidateScalarSumVar
boost::ptr_vector< Variable > vars_
static int convert(ValType x)
Variable(const std::string &aname, nanoaod::FlatTable::ColumnType atype, const edm::ParameterSet &cfg)
GlobalVariablesTableProducer(edm::ParameterSet const ¶ms)
virtual void fill(const edm::Event &iEvent, nanoaod::FlatTable &out) const =0
VariableT< bool, uint8_t > BoolVar
VariableT< edm::View< reco::Candidate >, float, MassSum< float, edm::View< reco::Candidate > > > CandidateSumMassVar
VariableT< double, float > DoubleVar
VariableT< float > FloatVar