14 :
name_(params.existsAs<std::
string>(
"name") ? params.getParameter<std::
string>(
"name") :
""),
15 extension_(params.existsAs<bool>(
"extension") ? params.getParameter<bool>(
"extension") :
false) {
21 vars_.push_back(std::make_unique<IntVar>(vname, varPSet, consumesCollector()));
22 else if (type ==
"float")
23 vars_.push_back(std::make_unique<FloatVar>(vname, varPSet, consumesCollector()));
24 else if (type ==
"double")
25 vars_.push_back(std::make_unique<DoubleVar>(vname, varPSet, consumesCollector()));
26 else if (type ==
"bool")
27 vars_.push_back(std::make_unique<BoolVar>(vname, varPSet, consumesCollector()));
28 else if (type ==
"candidatescalarsum")
29 vars_.push_back(std::make_unique<CandidateScalarSumVar>(vname, varPSet, consumesCollector()));
30 else if (type ==
"candidatesize")
31 vars_.push_back(std::make_unique<CandidateSizeVar>(vname, varPSet, consumesCollector()));
32 else if (type ==
"candidatesummass")
33 vars_.push_back(std::make_unique<CandidateSumMassVar>(vname, varPSet, consumesCollector()));
35 throw cms::Exception(
"Configuration",
"unsupported type " + type +
" for variable " + vname);
38 produces<nanoaod::FlatTable>();
44 auto out = std::make_unique<nanoaod::FlatTable>(1, this->
name_,
true, this->
extension_);
64 template <
typename ValType>
69 template <
typename ValType>
72 static int convert(ValType
x) {
return x.size(); }
75 template <
typename ColType,
typename ValType>
80 for (
const auto&
i : x)
86 template <
typename ColType,
typename ValType>
91 for (
const auto&
i : x)
97 template <
typename ColType,
typename ValType>
102 for (
const auto&
i : x)
107 template <
typename ColType,
typename ValType>
114 for (
const auto&
i : x)
119 template <
typename ColType,
typename ValType>
127 for (
const auto&
i : x)
133 template <
typename ValType,
typename ColType = ValType,
typename Converter = Identity<ValType>>
154 std::vector<std::unique_ptr<Variable>>
vars_;
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
#define DEFINE_FWK_MODULE(type)
void fill(const edm::Event &iEvent, nanoaod::FlatTable &out) const override
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
virtual void fill(const edm::Event &iEvent, nanoaod::FlatTable &out) const =0
list var
if using global norm cols_to_minmax = ['t_delta', 't_hmaxNearP','t_emaxNearP', 't_hAnnular', 't_eAnnular','t_pt','t_nVtx','t_ieta','t_eHcal10', 't_eHcal30','t_rhoh','t_eHcal'] df[cols_to_minmax] = df[cols_to_minmax].apply(lambda x: (x - x.min()) / (x.max() - x.min()) if (x.max() - x.min() > 0) else 1.0/200.0)
bool get(ProductID const &oid, Handle< PROD > &result) const
VariableT(const std::string &aname, const edm::ParameterSet &cfg, edm::ConsumesCollector &&cc)
static ColType convert(ValType x)
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_
T getParameter(std::string const &) const
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