43 const std::vector<std::string>
names_;
47 std::vector<std::unique_ptr<const GBRForest> >
models_;
62 thresholds_(conf.getParameter<
std::vector<double> >(
"ModelThresholds")),
69 <<
"'ModelNames' size (" <<
names_.size() <<
") != 'ModelWeights' size (" <<
models_.size() <<
").\n";
73 <<
"'ModelWeights' size (" <<
models_.size() <<
") != 'ModelThresholds' size (" <<
thresholds_.size() <<
").\n";
79 produces<edm::ValueMap<float> >(
name);
93 event.getByToken(
rho_, rho);
95 std::ostringstream os;
96 os <<
"Problem accessing rho collection for low-pT electrons" << std::endl;
103 if (!electrons.isValid()) {
104 std::ostringstream os;
105 os <<
"Problem accessing low-pT electrons collection" << std::endl;
114 std::vector<std::vector<float> >
output;
115 for (
unsigned int iname = 0; iname <
names_.size(); ++iname) {
116 output.emplace_back(electrons->size(), -999.);
118 for (
unsigned int iele = 0; iele < electrons->size(); iele++) {
121 if (ele->core().
isNull()) {
124 const auto&
gsf = ele->core()->gsfTrack();
131 for (
unsigned int iname = 0; iname <
names_.size(); ++iname) {
132 output[iname][iele] =
eval(
names_[iname], ele, *rho, unbiased, zfield.z());
137 for (
unsigned int iname = 0; iname <
names_.size(); ++iname) {
140 filler.
insert(electrons, output[iname].
begin(), output[iname].
end());
151 if (iter !=
names_.end()) {
153 std::vector<float>
inputs;
156 features.
set(ele, rho);
157 inputs = features.
get();
163 return models_.at(index)->GetResponse(inputs.data());
165 throw cms::Exception(
"Unknown model name") <<
"'Name given: '" << name <<
"'. Check against configuration file.\n";
177 desc.
add<std::vector<std::string> >(
"ModelNames", std::vector<std::string>());
178 desc.
add<std::vector<std::string> >(
"ModelWeights", std::vector<std::string>());
179 desc.
add<std::vector<double> >(
"ModelThresholds", std::vector<double>());
180 desc.
add<
bool>(
"PassThrough",
false);
181 desc.
add<
double>(
"MinPtThreshold", 0.5);
182 desc.
add<
double>(
"MaxPtThreshold", 15.);
184 descriptions.
add(
"defaultLowPtGsfElectronID", desc);
const double minPtThreshold_
const edm::EDGetTokenT< edm::ValueMap< float > > unbiased_
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &)
double eval(const std::string &name, const reco::GsfElectronRef &, double rho, float unbiased, float field_z) const
const std::string version_
void insert(const H &h, I begin, I end)
def setup(process, global_tag, zero_tesla=False)
std::vector< float > get()
const std::vector< double > thresholds_
const std::vector< std::string > names_
std::vector< std::unique_ptr< const GBRForest > > models_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
const edm::EDGetTokenT< reco::GsfElectronCollection > electrons_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
LowPtGsfElectronIDProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
const double maxPtThreshold_
std::vector< float > features_V0(reco::GsfElectron const &ele, float rho, float unbiased)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isNull() const
Checks for null.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
const edm::EDGetTokenT< double > rho_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void set(const reco::GsfElectronRef &ele, double rho)
std::vector< float > features_V1(reco::GsfElectron const &ele, float rho, float unbiased, float field_z)