3{
4 Log(2,
"ShowRec.cpp",
"--- void ReconstructShowers_NN() ---");
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 Float_t dT_InBT_To_TestBT=0;
23 Float_t dR_InBT_To_TestBT=0;
24 Float_t dR_TestBT_To_InBT=0;
25 Float_t zDist_TestBT_To_InBT=0;
26 Float_t SpatialDist_TestBT_To_InBT=0;
27 Float_t zDiff_TestBT_To_InBT=0;
28 Float_t dT_NextBT_To_TestBT=0;
29 Float_t dR_NextBT_To_TestBT=0;
30 Float_t mean_dT_2before=0;
31 Float_t mean_dR_2before=0;
32 Float_t mean_dT_before=0;
33 Float_t mean_dR_before=0;
34 Float_t mean_dT_same=0;
35 Float_t mean_dR_same=0;
36 Float_t mean_dT_after=0;
37 Float_t mean_dR_after=0;
38 Float_t mean_dT_2after=0;
39 Float_t mean_dR_2after=0;
40
41 Float_t min_dT_2before=0;
42 Float_t min_dR_2before=0;
43 Float_t min_dT_before=0;
44 Float_t min_dR_before=0;
45 Float_t min_dT_same=0;
46 Float_t min_dR_same=0;
47 Float_t min_dT_after=0;
48 Float_t min_dR_after=0;
49 Float_t min_dT_2after=0;
50 Float_t min_dR_2after=0;
51 Int_t nseg_1before=0;
52 Int_t nseg_2before=0;
53 Int_t nseg_3before=0;
54 Int_t nseg_1after=0;
55 Int_t nseg_2after=0;
56 Int_t nseg_3after=0;
57 Int_t nseg_same=0;
59
60
61 TTree *
simu =
new TTree(
"MonteCarlo",
"Filtered Monte Carlo Events");
62 simu->Branch(
"dT_InBT_To_TestBT", &dT_InBT_To_TestBT,
"dT_InBT_To_TestBT/F");
63 simu->Branch(
"dR_InBT_To_TestBT", &dR_InBT_To_TestBT,
"dR_InBT_To_TestBT/F");
64 simu->Branch(
"dR_TestBT_To_InBT", &dR_TestBT_To_InBT,
"dR_TestBT_To_InBT/F");
65 simu->Branch(
"zDiff_TestBT_To_InBT", &zDiff_TestBT_To_InBT,
"zDiff_TestBT_To_InBT/F");
66 simu->Branch(
"SpatialDist_TestBT_To_InBT", &SpatialDist_TestBT_To_InBT,
"SpatialDist_TestBT_To_InBT/F");
67 simu->Branch(
"nseg_1before", &nseg_1before,
"nseg_1before/I");
68 simu->Branch(
"nseg_2before", &nseg_2before,
"nseg_2before/I");
69 simu->Branch(
"nseg_same", &nseg_same,
"nseg_same/I");
70 simu->Branch(
"nseg_1after", &nseg_1after,
"nseg_1after/I");
71 simu->Branch(
"nseg_2after", &nseg_2after,
"nseg_2after/I");
72
73 simu->Branch(
"mean_dT_2before", &mean_dT_2before,
"mean_dT_2before/F");
74 simu->Branch(
"mean_dT_before", &mean_dT_before,
"mean_dT_before/F");
75 simu->Branch(
"mean_dT_same", &mean_dT_same,
"mean_dT_same/F");
76 simu->Branch(
"mean_dT_after", &mean_dT_after,
"mean_dT_after/F");
77 simu->Branch(
"mean_dT_2after", &mean_dT_2after,
"mean_dT_2after/F");
78
79 simu->Branch(
"mean_dR_2before", &mean_dR_2before,
"mean_dR_2before/F");
80 simu->Branch(
"mean_dR_before", &mean_dR_before,
"mean_dR_before/F");
81 simu->Branch(
"mean_dR_same", &mean_dR_same,
"mean_dR_same/F");
82 simu->Branch(
"mean_dR_after", &mean_dR_after,
"mean_dR_after/F");
83 simu->Branch(
"mean_dR_2after", &mean_dR_2after,
"mean_dR_2after/F");
84
85 simu->Branch(
"min_dT_2before", &min_dT_2before,
"min_dT_2before/F");
86 simu->Branch(
"min_dT_before", &min_dT_before,
"min_dT_before/F");
87 simu->Branch(
"min_dT_same", &min_dT_same,
"min_dT_same/F");
88 simu->Branch(
"min_dT_after", &min_dT_after,
"min_dT_after/F");
89 simu->Branch(
"min_dT_2after", &min_dT_2after,
"min_dT_2after/F");
90
91 simu->Branch(
"min_dR_2before", &min_dR_2before,
"min_dR_2before/F");
92 simu->Branch(
"min_dR_before", &min_dR_before,
"min_dR_before/F");
93 simu->Branch(
"min_dR_same", &min_dR_same,
"min_dR_same/F");
94 simu->Branch(
"min_dR_after", &min_dR_after,
"min_dR_after/F");
95 simu->Branch(
"min_dR_2after", &min_dR_2after,
"min_dR_2after/F");
96
97 simu->Branch(
"type", &
type,
"type/I");
99
100 TTree *simu_SG = (TTree *)
simu->Clone();
101 simu_SG->SetName("TreeSignalBT");
102 simu_SG->SetTitle("TreeSignalBT");
103 TTree *simu_BG = (TTree *)
simu->Clone();
104 simu_BG->SetName("TreeBackgroundBT");
105 simu_BG->SetTitle("TreeBackgroundBT");
106
107
108
109
110
113 cout << "histos created"<<endl;
114 }
115
116
119 cout <<
TMlpANN->GetStructure() << endl;
120
121
122
126 Float_t local_gAli_pat_interim_halfsize=0;
127
130
131
132
133
135
136
137
139
140
141
142
144
149
150 Int_t local_NBT=0;
151 Int_t local_NBTMC=0;
152 Int_t local_NBTallMC=0;
153 Int_t local_NBTeMC=0;
154 float_t local_pure=-1;
155 float_t local_purall=-1;
156 Int_t npat_int=0;
157 Int_t npat_total=0;
158 Int_t npatN=0;
159 Int_t npat_Neff=0;
160 Int_t NBT_Neff=0;
161 Int_t NBTMC_Neff=0;
162 Int_t NBTMCe_Neff=0;
163
164
166 cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
168 }
169
170
171
172
173
175
177
178
179
180
181
182
183 dT_InBT_To_TestBT=0;
184 dR_InBT_To_TestBT=0;
185 dR_TestBT_To_InBT=0;
186 zDiff_TestBT_To_InBT=0;
187 mean_dT_2before=0;
188 mean_dR_2before=0;
189 mean_dT_before=0;
190 mean_dR_before=0;
191 mean_dT_same=0;
192 mean_dR_same=0;
193 mean_dT_after=0;
194 mean_dR_after=0;
195 mean_dT_2after=0;
196 mean_dR_2after=0;
197 nseg_1before=0;
198 nseg_2before=0;
199 nseg_1after=0;
200 nseg_2after=0;
201 nseg_same=0;
202 min_dT_2before=0;
203 min_dR_2before=0;
204 min_dT_before=0;
205 min_dR_before=0;
206 min_dT_same=0;
207 min_dR_same=0;
208 min_dT_after=0;
209 min_dR_after=0;
210 min_dT_2after=0;
211 min_dR_2after=0;
212
214
215
216
217
218
219 Int_t local_gAli_npat=local_gAli->
Npatterns();
220 if (
gEDBDEBUGLEVEL>2) cout <<
"--- local_gAli_npat= " << local_gAli_npat << endl;
221
222
223
224 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
225 if (
gEDBDEBUGLEVEL>3) cout <<
"--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
226
227
228
229
230
231 for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->
GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
234
235
236
237
238 zDiff_TestBT_To_InBT=seg->
Z()-InBT->
Z();
240
242
243
246
247
248
249 if (ann_inputneurons==10) {
255 }
256
257
258 if (ann_inputneurons==20) {
264 }
265
266
267 if (ann_inputneurons==30) {
273 }
274
275
276
277
278
279
281 if (seg->
MCEvt()>0) {
292
314 simu_SG->Fill();
316 }
317 if (seg->
MCEvt()<0) {
328
339
351 simu_BG->Fill();
353 }
355
356 }
357
358 }
359
360
361
363
364 params[0]=dT_InBT_To_TestBT;
365 params[1]=dR_InBT_To_TestBT;
366 params[2]=dR_TestBT_To_InBT;
367 params[3]=zDiff_TestBT_To_InBT;
368 params[4]=SpatialDist_TestBT_To_InBT;
369
370
376
377 params[10]=mean_dT_2before;
378 params[11]=mean_dT_before;
381 params[14]=mean_dT_2after;
382
383 params[15]=mean_dR_2before;
384 params[16]=mean_dR_before;
387 params[19]=mean_dR_2after;
388
389 params[20]=min_dT_2before;
394
395 params[25]=min_dR_2before;
400
401
402
403 Double_t value=0;
404
405
406
408
409
410
411
413
414
415
416
417
418 if (seg->
X()==InBT->
X()&&seg->
Y()==InBT->
Y()) {
419 ;
420 }
421 else {
423 }
424 }
425
426
427
428
430 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
431
432
434 }
435
437
438
439
440
441
442
443
445 Int_t NBT=0;
446 Int_t NBTMC=0;
447 Int_t NBTallMC=0;
448 Int_t NBTeMC=0;
449 Double_t eff, purall, pure;
451
452
458 }
460 }
461
462
463
464
467
468
469
470
471
474 }
475
476
477
478
479
480
483 delete local_gAli;
484 local_gAli=0;
486
487 }
488
489
490
494
495
496
497
498
500 cout << " Now write NN SG/BG Trees with the Inputvariables: --------------------"<<endl;
501
502 TFile* fil = new TFile("NN_ALG_ANN_TrainingsFile_DefaultName.root","RECREATE");
504 canv_SG->Divide(5,4);
505 canv_SG->cd(1);
512
513 canv_SG->cd(2);
520
521 canv_SG->cd(3);
529
530 canv_SG->cd(4);
537
538 canv_SG->cd(5);
545
546 canv_SG->cd(6);
553
554 canv_SG->cd(7);
561
562 canv_SG->cd(8);
569
570
571
572
573 canv_SG->cd(9);
580
581 canv_SG->cd(10);
588
589
590
591 canv_SG->cd(11);
598
599 canv_SG->cd(12);
606
607
608
609 canv_SG->cd(13);
616
617 canv_SG->cd(14);
624
625
626
627 canv_SG->cd(15);
634
635 canv_SG->cd(16);
642
643
644 canv_SG->cd(17);
651
652 canv_SG->cd(18);
659
660 canv_SG->Update();
661
662
663
664
665 TCanvas* canv_SG_2 =
new TCanvas(
"canv_SG_2",
"canv_SG_2",800,800);
666 canv_SG_2->Divide(4,4);
667 canv_SG_2->cd(1);
668 canv_SG_2->cd(1);
675
676 canv_SG_2->cd(2);
683
684
685
686 canv_SG_2->cd(3);
693
694 canv_SG_2->cd(4);
701
702
703
704 canv_SG_2->cd(5);
711
712 canv_SG_2->cd(6);
719
720
721
722 canv_SG_2->cd(7);
729
730 canv_SG_2->cd(8);
737
738
739 canv_SG_2->cd(9);
746
747 canv_SG_2->cd(10);
754
755 canv_SG_2->cd(11);
762
763
764 canv_SG_2->cd(12);
771
772
773
775 simu_SG->Write();
776 simu_BG->Write();
778 canv_SG->Write();
779 canv_SG_2->Write();
780 fil->Close();
781
782 delete canv_SG;
783 delete canv_SG_2;
784 delete canv_BG;
785 delete fil;
786
787 }
788
789
790 return;
791}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
void Get_NN_ALG_MLP(TTree *simu, Int_t parasetnr)
Definition: ShowRec_Alg_NN.cpp:1036
void Load_NN_ALG_MLP_weights(TMultiLayerPerceptron *mlp, Int_t parasetnr)
Definition: ShowRec_Alg_NN.cpp:1134
void Create_NN_Alg_Histograms()
Definition: ShowRec_Alg_NN.cpp:798
Double_t GetdeltaThetaSingleAngles(EdbSegP *s1, EdbSegP *s2)
Definition: ShowRec.cpp:7258
Double_t GetdeltaRWithPropagation(EdbSegP *s, EdbSegP *stest)
Definition: ShowRec.cpp:7211
void CalcTrackDensity(EdbPattern *pat_interim, Float_t pat_interim_halfsize, Int_t &npat_int, Int_t &npat_total, Int_t &npatN)
Definition: ShowRec.cpp:8749
void TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree(TTree *treebranchtree, TObjArray *segarray)
Definition: ShowRec.cpp:7940
void CalcEffPurOfShower2(TObjArray *arr, Int_t &NBT, Int_t &NBTMC, Int_t &NBTallMC, Int_t &NBTeMC, Double_t &purall, Double_t &pure, Int_t NBT_Neff, Int_t NBTMC_Neff, Int_t NBTMCe_Neff)
Definition: ShowRec.cpp:7631
void PrintShowerObjectArray(TObjArray *segarray)
Definition: ShowRec.cpp:6967
Double_t GetSpatialDist(EdbSegP *s1, EdbSegP *s2)
Definition: ShowRec.cpp:7276
EdbPVRec * TransformEdbPVRec(EdbPVRec *gAli, EdbSegP *InitiatorBT)
DEBUG OPENMP TEST!!!!!!!
Definition: ShowRec.cpp:6299
Int_t GetMinsBeforeAndAfter(Float_t &min_dT, Float_t &min_dR, EdbPVRec *local_gAli, Int_t patterloop_cnt, EdbSegP *seg, Int_t n_patterns, Int_t BeforeOrAfter)
Definition: ShowRec.cpp:7295
Int_t GetMeansBeforeAndAfter(Float_t &mean_dT, Float_t &mean_dR, EdbPVRec *local_gAli, Int_t patterloop_cnt, EdbSegP *seg, Int_t n_patterns, Int_t BeforeOrAfter)
Definition: ShowRec.cpp:7383
Int_t GetNSegBeforeAndAfter(EdbPVRec *local_gAli, Int_t patterloop_cnt, EdbSegP *seg, Int_t n_patterns, Int_t BeforeOrAfter)
Definition: ShowRec.cpp:7462
void CalcEfficencyNumbers(EdbPattern *pat_interim, Int_t MCCheck, Int_t &NBT_Neff, Int_t &NBTMC_Neff, Int_t &NBTMCe_Neff)
Definition: ShowRec.cpp:8771
Int_t GLOBAL_INBTSHOWERNR
Definition: ShowRec.h:80
Double_t GLOBAL_trckdens
Definition: ShowRec.h:39
EdbPVRec * GLOBAL_gAli
Definition: ShowRec.h:73
Int_t cmd_OUTPUTLEVEL
Definition: ShowRec.h:33
Int_t GLOBAL_PARASETNR
Definition: ShowRec.h:79
Int_t GLOBAL_EvtBT_FlagArray[99999]
Definition: ShowRec.h:51
TObjArray * GLOBAL_ShowerSegArray
Definition: ShowRec.h:76
Int_t GLOBAL_InBT_MC
Definition: ShowRec.h:43
Double_t GLOBAL_EvtBT_EArray[99999]
Definition: ShowRec.h:52
Int_t GLOBAL_EvtBT_MCArray[99999]
Definition: ShowRec.h:51
TTree * TREE_ShowRecEff
Definition: ShowRec.h:62
Float_t shower_trackdensb
Definition: ShowRec.h:395
Int_t GLOBAL_InBT_Flag
Definition: ShowRec.h:43
Double_t GLOBAL_EvtBT_E
Definition: ShowRec.h:50
Bool_t var_NN_DoTrain
Definition: ShowRec.h:211
Double_t GLOBAL_InBT_TanTheta
Definition: ShowRec.h:44
Double_t GLOBAL_InBT_E
Definition: ShowRec.h:44
Int_t GLOBAL_EvtBT_MC
Definition: ShowRec.h:49
Int_t GLOBAL_InBTArrayEntries
Definition: ShowRec.h:75
Double_t GLOBAL_EvtBT_TanThetaArray[99999]
Definition: ShowRec.h:52
Double_t GLOBAL_EvtBT_TanTheta
Definition: ShowRec.h:50
TTree * TREE_ShowShower
Definition: ShowRec.h:68
Int_t GLOBAL_EvtBT_Flag
Definition: ShowRec.h:49
TObjArray * GLOBAL_InBTArray
Definition: ShowRec.h:74
Definition: EdbPVRec.h:148
Definition: EdbPattern.h:273
Int_t Npatterns() const
Definition: EdbPattern.h:366
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1721
Float_t TX() const
tangens = deltaX/deltaZ
Definition: EdbSegP.h:175
Float_t X() const
Definition: EdbSegP.h:173
Float_t Z() const
Definition: EdbSegP.h:153
Float_t P() const
Definition: EdbSegP.h:152
Float_t Y() const
Definition: EdbSegP.h:174
void PrintNice() const
Definition: EdbSegP.cxx:392
Float_t TY() const
tangens = deltaY/deltaZ
Definition: EdbSegP.h:176
Int_t MCEvt() const
Definition: EdbSegP.h:145
Int_t Flag() const
Definition: EdbSegP.h:149
EdbSegP * GetSegment(int i) const
Definition: EdbPattern.h:66
gEDBDEBUGLEVEL
Definition: energy.C:7
Double_t params[3]
Definition: testBGReduction_By_ANN.C:84