23 vars_.push_back(std::make_unique<IntVar>(vname, varPSet, consumesCollector()));
24 else if (
type ==
"float")
25 vars_.push_back(std::make_unique<FloatVar>(vname, varPSet, consumesCollector()));
26 else if (
type ==
"double")
27 vars_.push_back(std::make_unique<DoubleVar>(vname, varPSet, consumesCollector()));
28 else if (
type ==
"bool")
29 vars_.push_back(std::make_unique<BoolVar>(vname, varPSet, consumesCollector()));
30 else if (
type ==
"candidatescalarsum")
31 vars_.push_back(std::make_unique<CandidateScalarSumVar>(vname, varPSet, consumesCollector()));
32 else if (
type ==
"candidatesize")
33 vars_.push_back(std::make_unique<CandidateSizeVar>(vname, varPSet, consumesCollector()));
34 else if (
type ==
"candidatesummass")
35 vars_.push_back(std::make_unique<CandidateSumMassVar>(vname, varPSet, consumesCollector()));
37 throw cms::Exception(
"Configuration",
"unsupported type " +
type +
" for variable " + vname);
40 produces<nanoaod::FlatTable>();
47 desc.add<
std::string>(
"name",
"")->setComment(
"name of the branch in the flat table output");
48 desc.add<
bool>(
"extension",
false)->setComment(
"whether or not to extend an existing same table");
51 "type",
"int",
true,
edm::Comment(
"the c++ type of the branch in the flat table")),
52 edm::allowedValues<std::string>(
53 "int",
"float",
"double",
"bool",
"candidatescalarsum",
"candidatesize",
"candidatesummass"));
55 variable.add<
std::string>(
"doc")->setComment(
"few words description of the branch content");
56 variable.add<
int>(
"precision", -1)->setComment(
"precision to store the information");
58 variables.setComment(
"a parameters set to define variable to fill the flat table");
66 auto out = std::make_unique<nanoaod::FlatTable>(1, this->
name_,
true, this->
extension_);
87 template <
typename ValType>
92 template <
typename ValType>
98 template <
typename ColType,
typename ValType>
103 for (
const auto&
i :
x)
109 template <
typename ColType,
typename ValType>
114 for (
const auto&
i :
x)
120 template <
typename ColType,
typename ValType>
125 for (
const auto&
i :
x)
130 template <
typename ColType,
typename ValType>
137 for (
const auto&
i :
x)
142 template <
typename ColType,
typename ValType>
150 for (
const auto&
i :
x)
156 template <
typename ValType,
typename ColType = ValType,
typename Converter = Identity<ValType>>
163 out.template addColumnValue<ColType>(
178 std::vector<std::unique_ptr<Variable>>
vars_;
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const std::string & name() const
T getParameter(std::string const &) const
bool get(ProductID const &oid, Handle< PROD > &result) const
uint32_t cc[maxCellsPerHit]
void fill(const edm::Event &iEvent, nanoaod::FlatTable &out) const override
static ColType convert(ValType x)
VariableT< edm::View< reco::Candidate >, int, Size< edm::View< reco::Candidate > > > CandidateSizeVar
virtual void fill(const edm::Event &iEvent, nanoaod::FlatTable &out) const =0
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
#define DEFINE_FWK_MODULE(type)
VariableT(const std::string &aname, const edm::ParameterSet &cfg, edm::ConsumesCollector &&cc)
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 void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static ColType convert(ValType x)
edm::EDGetTokenT< ValType > src_
VariableT< bool > BoolVar
VariableT< edm::View< reco::Candidate >, float, ScalarPtSum< float, edm::View< reco::Candidate > > > CandidateScalarSumVar
static int convert(ValType x)
GlobalVariablesTableProducer(edm::ParameterSet const ¶ms)
std::vector< std::unique_ptr< Variable > > vars_
Variable(const std::string &aname, const edm::ParameterSet &cfg)
VariableT< edm::View< reco::Candidate >, float, MassSum< float, edm::View< reco::Candidate > > > CandidateSumMassVar
VariableT< double, float > DoubleVar
VariableT< float > FloatVar