File indexing completed on 2024-04-06 12:23:39
0001 #include <iostream>
0002
0003 #include "FWCore/Framework/interface/stream/EDAnalyzer.h"
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008
0009 #include "PhysicsTools/MVAComputer/interface/MVAComputerCache.h"
0010 #include "PhysicsTools/MVAComputer/interface/HelperMacros.h"
0011
0012 #include "PhysicsTools/MVAComputer/test/testMVAComputerEvaluate.h"
0013
0014
0015
0016
0017
0018
0019
0020 using namespace PhysicsTools;
0021
0022 class testMVAComputerEvaluate : public edm::stream::EDAnalyzer<> {
0023 public:
0024 explicit testMVAComputerEvaluate(const edm::ParameterSet& params);
0025
0026 virtual void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup);
0027
0028 private:
0029 edm::ESGetToken<PhysicsTools::Calibration::MVAComputerContainer, MVADemoRcd> mvaToken_;
0030 MVAComputerCache mvaComputer;
0031 };
0032
0033 testMVAComputerEvaluate::testMVAComputerEvaluate(const edm::ParameterSet& params) {}
0034
0035 void testMVAComputerEvaluate::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0036
0037
0038
0039
0040
0041 mvaComputer.update(&iSetup.getData(mvaToken_), "testMVA");
0042
0043 Variable::Value values[] = {Variable::Value("x", 1.0), Variable::Value("y", 1.5)};
0044
0045 double result = mvaComputer->eval(values, values + 2);
0046
0047
0048
0049
0050 edm::LogPrint("testMVAComputerEvaluate") << "mva.eval(x = 1.0, y = 1.5) = " << result;
0051 }
0052
0053
0054 DEFINE_FWK_MODULE(testMVAComputerEvaluate);
0055
0056
0057 MVA_COMPUTER_CONTAINER_IMPLEMENT(MVADemo);
0058
0059
0060