20 #include <boost/assign/list_of.hpp>
32 #include "TMultiLayerPerceptron.h"
37 using boost::assign::list_of;
41 : fMaxNofTrainSamples(1500)
43 , fNofWrongLikeCorrect(0)
44 , fNofCorrectLikeWrong(0)
58 , fhAnnOutput_correct(nullptr)
59 , fhAnnOutput_wrong(nullptr)
60 , fhCumProb_correct(nullptr)
61 , fhCumProb_wrong(nullptr) {}
71 double PlaneAngle_last,
76 TMath::Sqrt(Momentum1.X() * Momentum1.X() + Momentum1.Y() * Momentum1.Y()
77 + Momentum1.Z() * Momentum1.Z());
79 TMath::Sqrt(Momentum2.X() * Momentum2.X() + Momentum2.Y() * Momentum2.Y()
80 + Momentum2.Z() * Momentum2.Z());
101 if (
IM_correct.size() % 100 == 0 && IdForANN == 1)
103 <<
"; wrong = " <<
IM_wrong.size() << endl;
127 TTree* simu =
new TTree(
"MonteCarlo",
"MontecarloData");
131 simu->Branch(
"x0", &
x[0],
"x0/D");
132 simu->Branch(
"x1", &
x[1],
"x1/D");
133 simu->Branch(
"x2", &
x[2],
"x2/D");
134 simu->Branch(
"x3", &
x[3],
"x3/D");
135 simu->Branch(
"x4", &
x[4],
"x4/D");
136 simu->Branch(
"x5", &
x[5],
"x5/D");
137 simu->Branch(
"xOut", &xOut,
"xOut/D");
147 if (
x[0] > 1.0)
x[0] = 1.0;
148 if (
x[1] > 1.0)
x[1] = 1.0;
149 if (
x[2] > 1.0)
x[2] = 1.0;
150 if (
x[3] > 1.0)
x[3] = 1.0;
151 if (
x[4] > 1.0)
x[4] = 1.0;
152 if (
x[5] > 1.0)
x[5] = 1.0;
166 if (
x[0] > 1.0)
x[0] = 1.0;
167 if (
x[1] > 1.0)
x[1] = 1.0;
168 if (
x[2] > 1.0)
x[2] = 1.0;
169 if (
x[3] > 1.0)
x[3] = 1.0;
170 if (
x[4] > 1.0)
x[4] = 1.0;
171 if (
x[5] > 1.0)
x[5] = 1.0;
178 TMultiLayerPerceptron network(
"x0,x1,x2,x3,x4,x5:12:xOut", simu,
"Entry$+1");
179 network.Train(300,
"text,update=10");
181 "../../../analysis/conversion2/KresAnalysis_ann_weights.txt");
196 if (params[0] > 1.0) params[0] = 1.0;
197 if (params[1] > 1.0) params[1] = 1.0;
198 if (params[2] > 1.0) params[2] = 1.0;
199 if (params[3] > 1.0) params[3] = 1.0;
200 if (params[4] > 1.0) params[4] = 1.0;
201 if (params[5] > 1.0) params[5] = 1.0;
203 Double_t netEval = network.Evaluate(0, params);
215 if (params[0] > 1.0) params[0] = 1.0;
216 if (params[1] > 1.0) params[1] = 1.0;
217 if (params[2] > 1.0) params[2] = 1.0;
218 if (params[3] > 1.0) params[3] = 1.0;
219 if (params[4] > 1.0) params[4] = 1.0;
220 if (params[5] > 1.0) params[5] = 1.0;
222 Double_t netEval = network.Evaluate(0, params);
230 cout <<
"nof correct pairs = " <<
IM_correct.size() << endl;
231 cout <<
"nof wrong pairs = " <<
IM_wrong.size() << endl;
236 <<
", correct lost eff = "
239 Double_t cumProbFake = 0.;
240 Double_t cumProbTrue = 0.;
254 new TCanvas(
"ann_correct_ann_output",
"ann_correct_ann_output", 400, 400);
255 c1->SetTitle(
"ann_correct_ann_output");
259 new TCanvas(
"ann_wrong_ann_output",
"ann_wrong_ann_output", 400, 400);
260 c2->SetTitle(
"ann_wrong_ann_output");
264 new TCanvas(
"ann_correct_cum_prob",
"ann_correct_cum_prob", 400, 400);
265 c3->SetTitle(
"ann_correct_cum_prob");
269 new TCanvas(
"ann_wrong_cum_prob",
"ann_wrong_cum_prob", 400, 400);
270 c4->SetTitle(
"ann_wrong_cum_prob");
278 "fhAnnOutput_correct",
"ANN output;ANN output;Counter", 100, -1.2, 1.2);
281 "fhAnnOutput_wrong",
"ANN output;ANN output;Counter", 100, -1.2, 1.2);
285 "ANN output;ANN output;Cumulative probability",
291 "ANN output;ANN output;Cumulative probability",