9 #include <boost/ptr_container/ptr_vector.hpp> 27 else throw cms::Exception(
"Configuration",
"unsupported type "+type+
" for variable "+vname);
30 produces<nanoaod::FlatTable>();
36 auto out = std::make_unique<nanoaod::FlatTable>(1,
"",
true);
56 template <
typename ValType>
62 template <
typename ValType>
65 static int convert(ValType
x){
return x.size();}
69 template <
typename ColType,
typename ValType>
74 for(
const auto &
i : x)
if(
i>v) v=
i;
78 template <
typename ColType,
typename ValType>
83 for(
const auto &
i : x)
if(
i<v) v=
i;
87 template <
typename ColType,
typename ValType>
92 for(
const auto &
i : x) v+=
i.pt();
96 template <
typename ColType,
typename ValType>
100 if(x.empty())
return 0;
102 for(
const auto &
i : x)
v+=
i.p4();
106 template <
typename ColType,
typename ValType>
110 if(x.empty())
return 0;
113 for(
const auto &
i : x)
v+=
i.p4();
120 template<
typename ValType,
typename ColType=ValType,
typename Converter=Identity<ValType> >
124 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