113 {
114
115 double bweight=1;
116 double cweight=1.;
117 double lweight=1;
118
119 gROOT->SetStyle("Plain");
120
121 cout << "starting with settings: " << endl;
122 cout << " nIterations: " << nIterations << endl;
123 cout << " dilutionFactor: " << dilutionFactor << endl;
124 cout << " nodesFirstLayer: " << nodesFirstLayer << endl;
125 cout << " nodesSecondLayer: " << nodesSecondLayer << endl;
126
127
128
129
130 TChain *myChain = new TChain("Validation/NNinput");
131
132
133if(!useTrackEstimate){
134 #include "../files.txt"
135}
136
137if(useTrackEstimate){
138 #include "../filesOnTrack.txt"
139}
140 TChain* simu=myChain;
141
142 std::cout << " Training sample obtained... " << std::endl;
143
144 vector<int> *NN_sizeX;
145 vector<int> *NN_sizeY;
146 vector<vector<float> > *NN_matrixOfToT;
147 vector<vector<float> > *NN_vectorOfPitchesY;
148 vector<int> *NN_ClusterPixLayer;
149 vector<int> *NN_ClusterPixBarrelEC;
150 vector<float> *NN_phiBS;
151 vector<float> *NN_thetaBS;
152 vector<float> *NN_etaModule;
153 vector<bool> *NN_useTrackInfo;
154 vector<int> *NN_columnWeightedPosition;
155 vector<int> *NN_rowWeightedPosition;
156 vector<vector<float> > *NN_positionX;
157 vector<vector<float> > *NN_positionY;
158 vector<vector<float> > *NN_position_idX;
159 vector<vector<float> > *NN_position_idY;
160 vector<vector<float> > *NN_theta;
161 vector<vector<float> > *NN_phi;
162
163
164 TBranch *b_NN_sizeX;
165 TBranch *b_NN_sizeY;
166 TBranch *b_NN_matrixOfToT;
167 TBranch *b_NN_vectorOfPitchesY;
168 TBranch *b_NN_ClusterPixLayer;
169 TBranch *b_NN_ClusterPixBarrelEC;
170 TBranch *b_NN_phiBS;
171 TBranch *b_NN_thetaBS;
172 TBranch *b_NN_etaModule;
173 TBranch *b_NN_useTrackInfo;
174 TBranch *b_NN_columnWeightedPosition;
175 TBranch *b_NN_rowWeightedPosition;
176 TBranch *b_NN_positionX;
177 TBranch *b_NN_positionY;
178 TBranch *b_NN_position_idX;
179 TBranch *b_NN_position_idY;
180 TBranch *b_NN_theta;
181 TBranch *b_NN_phi;
182
183
184
185 NN_sizeX = 0;
186 NN_sizeY = 0;
187 NN_matrixOfToT = 0;
188 NN_vectorOfPitchesY = 0;
189 NN_ClusterPixLayer = 0;
190 NN_ClusterPixBarrelEC = 0;
191 NN_phiBS = 0;
192 NN_thetaBS = 0;
193 NN_etaModule = 0;
194 NN_useTrackInfo = 0;
195 NN_columnWeightedPosition = 0;
196 NN_rowWeightedPosition = 0;
197 NN_positionX = 0;
198 NN_positionY = 0;
199 NN_position_idX = 0;
200 NN_position_idY = 0;
201 NN_theta = 0;
202 NN_phi = 0;
203
204
205
206
207 simu->SetMakeClass(1);
208
209 simu->SetBranchAddress("NN_sizeX", &NN_sizeX, &b_NN_sizeX);
210 simu->SetBranchAddress("NN_sizeY", &NN_sizeY, &b_NN_sizeY);
211 simu->SetBranchAddress("NN_matrixOfToT", &NN_matrixOfToT, &b_NN_matrixOfToT);
212 simu->SetBranchAddress("NN_vectorOfPitchesY", &NN_vectorOfPitchesY, &b_NN_vectorOfPitchesY);
213 simu->SetBranchAddress("NN_ClusterPixLayer", &NN_ClusterPixLayer, &b_NN_ClusterPixLayer);
214 simu->SetBranchAddress("NN_ClusterPixBarrelEC", &NN_ClusterPixBarrelEC, &b_NN_ClusterPixBarrelEC);
215 simu->SetBranchAddress("NN_phiBS", &NN_phiBS, &b_NN_phiBS);
216 simu->SetBranchAddress("NN_thetaBS", &NN_thetaBS, &b_NN_thetaBS);
217 simu->SetBranchAddress("NN_etaModule", &NN_etaModule, &b_NN_etaModule);
218 simu->SetBranchAddress("NN_useTrackInfo", &NN_useTrackInfo, &b_NN_useTrackInfo);
219 simu->SetBranchAddress("NN_columnWeightedPosition", &NN_columnWeightedPosition, &b_NN_columnWeightedPosition);
220 simu->SetBranchAddress("NN_rowWeightedPosition", &NN_rowWeightedPosition, &b_NN_rowWeightedPosition);
221 simu->SetBranchAddress("NN_positionX", &NN_positionX, &b_NN_positionX);
222 simu->SetBranchAddress("NN_positionY", &NN_positionY, &b_NN_positionY);
223 simu->SetBranchAddress("NN_position_idX", &NN_position_idX, &b_NN_position_idX);
224 simu->SetBranchAddress("NN_position_idY", &NN_position_idY, &b_NN_position_idY);
225 simu->SetBranchAddress("NN_theta", &NN_theta, &b_NN_theta);
226 simu->SetBranchAddress("NN_phi", &NN_phi, &b_NN_phi);
227
228
229 cout << "Branches set..." << endl;
230
231 TString filterTrain("Entry$%");
232 filterTrain+=dilutionFactor;
233 filterTrain+="==0";
234
235 TString filterTest("Entry$%");
236 filterTest+=dilutionFactor;
237 filterTest+="==1";
238
239 int* nneurons;
240 int nlayer=3;
241
242 simu->GetEntry(0);
243
244
245 cout << "First entry..." << endl;
246
247 Int_t sizeX=-7;
248 Int_t sizeY=-7;
249
250
251
252 for( unsigned int clus =0; clus<NN_sizeX->size(); clus++ ){
253
254 sizeX = (*NN_sizeX)[clus];
255 sizeY = (*NN_sizeY)[clus];
256
257 if(sizeX>0)break;
258
259 }
260
261 cout << "Size obtained" << endl;
262
263
264 int numberinputs=sizeX*(sizeY+1)+4;
265 if (!useTrackEstimate)
266 {
267 numberinputs=sizeX*(sizeY+1)+5;
268 }
269
270 int numberoutputs=2*nParticlesTraining;
271
272 if (nodesSecondLayer!=0)
273 {
274 nlayer=4;
275 }
276
277 if (nodesSecondLayer!=0)
278 {
279 nneurons=new int[4];
280 }
281 else
282 {
283 nneurons=new int[3];
284 }
285
286 nneurons[0]=numberinputs;
287
288 nneurons[1]=nodesFirstLayer;
289
290 if (nodesSecondLayer!=0)
291 {
292 nneurons[2]=nodesSecondLayer;
293 nneurons[3]=numberoutputs;
294 }
295 else
296 {
297 nneurons[2]=numberoutputs;
298 }
299
300 for (
int i=0;
i<nlayer;
i++)
301 {
302 cout <<
" layer i: " <<
i <<
" number neurons: " << nneurons[
i] << endl;
303 }
304
305
306
307 float trainingError(0);
308 float testError(0);
309
310
311
312 cout << " now providing training events " << endl;
313
314 Int_t numberTrainingEvents=0;
315 Int_t numberTestingEvents=0;
316
317 int iClus=0;
318 int part_0=0;
319 int part_1=0;
320 int part_2=0;
321 int part_3=0;
322
323 int totalN=simu->GetEntries();
324
325
326
327
328 for (Int_t i = 0;
i < totalN;
i++) {
329
330 if (i % 50000 == 0 ) {
331 std::cout <<
" Counting training / testing events in sample. Looping over event " <<
i << std::endl;
332 }
333
334 simu->GetEntry(i);
335
336 for( unsigned int clus =0; clus<NN_sizeX->size(); clus++ ){
337
338 vector<float> *matrixOfToT=0;
339 vector<float> *vectorOfPitchesY=0;
340
341 Float_t phiBS;
342 Float_t thetaBS;
343 Float_t etaModule;
344 Int_t ClusterPixLayer;
345 Int_t ClusterPixBarrelEC;
346
347 std::vector<float> * positionX=0;
348 std::vector<float> * positionY=0;
349 std::vector<float> * thetaTr=0;
350 std::vector<float> * phiTr=0;
351
352 std::vector<float> positionX_reorder;
353 std::vector<float> positionY_reorder;
354
355
356 sizeX = (*NN_sizeX)[clus];
357 positionX =&(*NN_positionX)[clus];
358 int nParticles = positionX->size();
359
360 thetaTr = &(*NN_theta)[clus];
361 phiTr = &(*NN_phi)[clus];
362
363 if (nParticlesTraining!=nParticles)
364 {
365 continue;
366 }
368
369
370 for(
unsigned int P = 0;
P < positionX->size();
P++){
371 double theta = (*thetaTr)[
P];
373
374 iClus++;
375
377
378
379
380 if (iClus%dilutionFactor==0) numberTrainingEvents+=1;
381 if (iClus%dilutionFactor==1) numberTestingEvents+=1;
382
383 if (iClus%dilutionFactor==1 && nParticles==1 ) part_1++;
384 if (iClus%dilutionFactor==1 && nParticles==2 ) part_2++;
385 if (iClus%dilutionFactor==1 && nParticles==3 ) part_3++;
386
387
388
389 }
390 }
391 }
392
393
394
395 cout << " N. training events: " << numberTrainingEvents <<
396 " N. testing events: " << numberTestingEvents << endl;
397
398
399
400 cout << "now start to setup the network..." << endl;
401
402 TJetNet* jn =
new TJetNet( numberTestingEvents, numberTrainingEvents, nlayer, nneurons );
403
404 cout << " setting learning method... " << endl;
405
406
407
408
409
410
412 jn->
SetUpdatesPerEpoch( (
int)std::floor((
float)numberTrainingEvents/(
float)nPatternsPerUpdate) );
416
418
419
422
423
425
427
428
429
430 cout << " setting pattern for training events " << endl;
431
432 int trainSampleNumber=0;
433 int testSampleNumber=1;
434
435 cout << " copying over training events " << endl;
436
438 int counter0=0;
439 int counter1=0;
440
441
442 vector<double> inputVar;
443 vector<double> outputVar;
444
445
446 iClus=0;
447 for (Int_t i = 0;
i < totalN;
i++) {
448
449 if (i % 100000 == 0 ) {
450 std::cout <<
" Copying over training events. Looping over event " <<
i << std::endl;
451 }
452
453
454 simu->GetEntry(i);
455
456 for( unsigned int clus =0; clus<NN_sizeX->size(); clus++ ){
457
458 vector<float> *matrixOfToT=0;
459 vector<float> *vectorOfPitchesY=0;
460
461 Float_t phiBS;
462 Float_t thetaBS;
463 Float_t etaModule;
464 Int_t ClusterPixLayer;
465 Int_t ClusterPixBarrelEC;
466
467 std::vector<float> * position_idX=0;
468 std::vector<float> * position_idY=0;
469 std::vector<float> * thetaTr=0;
470 std::vector<float> * phiTr=0;
471
472
473 sizeX = (*NN_sizeX)[clus];
474
475 sizeY = (*NN_sizeY)[clus];
476 matrixOfToT=&(*NN_matrixOfToT)[clus];
477 vectorOfPitchesY=&(*NN_vectorOfPitchesY)[clus];
478
479 phiBS = (*NN_phiBS)[clus];
480 thetaBS =(*NN_thetaBS)[clus];
481 etaModule =(*NN_etaModule)[clus];
482
483 ClusterPixLayer=(*NN_ClusterPixLayer)[clus];
484 ClusterPixBarrelEC = (*NN_ClusterPixBarrelEC)[clus];
485
486 position_idX =&(*NN_position_idX)[clus];
487 position_idY =&(*NN_position_idY)[clus];
488
489 int nParticles = position_idX->size();
490
491 if (nParticlesTraining!=nParticles)
492 {
493 continue;
494 }
495
496 thetaTr = &(*NN_theta)[clus];
497 phiTr = &(*NN_phi)[clus];
498
499
501
502 for(
unsigned int P = 0;
P < position_idX->size();
P++){
503
504 double theta = (*thetaTr)[
P];
505 double phi = (*phiTr)[
P];
507
508 if (ClusterPixBarrelEC==2)
509 {
512 }
513
514 iClus++;
515
516
517
519
520
521
522 if (matrixOfToT->size()!=sizeX*sizeY)
523 {
524 std::cout <<
" Event: " <<
i <<
" PROBLEM: size Y is: " << matrixOfToT->size() << std::endl;
525 throw std::runtime_error("Error in positions/trainNN.cxx");
526 }
527
528
529 for(
unsigned int ME =0;
ME < matrixOfToT->size();
ME++){
530
533
534 if ((*matrixOfToT)[ME] != (*matrixOfToT)[ME])
535 {
536 cout <<
"ME n. " <<
ME <<
" is: " << (*matrixOfToT)[
ME] << endl;
537 throw std::runtime_error("Error in positions/trainNN.cxx");
538 }
539
540 if (counter0 == 0) std::cout <<
" element: " <<
ME <<
" ToT set to: " <<
norm_ToT((*matrixOfToT)[ME]) << std::endl;
541 if (iClus%dilutionFactor==1&&counter1==0) inputVar.push_back(
norm_ToT((*matrixOfToT)[ME]));
542
543 }
544
545
546
547 for (
int s=0;
s<sizeY;
s++)
548 {
551
552 if ((*vectorOfPitchesY)[s]!=(*vectorOfPitchesY)[s])
553 {
554 cout <<
" pitchY: " << (*vectorOfPitchesY)[
s] << endl;
555 throw std::runtime_error("Error in positions/trainNN.cxx");;
556 }
557 if (counter0 == 0) std::cout <<
" s: " <<
s <<
" pitch set to: " <<
norm_pitch((*vectorOfPitchesY)[s]) << std::endl;
558
559 if (iClus%dilutionFactor==1&&counter1==0) inputVar.push_back(
norm_pitch((*vectorOfPitchesY)[s]));
560 }
561
564
565 if (ClusterPixLayer!=ClusterPixLayer || ClusterPixBarrelEC!=ClusterPixBarrelEC)
566 {
567 cout << " ClusterPixLayer: " << ClusterPixLayer << " ClusterPixBarrelEC " << ClusterPixBarrelEC << endl;
568 throw std::runtime_error("Error in positions/trainNN.cxx");
569 }
570
573
574 if (iClus%dilutionFactor==1&&counter1==0) {
577 }
578
579
580 if (counter0 == 0) std::cout <<
" ClusterPixLayer " <<
norm_layerNumber(ClusterPixLayer) <<
" ClusterPixBarrelEC " <<
norm_layerType(ClusterPixBarrelEC) << std::endl;
581
582 if (useTrackEstimate)
583 {
586
588 cout <<
" phi: " <<
phi << endl;
589 throw std::runtime_error("Error in positions/trainNN.cxx");
590 }
591
593 cout <<
" theta: " <<
theta << endl;
594 throw std::runtime_error("Error in positions/trainNN.cxx");
595 }
596
597
598
601
603
604 if (iClus%dilutionFactor==1&&counter1==0) {
607 }
608 }
609 else
610 {
614
618
619
620 if (iClus%dilutionFactor==1&&counter1==0) {
624 }
625
626 if (counter0==0) std::cout <<
630 }
631
632
633 vector<float> xPositions = *position_idX;
634
635
636
637
638
639
640 std::sort(xPositions.begin(),xPositions.end());
641
642 for (int o=0;o<xPositions.size();o++)
643 {
644
647
648 if (xPositions[o]!=xPositions[o])
649 {
650 cout << "pos: " << xPositions[o] << endl;
651 throw std::runtime_error("Error in positions/trainNN.cxx");
652 }
653
654 if (counter0==0) std::cout <<
" output node: " << 2*o <<
" set to: " <<
norm_posX(xPositions[o]) << endl;
655
656 if (iClus%dilutionFactor==1&&counter1==0) { outputVar.push_back(
norm_posX(xPositions[o]));}
657
658 double corry=-1000;
659
660 for (
int e=0;
e<nParticles;
e++)
661 {
662 if (fabs((*position_idX)[e]-xPositions[o])<1e-10)
663 {
664 if (fabs(corry+1000)>1e-6)
665 {
666 cout << " Value find more than once! " << endl;
667 for (
int p=0;
p<xPositions.size();
p++)
668 {
669 cout <<
" X n. : " <<
p <<
" is: " << xPositions[
p] << endl;
670 }
671 }
672 corry=(*position_idY)[
e];
673 }
674 }
675
676 if (fabs(corry+1000)<1e-6) {
677 cout << " could not find original X pos. " << endl;
678 throw std::runtime_error("Error in positions/trainNN.cxx");
679 }
680
683
684 if (corry!=corry) {
685 cout << " posY " << corry << endl;
686 throw std::runtime_error("Error in positions/trainNN.cxx");
687 }
688
689
690 if (counter0==0) std::cout <<
" output node: " << 2*o+1 <<
" set to: " <<
norm_posY(corry) << endl;
691 if (iClus%dilutionFactor==1&&counter1==0) { outputVar.push_back(
norm_posY(corry));}
692
693 }
694
697
698
699 if (iClus%dilutionFactor==0){counter0+=1;}
700 if (iClus%dilutionFactor==1){counter1+=1;}
701
702
703
704 }
705 }
706 }
707
708 if (counter0!=numberTrainingEvents)
709 {
710 cout << " counter up to: " << counter0 << " while events in training sample are " << numberTrainingEvents << endl;
711 return;
712 }
713
714 if (counter1!=numberTestingEvents)
715 {
716 cout << " counter up to: " << counter1 << " while events in testing sample are " << numberTestingEvents << endl;
717 return;
718 }
719
720
721
723
724 if (restartTrainingFrom==0)
725 {
727
728 }
729 else
730 {
731 TString
name(
"Weights");
732 name+=restartTrainingFrom;
734
736 }
737
738
739
740 float minimumError=1e10;
741 int epochesWithRisingError=0;
742 int epochWithMinimum=0;
743
745
746
747
754 directory+=(int)(100*learningRateDecrease);
756 directory+=(int)(100*learningRateMomentum);
759 if (useTrackEstimate)
760 {
762 }
763
766
767 gSystem->Exec(command);
768
770
771 nameCronology+="/trainingCronology.txt";
772
773 ofstream cronology(nameCronology,ios_base::out);
774
775 cronology << "-------------SETTINGS----------------" << endl;
776 cronology <<
"Epochs: " << jn->
GetEpochs() << std::endl;
782 cronology <<
"Momentum: " << jn->
GetMomentum() << std::endl;
786 cronology << "-------------LAYOUT------------------" << endl;
787 cronology <<
"Input variables: " << jn->
GetInputDim() << endl;
788 cronology <<
"Output variables: " << jn->
GetOutputDim() << endl;
790 cronology << "Layout : ";
792 {
794 if (s<jn->GetHiddenLayerDim()+1) cronology << "-";
795 }
796 cronology << endl;
797 cronology << "--------------HISTORY-----------------" << endl;
798 cronology << "History of iterations: " << endl;
799 cronology.close();
800
801
802 TH1F* histoTraining=
new TH1F(
"training",
"training",(
int)std::floor((
float)nIterations/10.+0.5),1,std::floor((
float)nIterations/10.+1.5));
803 TH1F* histoTesting=
new TH1F(
"testing",
"testing",(
int)std::floor((
float)nIterations/10.+0.5),1,std::floor((
float)nIterations/10.+1.5));
804
805 double maximumTrain=0;
806 double minimumTrain=1e10;
807
808 for(int epoch=restartTrainingFrom+1;epoch<=nIterations;++epoch)
809 {
810 if (epoch!=restartTrainingFrom+1)
811 {
812 trainingError = jn->
Train();
813 }
814
815 if (epoch%10==0 || epoch==restartTrainingFrom+1)
816 {
817
818 cronology.open(nameCronology,ios_base::app);
819
820 testError = jn->
Test();
821
822 if (trainingError>maximumTrain) maximumTrain=trainingError;
823 if (testError>maximumTrain) maximumTrain=testError;
824 if (trainingError<minimumTrain) minimumTrain=trainingError;
825 if (testError<minimumTrain) minimumTrain=testError;
826
827
828 histoTraining->Fill(epoch/10.,trainingError);
829 histoTesting->Fill(epoch/10.,testError);
830
831 if (testError<minimumError)
832 {
833 minimumError=testError;
834 epochesWithRisingError=0;
835 epochWithMinimum=epoch;
836 }
837 else
838 {
839 epochesWithRisingError+=10;
840
841 }
842
843
844 if (epochesWithRisingError>300)
845 {
846 if (trainingError<minimumError)
847 {
848 cout << " End of training. Minimum already on epoch: " << epochWithMinimum << endl;
849 cronology << " End of training. Minimum already on epoch: " << epochWithMinimum << endl;
850 break;
851 }
852 }
853
854 cronology << "Epoch: [" << epoch <<
855 "] Error: " << trainingError <<
856 " Test: " << testError << endl;
857
858 cout << "Epoch: [" << epoch <<
859 "] Error: " << trainingError <<
860 " Test: " << testError << endl;
861
862 cronology.close();
863
868
869 TFile*
file=
new TFile(name,
"recreate");
871
872
874 for (
int z=0;
z<nParticlesTraining;
z++)
875 {
877 }
878
880 for (
int z=0;
z<nParticlesTraining;
z++)
881 {
882 std::cout <<
"output TTNet "<<
z<<
" x: " << myTestOutput[2*
z] <<
883 " y: " << myTestOutput[2*
z+1] << endl;
884 }
885 for (
int z=0;
z<nParticlesTraining;
z++)
886 {
887 std::cout <<
"should be " <<
z <<
"x: " << outputVar[2*
z] <<
" y: " << outputVar[2*
z+1] << endl;
888 }
889
890 trainedNetwork->Write();
894
895
896
897
898
899
900
901
902
903
904 }
905 }
906
909
910
911
912
913
914
915
918
919 cout << " create Trained Network object..." << endl;
920
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978 cout << " Now getting histograms from trainingResult" << endl;
979 cronology << " Now getting histograms from trainingResult" << endl;
980
982
983 cout << " From network to histo..." << endl;
985
986 cout << " From histo to network back..." << endl;
988
989 cout << " reading back " << endl;
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030 if (epochWithMinimum!=0)
1031 {
1032 cronology << "Minimum stored from Epoch: " << epochWithMinimum << endl;
1033 } else
1034 {
1035 cronology << "Minimum not reached" << endl;
1036 }
1037
1038 cronology.close();
1039
1040 if (epochWithMinimum!=0)
1041 {
1042
1045 name+=epochWithMinimum;
1047 std::cout << " reading back from minimum " << endl;
1048
1049
1050 TFile *_file0 = new TFile(name);
1052
1053 cout << " Reading back network with minimum" << endl;
1055
1058
1059 TFile*
file=
new TFile(nameFile,
"recreate");
1060 trainedNetwork->Write();
1064
1065 cout << " -------------------- " << endl;
1066 cout << " Writing OUTPUT histos " << endl;
1068 histoFName+="/histoWeights.root";
1069
1070 TFile* fileHistos=new TFile(histoFName,"recreate");
1073 std::vector<TH1*>::const_iterator histoBegin=myHistos.begin();
1074 std::vector<TH1*>::const_iterator histoEnd=myHistos.end();
1075 for (std::vector<TH1*>::const_iterator histoIter=histoBegin;
1076 histoIter!=histoEnd;++histoIter)
1077 {
1078 (*histoIter)->Write();
1079 }
1080 fileHistos->Write();
1081 fileHistos->Close();
1082 delete fileHistos;
1083
1084
1085
1086
1087
1088 }
1089 else
1090 {
1091 cout << " using network at last iteration (minimum not reached..." << endl;
1092 }
1093
1094
1095
1096
1097
1099 histoTName+="/trainingInfo.root";
1100
1101 TFile* histoFile=new TFile(histoTName,"recreate");
1102 histoTraining->Write();
1103 histoTesting->Write();
1104 histoFile->Write();
1105 histoFile->Close();
1106 delete histoFile;
1107
1108 TCanvas* trainingCanvas=new TCanvas("trainingCanvas","trainingCanvas");
1109 histoTraining->SetLineColor(2);
1110 histoTesting->SetLineColor(4);
1111
1112 histoTraining->GetYaxis()->SetRangeUser(minimumTrain,maximumTrain);
1113 histoTraining->Draw("l");
1114 histoTesting->Draw("lsame");
1116 canvasName+="/trainingCurve.eps";
1117 trainingCanvas->SaveAs(canvasName);
1118
1119
1120 TCanvas* mlpa_canvas = new TCanvas("jetnet_canvas","Network analysis");
1121 mlpa_canvas->Divide(2,4);
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453}
Scalar phi() const
phi method
Scalar theta() const
theta method
double norm_pitch(const double input, bool addIBL=false)
double norm_posX(const double input, const bool recenter=false)
double norm_layerNumber(const double input)
double norm_thetaBS(const double input)
double norm_layerType(const double input)
double norm_ToT(const double input)
double norm_posY(const double input)
double norm_phi(const double input)
double norm_phiBS(const double input)
double norm_theta(const double input)
double norm_etaModule(const double input)
Int_t GetInputDim(void) const
Double_t GetLearningRateDecrease(void)
void SetMomentum(Double_t aValue)
Int_t GetUpdatingProcedure(void)
void SetLearningRateDecrease(Double_t aValue)
void SetErrorMeasure(Int_t aValue)
void SetOutputTestSet(Int_t aPatternInd, Int_t aOutputInd, Double_t aValue)
Double_t GetMomentum(void)
void SetInitialWeightsWidth(Double_t aValue)
void SetEventWeightTestSet(Int_t aPatternInd, Double_t aValue)
void Evaluate(Int_t aPattern)
Int_t GetPatternsPerUpdate(void)
Double_t GetOutput(Int_t aIndex=0)
Double_t GetInitialWeightsWidth(void)
Int_t GetHiddenLayerSize(Int_t number) const
void SetInputTrainSet(Int_t aPatternInd, Int_t aInputInd, Double_t aValue)
Int_t GetHiddenLayerDim(void) const
void SetLearningRate(Double_t aValue)
Int_t GetUpdatesPerEpoch(void)
void writeNetworkInfo(Int_t typeOfInfo=0)
void SetActivationFunction(Int_t aValue)
void ReadFromFile(TString aFileName="fort.8")
void Shuffle(Bool_t aShuffleTrainSet=true, Bool_t aShuffleTestSet=true)
Int_t GetErrorMeasure(void)
void SetUpdatingProcedure(Int_t aValue)
void readBackTrainedNetwork(const TTrainedNetwork *)
Double_t GetLearningRate(void)
void SetInputTestSet(Int_t aPatternInd, Int_t aInputInd, Double_t aValue)
void SetUpdatesPerEpoch(Int_t aValue)
void SetEventWeightTrainSet(Int_t aPatternInd, Double_t aValue)
void SetOutputTrainSet(Int_t aPatternInd, Int_t aOutputInd, Double_t aValue)
TTrainedNetwork * createTrainedNetwork() const
Int_t GetOutputDim(void) const
Int_t GetActivationFunction(void) const
void SetPatternsPerUpdate(Int_t aValue)
std::vector< Double_t > calculateOutputValues(std::vector< Double_t > &input) const
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
bool badTrackInfo(bool useTrackEstimate, double theta)
bool isBadCluster(int sizeX, int nParticles)