45 const std::vector<std::string>
names_;
49 std::vector<std::unique_ptr<const GBRForest> >
models_;
66 thresholds_(conf.getParameter<
std::vector<double> >(
"ModelThresholds")),
79 <<
"'ModelNames' size (" <<
names_.size() <<
") != 'ModelWeights' size (" <<
models_.size() <<
").\n";
83 <<
"'ModelWeights' size (" <<
models_.size() <<
") != 'ModelThresholds' size (" <<
thresholds_.size() <<
").\n";
89 produces<edm::ValueMap<float> >(
name);
103 event.getByToken(
rho_, rho);
104 if (!rho.isValid()) {
105 std::ostringstream os;
106 os <<
"Problem accessing rho collection for low-pT electrons" << std::endl;
126 std::vector<std::vector<float> >
output;
128 for (
unsigned int iname = 0; iname <
names_.size(); ++iname) {
129 output.emplace_back(nElectrons, -999.);
133 for (
unsigned int iele = 0; iele <
nElectrons; iele++) {
138 for (
unsigned int iname = 0; iname <
names_.size(); ++iname) {
143 for (
unsigned int iele = 0; iele <
nElectrons; iele++) {
148 const auto&
gsf = ele->
core()->gsfTrack();
153 for (
unsigned int iname = 0; iname <
names_.size(); ++iname) {
154 output[iname][iele] =
eval(
names_[iname], ele, *rho, unbiased, zfield.z());
160 for (
unsigned int iname = 0; iname <
names_.size(); ++iname) {
164 filler.
insert(patElectrons, output[iname].
begin(), output[iname].
end());
166 filler.
insert(electrons, output[iname].
begin(), output[iname].
end());
178 if (iter !=
names_.end()) {
180 std::vector<float>
inputs;
183 features.
set(*ele, rho);
184 inputs = features.
get();
190 return models_.at(index)->GetResponse(inputs.data());
192 throw cms::Exception(
"Unknown model name") <<
"'Name given: '" << name <<
"'. Check against configuration file.\n";
201 desc.
add<
bool>(
"usePAT",
false);
205 desc.
add<std::vector<std::string> >(
"ModelNames", std::vector<std::string>());
206 desc.
add<std::vector<std::string> >(
"ModelWeights", std::vector<std::string>());
207 desc.
add<std::vector<double> >(
"ModelThresholds", std::vector<double>());
208 desc.
add<
bool>(
"PassThrough",
false);
209 desc.
add<
double>(
"MinPtThreshold", 0.5);
210 desc.
add<
double>(
"MaxPtThreshold", 15.);
212 descriptions.
add(
"defaultLowPtGsfElectronID", desc);
const double minPtThreshold_
T getParameter(std::string const &) const
bool isElectronIDAvailable(const std::string &name) const
Returns true if a specific ID is available in this pat::Electron.
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
static void fillDescriptions(edm::ConfigurationDescriptions &)
const std::string version_
void insert(const H &h, I begin, I end)
edm::EDGetTokenT< reco::GsfElectronCollection > electrons_
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)
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_
edm::EDGetTokenT< pat::ElectronCollection > patElectrons_
float electronID(const std::string &name) const
Returns a specific electron ID associated to the pat::Electron given its name.
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.
double eval(const std::string &name, const edm::Ptr< reco::GsfElectron > &, double rho, float unbiased, float field_z) const
const edm::EDGetTokenT< double > rho_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
edm::EDGetTokenT< edm::ValueMap< float > > unbiased_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual GsfElectronCoreRef core() const
bool isUninitialized() const
void set(const reco::GsfElectronRef &ele, double rho)
std::vector< float > features_V1(reco::GsfElectron const &ele, float rho, float unbiased, float field_z)