49 y = scRef->clustersSize();
51 bool pass(
float absEtaMin,
float absEtaMax,
size_t nrClusMin,
size_t nrClusMax)
const {
52 return x >= absEtaMin && x < absEtaMax && y >= nrClusMin &&
y <= nrClusMax;
63 y = scRef->clustersSize();
66 bool pass(
float absEtaMin,
float absEtaMax,
size_t nrClusMin,
size_t nrClusMax,
float phiMin,
float phiMax)
const {
67 return x >= absEtaMin && x < absEtaMax && y >= nrClusMin && y <= nrClusMax && z >= phiMin &&
z <
phiMax;
79 y = scRef->clustersSize();
80 z = scRef->energy() *
sin(scRef->position().Theta());
82 bool pass(
float absEtaMin,
float absEtaMax,
size_t nrClusMin,
size_t nrClusMax,
float etMin,
float etMax)
const {
83 return x >= absEtaMin && x < absEtaMax && y >= nrClusMin && y <= nrClusMax && z >= etMin &&
z < etMax;
91 template <
typename ParamType,
bool = true>
98 for (
size_t paraNr = 0; paraNr < params.size(); paraNr++) {
99 func_.SetParameter(paraNr, params[paraNr]);
104 template <
typename ParamType>
111 template <
typename ParamType,
bool = true>
118 for (
size_t paraNr = 0; paraNr < params.size(); paraNr++) {
119 func_.SetParameter(paraNr, params[paraNr]);
124 template <
typename ParamType>
131 template <
typename ParamType,
bool = true>
138 for (
size_t paraNr = 0; paraNr < params.size(); paraNr++) {
139 func_.SetParameter(paraNr, params[paraNr]);
144 template <
typename ParamType>
153 template <
typename T>
168 template <
typename T>
172 template <
typename T>
176 template <
typename T>
180 template <
typename T>
184 template <
typename T>
188 template <
typename T>
193 template <
typename InputType>
204 size_t pos = inStr.find(
":=");
205 if (pos != std::string::npos)
206 return std::make_pair(inStr.substr(0, pos), inStr.substr(pos + 2));
210 template <
typename ParamType>
213 auto funcParams = config.
getParameter<std::vector<double>>(
"funcParams");
214 if (
funcType.first ==
"TF1" && has1D<ParamType>(0))
215 return TF1Wrap<ParamType, has1D<ParamType>(0)>(
funcType.second, funcParams);
216 else if (
funcType.first ==
"TF2" && has2D<ParamType>(0))
217 return TF2Wrap<ParamType, has2D<ParamType>(0)>(
funcType.second, funcParams);
218 else if (
funcType.first ==
"TF3" && has3D<ParamType>(0))
219 return TF3Wrap<ParamType, has3D<ParamType>(0)>(
funcType.second, funcParams);
222 <<
" is not recognised or is imcompatable with the ParamType, "
223 "configuration is invalid and needs to be fixed"
228 template <
typename InputType,
typename ParamType>
233 std::function<float(const ParamType&)>
func_;
245 return func_(ParamType(input));
249 template <
typename InputType,
typename ParamType>
256 std::function<float(const ParamType&)>
func_;
271 return func_(ParamType(input));
275 template <
typename InputType,
typename ParamType>
284 std::function<float(const ParamType&)>
func_;
303 return func_(ParamType(input));
307 template <
typename InputType>
309 std::vector<std::unique_ptr<ParamBin<InputType>>>
bins_;
313 std::vector<edm::ParameterSet> binConfigs = config.
getParameter<std::vector<edm::ParameterSet>>(
"bins");
314 for (
auto& binConfig : binConfigs)
319 if (
bin->pass(input))
328 if (type ==
"AbsEtaClus")
329 return std::make_unique<ParamBin2D<InputType, AbsEtaNrClus>>(
config);
330 else if (type ==
"AbsEtaClusPhi")
331 return std::make_unique<ParamBin3D<InputType, AbsEtaNrClusPhi>>(
config);
332 else if (type ==
"AbsEtaClusEt")
333 return std::make_unique<ParamBin3D<InputType, AbsEtaNrClusEt>>(
config);
336 <<
" type " << type <<
" is not recognised, configuration is invalid and needs to be fixed" << std::endl;
float operator()(const InputType &input) const override
decltype(ParamType::x) XType
constexpr auto has2D(int) -> decltype(T::y, bool())
constexpr auto has1D(int) -> decltype(T::x, bool())
decltype(ParamType::x) XType
std::function< float(const ParamType &)> func_
ParamBin2D(const edm::ParameterSet &config)
bool pass(float absEtaMin, float absEtaMax, size_t nrClusMin, size_t nrClusMax, float etMin, float etMax) const
Sin< T >::type sin(const T &t)
AbsEtaNrClusPhi(const reco::ElectronSeed &seed)
const CaloClusterRef & caloCluster() const
TF2Wrap(const std::string &funcExpr, const std::vector< double > ¶ms)
float operator()(const ParamType &obj)
bool pass(float absEtaMin, float absEtaMax, size_t nrClusMin, size_t nrClusMax, float phiMin, float phiMax) const
virtual bool pass(const InputType &) const =0
float operator()(const InputType &input) const override
static std::string const input
constexpr auto has3D(int) -> decltype(T::z, bool())
Param(const edm::ParameterSet &config)
AbsEtaNrClus(const reco::ElectronSeed &seed)
ParamBin1D(const edm::ParameterSet &config)
std::function< float(const ParamType &)> func_
static std::function< float(const ParamType &)> makeFunc(const edm::ParameterSet &config)
TF1Wrap(const std::string &funcExpr, const std::vector< double > ¶ms)
bool pass(const InputType &input) const override
float operator()(const ParamType &obj)
Abs< T >::type abs(const T &t)
float operator()(const ParamType &obj)
float operator()(const InputType &input) const override
std::unique_ptr< ParamBin< InputType > > createParamBin_(const edm::ParameterSet &config)
bool pass(const InputType &input) const override
TF1Wrap(const std::string &funcExpr, const std::vector< double > ¶ms)
AbsEtaNrClusEt(const reco::ElectronSeed &seed)
decltype(ParamType::y) YType
TF3Wrap(const std::string &funcExpr, const std::vector< double > ¶ms)
T getParameter(std::string const &) const
bool pass(const InputType &input) const override
float operator()(const InputType &input) const
tuple config
parse the configuration file
decltype(ParamType::z) ZType
std::function< float(const ParamType &)> func_
TF3Wrap(const std::string &funcExpr, const std::vector< double > ¶ms)
static std::pair< std::string, std::string > readFuncStr(const std::string &inStr)
std::vector< std::unique_ptr< ParamBin< InputType > > > bins_
decltype(ParamType::y) YType
bool pass(float absEtaMin, float absEtaMax, size_t nrClusMin, size_t nrClusMax) const
float operator()(const ParamType &obj)
decltype(ParamType::x) XType
ParamBin3D(const edm::ParameterSet &config)
virtual float operator()(const InputType &) const =0
float operator()(const ParamType &obj)
float operator()(const ParamType &obj)
TF2Wrap(const std::string &funcExpr, const std::vector< double > ¶ms)