9 #include <boost/ptr_container/ptr_vector.hpp> 28 else throw cms::Exception(
"Configuration",
"unsupported type "+type+
" for variable "+vname);
31 produces<nanoaod::FlatTable>();
37 auto out = std::make_unique<nanoaod::FlatTable>(1, this->
name_,
true, this->
extension_);
57 template <
typename ValType>
63 template <
typename ValType>
66 static int convert(ValType
x){
return x.size();}
70 template <
typename ColType,
typename ValType>
75 for(
const auto &
i : x)
if(
i>v) v=
i;
79 template <
typename ColType,
typename ValType>
84 for(
const auto &
i : x)
if(
i<v) v=
i;
88 template <
typename ColType,
typename ValType>
93 for(
const auto &
i : x) v+=
i.pt();
97 template <
typename ColType,
typename ValType>
101 if(x.empty())
return 0;
103 for(
const auto &
i : x)
v+=
i.p4();
107 template <
typename ColType,
typename ValType>
111 if(x.empty())
return 0;
114 for(
const auto &
i : x)
v+=
i.p4();
121 template<
typename ValType,
typename ColType=ValType,
typename Converter=Identity<ValType> >
125 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
VariableT< edm::View< reco::Candidate >, int, Size< edm::View< reco::Candidate > > > CandidateSizeVar
static ColType convert(ValType x)
const std::string & name() const
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
#define DEFINE_FWK_MODULE(type)
const nanoaod::FlatTable::ColumnType & type() const
VariableT< edm::View< reco::Candidate >, float, ScalarPtSum< float, edm::View< reco::Candidate > > > CandidateScalarSumVar
nanoaod::FlatTable::ColumnType type_
VariableT< bool, uint8_t > BoolVar
static ColType convert(ValType x)
def convert(infile, ofile)
static ColType convert(ValType x)
VariableT< double, float > DoubleVar
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_
boost::ptr_vector< Variable > vars_
VariableT< edm::View< reco::Candidate >, float, MassSum< float, edm::View< reco::Candidate > > > CandidateSumMassVar
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< float > FloatVar