10 #include <boost/foreach.hpp>
43 : mva_(pset.getParameter<std::string>(
"computerName"),
44 pset.getParameter<std::string>(
"dbLabel"),
45 pset.getParameter<edm::
ParameterSet>(
"discriminantOptions")),
46 signalSrc_(pset.getParameter<edm::InputTag>(
"signalSrc")),
47 backgroundSrc_(pset.getParameter<edm::InputTag>(
"backgroundSrc")) {
50 if (pset.
exists(
"signalWeights")) {
55 if (pset.
exists(
"eventWeights")) {
66 bool isSignal,
double eventWeight) {
69 reco::tau::castView<reco::PFTauRefVector>(taus);
74 helper->
train(tau, isSignal, weight*eventWeight);
87 bool signalExists =
false;
89 if (signal.
isValid() && signal->size())
92 bool backgroundExists =
false;
94 if (background.
isValid() && background->size())
95 backgroundExists =
true;
98 bool somethingToDo = signalExists || backgroundExists;
106 double eventWeight = 1.0;
111 eventWeight *= *weightHandle;
123 uploadTrainingData(&
mva_, signal, signalWeights,
true, eventWeight);
124 if (backgroundExists)
125 uploadTrainingData(&
mva_, background, backgroundWeights,
T getParameter(std::string const &) const
void setEvent(const edm::Event &evt, const edm::EventSetup &es)
edm::InputTag signalWeightsSrc_
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< edm::InputTag > VInputTag
edm::InputTag backgroundSrc_
RecoTauMVATrainer(const edm::ParameterSet &pset)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual ~RecoTauMVATrainer()
virtual void analyze(const edm::Event &evt, const edm::EventSetup &es)
void train(const PFTauRef &tau, bool target, double weight=1.0) const
reco::tau::RecoTauMVAHelper mva_
edm::InputTag backgroundWeightsSrc_