-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanatree.C
3288 lines (2623 loc) · 112 KB
/
anatree.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
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
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#define anatree_cxx
#include "anatree.h"
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
double Find_Angle(double angle);
void anatree::Loop(Long64_t max_entry)
{
// To execute this code you will do this:
// > root -l
// Root > .L anatree.C
// (or to compile : Root > .L anatree.C+)
// Root > anatree t
// (or add a file: Root > anatree t("eminus/blahblah.root") )
// Root > t.Loop(); // Loop on all entries
// (or small number of events: Root > t.Loop(500) )
TH1F* StartPointOffset = new TH1F("Start_Point_Offset", "Start Point Offset; Distance(cm); Number of Events", 250, 0, 10); //how far off is the shower start from the MC start; plot distance in m
TH1F* Startpointoffsetgreaterthan60dist = new TH1F("Startpointoffsetgreaterthan60dist", "Start Point Offset; Distance(cm); Number of Events", 250, 0, 10);
TH1F* Startpointoffsetlessthan60dist = new TH1F("Startpointoffsetlessthan60dist", "Start Point Offset; Distance(cm); Number of Events", 250, 0, 10);
TH1F* Startpointoffsetgreaterthan50dist = new TH1F("Startpointoffsetgreaterthan50dist", "Start Point Offset; Distance(cm); Number of Events", 250, 0, 10);
TH1F* Startpointoffsetgreaterthan70dist = new TH1F("Startpointoffsetgreaterthan70dist", "Start Point Offset; Distance(cm); Number of Events", 250, 0, 10);
TH1F* Startpointoffsetgreaterthan80dist = new TH1F("Startpointoffsetgreaterthan80dist", "Start Point Offset; Distance(cm); Number of Events", 250, 0, 10);
TH1F* Startpointoffsetgreaterthan90dist = new TH1F("Startpointoffsetgreaterthan90dist", "Start Point Offset; Distance(cm); Number of Events", 250, 0, 10);
TH1F* Startpointoffsetgreaterthan100dist = new TH1F("Startpointoffsetgreaterthan100dist", "Start Point Offset; Distance(cm); Number of Events", 250, 0, 10);
TH1F* Uplanedist = new TH1F("Uplanedist", "Start Point Offset; Distance(cm); Number of Events", 200, 0, 10);
TH1F* Vplanedist = new TH1F("Vplanedist", "Start Point Offset; Distance(cm); Number of Events", 200, 0, 10);
TH1F* Yplanedist = new TH1F("Yplanedist", "Start Point Offset; Distance(cm); Number of Events", 200, 0, 10);
TH1F* ParallelAngledist = new TH1F("ParallelAngledist", "Start Point Offset; Distance(cm); Number of Events", 200, 0, 10);
TH1F* NotParallelAngledist = new TH1F("NotParallelAngledist", "Start Point Offset; Distance(cm); Number of Events", 200, 0, 10);
TH1F* Unotplanedist = new TH1F("Unotplanedist", "Start Point Offset; Distance(cm); Number of Events", 200, 0, 10);
TH1F* Vnotplanedist = new TH1F("Vnotplanedist", "Start Point Offset; Distance(cm); Number of Events", 200, 0, 10);
TH1F* Ynotplanedist = new TH1F("Ynotplanedist", "Start Point Offset; Distance(cm); Number of Events", 200, 0, 10);
TH1F* GoodAngledist = new TH1F("GoodAngledist", "Start Point Offset; Distance(cm); Number of Events", 100, 0, 10);
TH1F* Anglegreaterthan60dist = new TH1F("Anglegreaterthan60", "Start Point Offset; Distance(cm); Number of Events", 100, 0, 10);
TH1F* Anglelessthanminus60dist = new TH1F("Anglelessthanminus60", "Start Point Offset; Distance(cm); Number of Events", 100, 0, 10);
TH1F* NumShowers = new TH1F("Number_of_Showers", "; Number of showers; Number of Events", 6, -0.5, 5.5); // plot number of showers
TH1F* PhotonDist = new TH1F("Photon_Distance", "; Photon Distance(cm); Number of Particles", 50, 50, 2000); // how far does a brem photon travel
//TH1F* xAngleOffset = new TH1F("X_angle_Offset ", "; Angle(degrees); Number of Particles", 360, 0, 360); // how far off is the direction in the x plane in degrees
//TH1F* yAngleOffset = new TH1F("Y_angle_Offset ", "; Angle(degrees); Number of Particles", 360, 0, 360); // how far off is the direction in the x plane in degrees
//TH1F* zAngleOffset = new TH1F("Z_angle_Offset ", "; Angle(degrees); Number of Particles", 360, 0, 360); // how far off is the direction in the x plane in degrees
TH1F* StartPointOffsetGoodReco = new TH1F("start_Point_offset_Good_Reco", "; Start Point Offset(cm); Number", 100, 0, 360);
//TH1F* yAngleOffsetGoodReco = new TH1F("Y_angle_Offset_Good_Reco ", "; Angle(degrees); Number of Particles", 360, 0, 100);
//TH1F* xAngleOffsetGoodReco = new TH1F("X_angle_Offset_Good_Reco ", "; Angle(degrees); Number of Events", 360, 0 0, 360);
//TH1F* zAngleOffsetGoodReco = new TH1F("Z_angle_Offset_Good_Reco ", "; Angle(degrees); Number of Particles", 360, 0, 360);
TH1F* NumShowersGoodRecoEng = new TH1F("Energy_One_Good_Shower", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* NumShowersBadRecoEng = new TH1F("Energy_One_Bad_Shower", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* Energy = new TH1F("Energy", "; Energy(MeV); Number of Events", 25, 100, 2000);
//TH1F* XAngleGoodRecoEng = new TH1F("X_angle_Good_Reco_Energy ", "; Energy(MeV); Number of Events", 25, 100, 2000);
//TH1F* YAngleGoodRecoEng = new TH1F("Y_angle_Good_Reco_Energy ", "; Energy(MeV); Number of Events", 25, 100, 2000);
//TH1F* ZAngleGoodRecoEng = new TH1F("Z_angle_Good_Reco_Energy ", "; Energy(MeV); Number of Events", 25, 100, 2000);
//TH1F* DistGoodRecoEng = new TH1F("Distance_Good_Reco_Energy ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* BremphotonEng = new TH1F("Brem_Energy ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* NoShowerEng = new TH1F("No_Shower_Energy ", "Energy of Events with No Reconstructed Showers; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* StartPointOffsetGoodRecoEng = new TH1F("Start_Point_Offset_Good_Reco_Eng", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* SuperStartPointOffsetGoodRecoEng = new TH1F("Super_Start_Point_Offset_Good_Reco_Eng", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* MoreThanOneShowerEng = new TH1F("MoreThanOneShowerEng ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* GoodRecoEng = new TH1F("Good_Reco ", "Energy of Good Reconstructed Showers; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* AngleGoodRecoEng = new TH1F("Angle_Good_Reco_Energy ", " Energy of Showers with Good Reconstructed Angles; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* ShowersGoodRecoEng = new TH1F("Showers_Good_Reco ", "Energy of Good Reconstructed Showers; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* EffShowersGoodRecoEng = new TH1F("ShowersEffGoodRecoEng", ";Energy(MeV);Efficiency ", 25, 100, 2000); // GoodRecoEng/Energy
TH1F* EffNumShowers = new TH1F("EffNumShowers", "; Energy(MeV);Efficiency", 25, 100, 2000); // Efficiency of at Least One Reconstructed Shower
TH1F* EffDist = new TH1F("EffDist", ";Energy(MeV);", 25, 100, 2000); // StartPointOffsetGoodRecoEng/Energy
TH1F* EffSuperDist = new TH1F("EffSuperDist", ";Energy(MeV);", 25, 100, 2000); // StartPointOffsetGoodRecoEng/Energy
TH1F* EffGoodRecoEng = new TH1F("EffGoodRecoEng", ";Energy(MeV); Efficiency", 25, 100, 2000); // GoodRecoEng/Energy
TH1F* EffNoShowerEng = new TH1F("EffNoShowerEng", "; Energy(MeV); ", 25, 100, 2000); // NoShowerEng/Energy
// TH1F* EffStartPointEng = new TH1F("EffStartPointEng", " Efficiency of Showers with Good Start Point Offset;Energy(MeV); ", 25, 100, 2000); // StartPointOffsetGoodRecoEng/Energy
TH1F* MisshalfShowerEng = new TH1F("MisshalfShowerEng ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* GoodRecoTrueEng = new TH1F("GoodRecoTrueEng ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* GoodRecoDiffEng = new TH1F("GoodRecoDiffEng ", "; Difference(MeV); Number of Events", 25, -1000, 1000);
TH1F* MissBegShowerEng = new TH1F("MissBegShowerEng ", "; Energy(MeV); Number of Events", 25, 100, 2000);
//TH1F* DiffxAngle = new TH1F("Diff_xAngle", "; Angle(degrees); Number of Particles", 360, -360, 360);
//TH1F* DiffyAngle = new TH1F("Diff_yAngle", "; Angle(degrees); Number of Particles", 360, -360, 360);
//TH1F* DiffzAngle = new TH1F("Diff_zAngle", "; Angle(degrees); Number of Particles", 360, -360, 360);
TH1F* Diffxdist = new TH1F("Diffxdist", "Shower Start - MC Start (x Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffydist = new TH1F("Diffydist", "Shower Start - MC Start (y Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffzdist = new TH1F("Diffzdist", "Shower Start - MC Start (z Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffxdistmaggreaterthan60 = new TH1F("Diffxdistmaggreaterthan60", "Shower Start - MC Start (x Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffxdistmaglessthan60 = new TH1F("Diffxdistmaglessthan60", "Shower Start - MC Start (x Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffydistmaggreaterthan60 = new TH1F("Diffydistmaggreaterthan60", "Shower Start - MC Start (y Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffydistmaglessthan60 = new TH1F("Diffydistmaglessthan60", "Shower Start - MC Start (y Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffzdistmaggreaterthan60 = new TH1F("Diffzdistmaggreaterthan60", "Shower Start - MC Start (z Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffzdistmaglessthan60 = new TH1F("Diffzdistmaglessthan60", "Shower Start - MC Start (z Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffxdistgreaterthan60 = new TH1F("Diffxdistgreaterthan60", "Shower Start - MC Start (x Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffxdistlessthanminus60 = new TH1F("Diffxdistlessthanminus60", "Shower Start - MC Start (x Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffydistgreaterthan60 = new TH1F("Diffydistgreaterthan60", "Shower Start - MC Start (y Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffydistlessthanminus60 = new TH1F("Diffydistlessminusthan60", "Shower Start - MC Start (y Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffzdistgreaterthan60 = new TH1F("Diffzdistgreaterthan60", "Shower Start - MC Start (z Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Diffzdistlessthanminus60 = new TH1F("Diffzdistlessthanminus60", "Shower Start - MC Start (z Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Posmomentumxdist = new TH1F("Posmomentumxdist", "Shower Start - MC Start (x Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Negmomentumxdist = new TH1F("Negmomemtumxdist", "Shower Start - MC Start (x Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Posmomentumydist = new TH1F("Posmomentumydist", "Shower Start - MC Start (y Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Negmomentumydist = new TH1F("Negmomemtumydist", "Shower Start - MC Start (y Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Posmomentumzdist = new TH1F("Posmomentumzdist", "Shower Start - MC Start (z Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Negmomentumzdist = new TH1F("Negmomemtumzdist", "Shower Start - MC Start (z Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Startpointoffsetxzangledistlessthan = new TH1F("Startpointoffsetxzangledistlessthan", "Start offset MC xz Angle; Distance(cm); Number of Events", 250, 0, 10);
TH1F* EndStartpointoffsetxzangledist = new TH1F("EndStartpointoffsetxzangledist", "Start offset MC xz Angle; Distance(cm); Number of Events", 250, 0, 10);
TH1F* EndStartpointoffsetyzangledist = new TH1F("EndStartpointoffsetyzangledist", "Start offset MC xz Angle; Distance(cm); Number of Events", 250, 0, 10);
TH1F* NotEndStartpointoffsetxzangledist = new TH1F("NotEndStartpointoffsetxzangledist", "Start offset MC xz Angle; Distance(cm); Number of Events", 250, 0, 10);
TH1F* NotEndStartpointoffsetyzangledist = new TH1F("NotEndStartpointoffsetyzangledist", "Start offset MC xz Angle; Distance(cm); Number of Events", 250, 0, 10);
TH1F* DiffMCxdist = new TH1F("DiffMCxdist", "Shower Start - MC Shower Start (x Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* DiffMCydist = new TH1F("DiffMCydist", "Shower Start - MC Shower Start (y Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* DiffMCzdist = new TH1F("DiffMCzdist", "Shower Start - MC Shower Start (z Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* DiffMCCxdist = new TH1F("DiffMCCxdist", "MC Shower Comb Start - MC Shower Start (x Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* DiffMCCydist = new TH1F("DiffMCCydist", "MC Shower Comb Start - MC Shower Start (y Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* DiffMCCzdist = new TH1F("DiffMCCzdist", "MC Shower Comb Start - MC Shower Start (z Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* DiffMCCombxdist = new TH1F("DiffMCCombxdist", "Shower Start - MC Shower Comb Start (x Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* DiffMCCombydist = new TH1F("DiffMCCombydist", "Shower Start - MC Shower Comb Start (y Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* DiffMCCombzdist = new TH1F("DiffMCCombzdist", "Shower Start - MC Shower Comb Start (z Direction); Distance(cm); Number of Events", 300, -3, 3);
TH1F* Showerstartx = new TH1F("Showerstartx", "; Distance(cm); Number of Events", 30, -100, 300);
TH1F* Showerstarty = new TH1F("Showerstarty", "; Distance(cm); Number of Events", 30, -300, 300);
TH1F* Showerstartz = new TH1F("Showerstartz", "; Distance(cm); Number of Events", 30, -100, 1000);
TH1F* MCstartx = new TH1F("MCstartx", "; Distance(cm); Number of Events", 30, -100, 300);
TH1F* MCstarty = new TH1F("MCstarty", "; Distance(cm); Number of Events", 30, -300, 300);
TH1F* MCstartz = new TH1F("MCstartz", "; Distance(cm); Number of Events", 30, -100, 1000);
THStack * ShowerEnergy = new THStack("Shower", "");
THStack * ShowerEnergy1 = new THStack("Shower1", "");
THStack * ycomponent = new THStack("ycomponent", "");
THStack * ShowerAngle = new THStack("ShowerAngle", "");
TH1F* NoShowerAng = new TH1F("No_Shower_Angle ", "Angle of Events with No Reconstructed Showers; Angle(Degrees); Number of Events", 360, 0, 360);
TH1F* NumShowersGoodRecoAng = new TH1F("NumShowersGoodRecoAng", "; Angle(Degrees); Number of Events", 360, 0, 360);
TH1F* MoreThanOneShowerAng = new TH1F("MoreThanOneShowerAng ", "; Angle(Degrees); Number of Events", 360, 0, 360);
//TH1F* TotalEng = new TH1F("TotalEng ", "; Energy(MeV); Number of Events", 100, 0, 2000);
//TH1F* ChargedPartEng = new TH1F("ChargedPartEng ", "; Energy(MeV); Number of Events", 100, 0, 2000);
//TH1F* DiffTotalEng = new TH1F("DiffTotalEng ", "; Energy(MeV); Number of Events", 100, -1000, 1000);
//TH1F* DiffChargedPartEng = new TH1F("DiffChargedPartEng ", "; Energy(MeV); Number of Events", 100, -1000, 1000);
TH1F* Nshowersratioeng = new TH1F("Nshowersratioeng ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* xzdiffang = new TH1F("xzdiffang ", "; theta_xz (Degrees); Number of Events", 180, 0, 180);
TH1F* yzdiffang = new TH1F("yzdiffang ", "; theta_yz (Degrees); Number of Events", 180, 0, 180);
TH1F* OneShowerxzAng = new TH1F("OneShowerxzAng ", "; Angle(Degrees); Number of Events", 60, 0, 360);
TH1F* OneShoweryzAng = new TH1F("OneShoweryzAng ", "; Angle(Degrees); Number of Events", 60, 0, 360);
TH1F* MoreThanOneShowerxzAng = new TH1F("MoreThanOneShowerxzAng ", "; Angle(Degrees); Number of Events", 60, 0, 360);
TH1F* MoreThanOneShoweryzAng = new TH1F("MoreThanOneShoweryzAng ", "; Angle(Degrees); Number of Events", 60, 0, 360);
TH1F* XZ_angle = new TH1F("XZ_angle ", "; Angle(Degrees); Number of Events", 36, -180, 180);
TH1F* YZ_angle = new TH1F("YZ_angle ", "; Angle(Degrees); Number of Events", 36, -180, 180);
TH1F* ActualEng = new TH1F("ActualEng ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* MCxzangle = new TH1F("MCxzangle ", "; Angle(Degrees); Number of Events", 36, -180, 180);
TH1F* MCyzangle = new TH1F("MCyzangle ", "; Angle(Degrees); Number of Events", 36, -180, 180);
TH1F* DistTPC1 = new TH1F("DistTPC1", "; Distance; Number of Events", 50, -500, 500);
TH1F* Disttot1 = new TH1F("Disttot1", "; Distance; Number of Events", 50, -500, 500);
TH1F* DistTPC0 = new TH1F("DistTPC0", "; Distance; Number of Events", 50, -500, 500);
TH1F* Disttot0 = new TH1F("Disttot0", "; Distance; Number of Events", 50, -500, 500);
TH1F* noshowerstartx = new TH1F("noshowerstartx", "; Distance; Number of Events", 50, -500, 500);
TH1F* oneshowerstartx = new TH1F("oneshowerstartx", "; Distance; Number of Events", 50, -500, 500);
TH1F* noshowerenergy = new TH1F("noshowerenergy ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* Showereng = new TH1F("Energy of Shower ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* FirstParticleEng = new TH1F(" ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* EffEng = new TH1F("EffEng ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* Negativededxdist = new TH1F("Negativededxdist", "Start Point Offset; Distance(cm); Number of Events", 1000, 0, 100);
TH1F* Negativededxxzang = new TH1F("Negativededxxzang ", "; theta_xz (Degrees); Number of Events", 180, 0, 180);
TH1F* Negativededxyzang = new TH1F("Negativededxyzang ", "; theta_yz (Degrees); Number of Events", 180, 0, 180);
TH1F* DiffParticleeng = new TH1F("DiffParticleeng", "; Energy(MeV); Number of Events", 2000, -2000, 2000);
TH1F* RatiolessTotDist = new TH1F("RatiolessTotDist", "Start Point Offset; Distance(cm); Number of Events", 600, 0, 150);
TH1F* RatiomoreTotDist = new TH1F("RatiomoreTotDist", "Start Point Offset; Distance(cm); Number of Events", 600, 0, 150);
TH1F* RatiolessTotxzAng = new TH1F("RatiolessTotxzAng", "; Angle(Degrees); Number of Events", 180, 0, 180);
TH1F* RatiomoreTotxzAng = new TH1F("RatiomoreTotxzAng", "; Angle(Degrees); Number of Events", 180, 0, 180);
TH1F* RatiolessTotyzAng = new TH1F("RatiolessTotyzAng", "; Angle(Degrees); Number of Events", 180, 0, 180);
TH1F* RatiomoreTotyzAng = new TH1F("RatiomoreTotyzAng", "; Angle(Degrees); Number of Events", 180, 0, 180);
TH1F* RatiolessTotdedx = new TH1F("RatiolessTotdedx", "; ; Number of Events", 60, -15, 15);
TH1F* Startoffsetdistdedx = new TH1F("Startoffsetdistdedx", "; ; Number of Events", 60, -15, 15);
TH1F* Startdir_MCshwrxzang = new TH1F("Startdir_MCshwrxzang ", "; theta (Degrees); Number of Events", 180, 0, 180);
TH1F* Startdir_MCshwryzang = new TH1F("Startdir_MCshwryzang ", "; theta (Degrees); Number of Events", 180, 0, 180);
TH1F* Startdir_shwrxzang = new TH1F("Startdir_shwrxzang ", "; theta (Degrees); Number of Events", 180, 0, 180);
TH1F* Startdir_shwryzang = new TH1F("Startdir_shwryzang ", "; theta (Degrees); Number of Events", 180, 0, 180);
TH1F* Startdir_firstpartxzang = new TH1F("Startdir_firstpartxzang ", "; theta (Degrees); Number of Events", 180, 0, 180);
TH1F* Startdir_firstpartyzang = new TH1F("Startdir_firstpartyzang ", "; theta (Degrees); Number of Events", 180, 0, 180);
TH1F* MCshwr_firstpartxzang = new TH1F("MCshwr_firstpartxzang ", "; theta (Degrees); Number of Events", 180, 0, 180);
TH1F* MCshwr_firstpartyzang = new TH1F("MCshwr_firstpartyzang ", "; theta (Degrees); Number of Events", 180, 0, 180);
TH1F* Shwr_firstpartxzang = new TH1F("Shwr_firstpartxzang ", "; theta (Degrees); Number of Events", 180, 0, 180);
TH1F* Shwr_firstpartyzang = new TH1F("Shwr_firstpartyzang ", "; theta (Degrees); Number of Events", 180, 0, 180);
TH1F* bestplanededx = new TH1F("bestplanededx ", "; MeV/cm; Number of Events", 50, -20, 20);
TH1F* diffshower_dedx = new TH1F("diffshower_dedx ", "; MeV/cm; Number of Events", 50, -20, 20);
TH1F* MCshower_dedx = new TH1F("MCshower_dedx ", "; ; Number of Events", 50, -50, 50);
TH1F* Recoshowerbest_dedx = new TH1F("Recoshowerbest_dedx ", "; ; Number of Events", 50, -50, 50);
TH1F* Recoshower1_dedx = new TH1F("Recoshower1_dedx ", "; ; Number of Events", 50, -50, 50);
TH1F* Recoshower2_dedx = new TH1F("Recoshower2_dedx ", "; ; Number of Events", 50, -50, 50);
TH1F* Recoshower3_dedx = new TH1F("Recoshower3_dedx ", "; ; Number of Events", 50, -50, 50);
THStack * Negativededx = new THStack("Negativededx", "");
TH1F* NotinTPCdedx = new TH1F("NotinTPCdedx", "; ; Number of Events", 25, -100, 0);
TH1F* PoorRecodedx = new TH1F("PoorRecodedx", "; ; Number of Events", 25, -100, 0);
TH1F* Negdedx = new TH1F("Negdedx", "; ; Number of Events", 25, -100, 0);
TH1F* NegativeEnergyFirstPartdedx = new TH1F("NegativeEnergyFirstPartdedx ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* NegativededxShowerEnergy = new TH1F("NegativededxShowerEnergy ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* NegativededxFirstPart_MCshwreng = new TH1F("NegativededxFirstPart_MCshwreng ", "; Energy(MeV); Number of Events", 40, -2000, 2000);
TH1F* NegativededxMCShowerEnergy = new TH1F("NegativededxMCShowerEnergy ", "; Energy(MeV); Number of Events", 25, 100, 2000);
TH1F* Negativededxfirstpart_Recoshowerenergy = new TH1F("Negativededxfirstpart_Recoshowerenergy ", "; Energy(MeV); Number of Events", 40, -2000, 2000);
TH1F* NegativededxMCshwr_Recoshowerenergy = new TH1F("NegativededxMCshwr_Recoshowerenergy ", "; Energy(MeV); Number of Events", 40, -2000, 2000);
TH2D* Positionxy = new TH2D("Positionxy", " ; x distance (cm); y distance (cm)", 256, -128.0, 128.0, 117, -116.5, 116.5);
TH2D* Positionyz = new TH2D("Positionyz", " ; y distance (cm); z distance (cm)", 117, -116.5, 116.5, 1036, 0, 1036);
TH2D* DistvsAngleyz = new TH2D("DistvsAngleyz", " ; 3D distance (cm); yz Angle (degrees)", 250, 0, 10, 36, -180, 180);
TH2D* DistvsAnglexz = new TH2D("DistvsAnglexz", " ; 3D distance (cm); xz Angle (degrees)", 250, 0, 10, 36, -180, 180);
TH2D* DistvsAnglexy = new TH2D("DistvsAnglexy", " ; 3D distance (cm); xy Angle (degrees)", 250, 0, 10, 36, -180, 180);
if (fChain == 0) return;
/// Define how many entries are in the tree:
/// Start
Long64_t nentries = fChain->GetEntriesFast();
Long64_t nbytes = 0, nb = 0;
if (max_entry == -1) max_entry = nentries;
///End
/// Here we START to loop over all entries in the TTree
/// these are events, so be careful how you think of these events
/// Start
for (Long64_t jentry = 0; jentry < nentries && jentry < max_entry; jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
/// End
if ((jentry % 1000) == 0){ std::cout << "\t\t\t ### " << int(100 * jentry / nentries) << "% done!" << std::endl; }
/* List of useful variables that you might want to look at:
event -- this is what you call event number
subrun -- this is what you call subrun
RECONSTRUCTION INFORMATION:
nshowers -- The number of reconstruted showers (N)
showerID[N] -- A unique shower ID, just a number (int)
shwr_bestplane[N] -- The plane that has the largest (spatial) projection of hits, this is the P you should use typically
shwr_length[N] -- The length of the shower in blah dimensions
shwr_startdcosx[N] -- the "i" component of the unit vector describing the direction
shwr_startdcosy[N] -- the "j" component of the unit vector dfescribing the direction
shwr_startdcosz[N] -- the "k" component of the unit vector describing the direction
shwr_startx[N] -- the "x" posistion start point
shwr_starty[N] -- the "y" posistion start point
shwr_startz[N] -- the "z" posistion start point
shwr_totEng[N][P] -- The total energy of the shower in plane P (focus on P == 2 for now)
shwr_mipEng[N][P] -- The total energy of the shower in plane P (focus on P == 2 for now)
shwr_dedx[N][P] -- The total energy deposited at the start of the shower
MC TRUTH INFORMATION:
geant_list_size -- The number of particles (N), you will usually only be intrested in the first particle
pdg[N] -- The pdg of the n-th particle in the list
Eng[N] -- The TRUE energy of the n-th particle
Px[N] -- X-projection of the n-th particle momentum
Py[N] -- Y-projection of the n-th particle momentum
Pz[N] -- Z-projection of the n-th particle momentum
P[N] -- n-th particle momentum
StartPointx[N] -- X-projection of the n-th start point
StartPointy[N] -- Y-projection of the n-th start point
StartPointz[N] -- X-projection of the n-th start point
theta[N] -- The theta of the n-th particle
phi[N] -- the phi of the n-th particle
*/
//Here you will build your code, build whatever you want! MUHAHAHAHAHAHAHAHAHAHAHAHA@
//// EXAMPLE loop through all reco showers in event
// define boolean variables
bool Nshowers = false; // true if the number of showers is 1
bool Dist = false; // true if the shower start is within 2.5 cm of MC start
//bool Xangle = false; // true if the x angle is within 5 degrees
//bool Yangle = false; // true if the y angle is within 5 degrees
//bool Zangle = false; // true if the z angle is within 5 degrees
bool Bremphoton = false; // true if the photon has at least 5% of the total shower energy
bool Angle = false; // true if all three angles are within 5 degrees
bool XZAngle = false; // true if the xz angle is within the minangle
bool YZAngle = false; // true if the yz angle is within th minangle
double dist = 0; // starting position distance from MC start
double EngMeV = mcshwr_CombEngE[0]; // Energy of the first particle in MeV
double mindistance = 2.5; // min distance that shower start can be from MC start
double radtodegrees = 180 / 3.14; // conversion factor
double minangle = 15; // minumum angle that is considered not too far off from actual
// This is to calculate the distance between the starting point of the shower and the MC
// any number of showers greater than zero
double tempdist = 0; // variable to help find the shortest distance of a shower to the MC start
int goodshowernumber = 0; // variables that saves the "best" shower...the shower that is closest to the MC start
double xzdiff = 0; // xz angle offset
double yzdiff = 0; // yz angle offset
double MCxz_angle = 0; // MC xz angle
double MCyz_angle = 0; // MC yz angle
double MCxy_angle; // MC xy angle
double MCmag = 0; // magnitude of the direction of the MC shower (using comb eng)
double xz_angle = 0; // reconstructed shower xz angle
double yz_angle = 0; // reconstructed shower yz angle
double mag = 0; // mag of direction of reconstructed showers
double firstpartxz_angle = 0; // xz angle using momentum of first MC particle
double firstpartyz_angle = 0; // yz angle using momentum of first MC particle
double startxzdir = 0; // using startdir to find xz direction
double startyzdir = 0; // using startdir to find yz direction
// angle differences
double startdir_MCshwrxzang = 0; // Startdir - MC shower xz angle
double startdir_MCshwryzang = 0; // Startdir - MC shower yz angle
double startdir_shwrxzang = 0; // Startdir - reconstructed shower xz angle
double startdir_shwryzang = 0; // Startdir - reconstructed shower yz angle
double startdir_firstpartxzang = 0; // Startdir - first MC particle xz angle
double startdir_firstpartyzang = 0; // Startdir - first MC particle yz angle
double mcshwr_firstpartxzang = 0; // MC shower start - first MC particle xz angle
double mcshwr_firstpartyzang = 0; // MC shower start - first MC particle yz angle
double shwr_firstpartxzang = 0; // reconstructed shower - first MC particle xz angle
double shwr_firstpartyzang = 0; // reconstructed shower - first MC particle yz angle
double startdirmag = 0; // magnitude of the start direction of MC shower using variables Startdir
double smallestdiffdedx = 0; // this is the smallest difference between the calculated dedx and the MC dedx
double tempdedx = 0; // stores a temporary dedx value
int bestdedx = 0; // this is the plane that has the min dedx
// if the number of showers is greater than one then we want to look at the energy and the angle offsets
if (nshowers > 0)
{
MoreThanOneShowerEng->Fill(EngMeV);
MoreThanOneShowerxzAng->Fill(xzdiff);
MoreThanOneShoweryzAng->Fill(yzdiff);
}
// nshowers has to be greater than 0 because at nshower == 0 the variables (shower start, etc) are not empty
if (nshowers > 0)
{
// distance formula to find the 3D displacement of the shower start and the MC shower start
dist = sqrt(pow((shwr_startx[0] - mcshwr_CombEngX[0]), 2) + pow((shwr_starty[0] - mcshwr_CombEngY[0]), 2) + pow((shwr_startz[0] - mcshwr_CombEngZ[0]), 2));
// if there is more than one shower we want the shower that is closest to the MC shower start
if (nshowers > 1)
{
for (int i = 1; i < nshowers; i++)
{
// distance formula
tempdist = sqrt(pow((shwr_startx[i] - mcshwr_CombEngX[0]), 2) + pow((shwr_starty[i] - mcshwr_CombEngY[0]), 2) + pow((shwr_startz[i] - mcshwr_CombEngZ[0]), 2));
// we want the shower that is closest to the start of the MC shower
if (dist > tempdist)
{
dist = tempdist;
goodshowernumber = i;
}
}
}
// fills it in with the shower start offset
StartPointOffset->Fill(dist);
// xz and yz angles of the first particle
firstpartxz_angle = TMath::ATan2(Px[0] / P[0], Pz[0] / P[0]);
firstpartyz_angle = TMath::ATan2(Py[0] / P[0], Pz[0] / P[0]);
// xz and yz angles using MC start directions
startdirmag = sqrt(pow(mcshwr_StartDirX[0], 2) + pow(mcshwr_StartDirY[0], 2) + pow(mcshwr_StartDirZ[0], 2));
startxzdir = TMath::ATan2(mcshwr_StartDirX[0] / startdirmag, mcshwr_StartDirZ[0] / startdirmag);
startyzdir = TMath::ATan2(mcshwr_StartDirY[0] / startdirmag, mcshwr_StartDirZ[0] / startdirmag);
// xz and yz angles of the MC shower
MCmag = sqrt(pow(mcshwr_CombEngPx[0], 2) + pow(mcshwr_CombEngPy[0], 2) + pow(mcshwr_CombEngPz[0], 2));
MCxz_angle = TMath::ATan2(mcshwr_CombEngPx[0] / MCmag, mcshwr_CombEngPz[0] / MCmag);
MCyz_angle = TMath::ATan2(mcshwr_CombEngPy[0] / MCmag, mcshwr_CombEngPz[0] / MCmag);
MCxy_angle = TMath::ATan2(mcshwr_CombEngPx[0] / MCmag, mcshwr_CombEngPy[0] / MCmag);
// xz and yz angles of the reconstructed shower
mag = sqrt(pow(shwr_startdcosx[goodshowernumber], 2) + pow(shwr_startdcosy[goodshowernumber], 2) + pow(shwr_startdcosz[goodshowernumber], 2));
xz_angle = TMath::ATan2(shwr_startdcosx[goodshowernumber] / mag, shwr_startdcosz[goodshowernumber] / mag);
yz_angle = TMath::ATan2(shwr_startdcosy[goodshowernumber] / mag, shwr_startdcosz[goodshowernumber] / mag);
// xz and yz angle difference between the MC shower and the reconstructed shower
xzdiff = fabs((xz_angle - MCxz_angle) * radtodegrees);
yzdiff = fabs((yz_angle - MCyz_angle) * radtodegrees);
// makes sure the angle magnitude is between 0 to 180
xzdiff = Find_Angle(xzdiff);
yzdiff = Find_Angle(yzdiff);
// filled with the angle offsets
xzdiffang->Fill(xzdiff);
yzdiffang->Fill(yzdiff);
// filled with the MC angles
MCxzangle->Fill(MCxz_angle * radtodegrees);
MCyzangle->Fill(MCyz_angle * radtodegrees);
//filled with the shower angle
YZ_angle->Fill(yz_angle * radtodegrees);
XZ_angle->Fill(xz_angle * radtodegrees);
// start direction - MC shower angle
startdir_MCshwrxzang = fabs(startxzdir - MCxz_angle)*radtodegrees;
startdir_MCshwryzang = fabs(startyzdir - MCyz_angle)*radtodegrees;
// MC yz angle is greater than or equal to 50.0 degrees then we want to see the start position offset
if (fabs(MCyz_angle * radtodegrees) >= 50.0)
{
Startpointoffsetgreaterthan50dist->Fill(dist);
}
// magnitude of MC yz angle is greater than or equal to 60.0 degrees then we want to see the start position offset
if (fabs(MCyz_angle * radtodegrees) >= 60.0)
{
GoodAngledist->Fill(dist);
Startpointoffsetgreaterthan60dist->Fill(dist);
// magnitude of MC yz angle is between 90.0 and 180.0
if ((fabs(MCyz_angle * radtodegrees) >= 90.0) && (fabs(MCyz_angle * radtodegrees) <= 180.0))
{
EndStartpointoffsetyzangledist->Fill(dist);
}
else
{
NotEndStartpointoffsetyzangledist->Fill(dist);
}
/*
if (dist >= 1.2 && dist <= 1.8)
{
std::cout << "run: " << run << std::endl;
std::cout << "subrun: " << subrun << std::endl;
std::cout << "event: " << event << std::endl << std::endl;
}
*/
}
else
{
Startpointoffsetlessthan60dist->Fill(dist);
}
if (fabs(MCyz_angle * radtodegrees) >= 70.0)
{
Startpointoffsetgreaterthan70dist->Fill(dist);
}
if (fabs(MCyz_angle * radtodegrees) >= 80.0)
{
Startpointoffsetgreaterthan80dist->Fill(dist);
}
// if either angle is at 90 degrees
if ((fabs(MCxz_angle * radtodegrees) >= 90.0) || (fabs(MCyz_angle * radtodegrees) >= 90.0))
{
Startpointoffsetgreaterthan90dist->Fill(dist);
}
if (fabs(MCyz_angle * radtodegrees) >= 100.0)
{
Startpointoffsetgreaterthan100dist->Fill(dist);
}
if (MCyz_angle * radtodegrees >= 60.0)
{
Anglegreaterthan60dist->Fill(dist);
}
else if (MCyz_angle * radtodegrees <= -60.0)
{
Anglelessthanminus60dist->Fill(dist);
}
// 2D of distance offset vs angle
//if ((dist >= 1.0) && (dist <= 2.0))
//{
DistvsAngleyz->Fill(dist, MCyz_angle * radtodegrees);
DistvsAnglexz->Fill(dist, MCxz_angle * radtodegrees);
DistvsAnglexy->Fill(dist, MCxy_angle * radtodegrees);
//}
//magnitude of the MC xz angle is greater than or equal to 60.0 degrees
if ((fabs(MCxz_angle * radtodegrees) >= 60.0))
{
Startpointoffsetxzangledistlessthan->Fill(dist);
// magnitude of the MC xz angle is between 90.0 and 180.0 degrees
if ((fabs(MCxz_angle * radtodegrees) >= 90.0) && (fabs(MCxz_angle * radtodegrees) <= 180.0))
{
EndStartpointoffsetxzangledist->Fill(dist);
}
// or not
else
{
NotEndStartpointoffsetxzangledist->Fill(dist);
}
}
// parallel to either of the three wire planes
if ((MCyz_angle * radtodegrees <= 35.0) && (MCyz_angle * radtodegrees >= 25.0) || (MCyz_angle * radtodegrees <= -145.0) && (MCyz_angle * radtodegrees >= -155.0)
|| (MCyz_angle * radtodegrees >= -35.0) && (MCyz_angle * radtodegrees <= -25.0) || (MCyz_angle * radtodegrees >= 145.0) && (MCyz_angle * radtodegrees <= 155.0)
|| (MCyz_angle * radtodegrees >= 85.0) && (MCyz_angle * radtodegrees <= 95.0) || (MCyz_angle * radtodegrees >= -95.0) && (MCyz_angle * radtodegrees <= -85.0))
{
ParallelAngledist->Fill(dist);
}
else
{
NotParallelAngledist->Fill(dist);
}
// this checks if the MC yz angle is approximately parallel to the U wire plane
// not actually sure if this corresponds to the U plane or the V plane
if ((MCyz_angle * radtodegrees <= 35.0) && (MCyz_angle * radtodegrees >= 25.0) || (MCyz_angle * radtodegrees <= -145.0) && (MCyz_angle * radtodegrees >= -155.0))
{
Uplanedist->Fill(dist);
//std::cout << "run: " << run << std::endl;
//std::cout << "subrun: " << subrun << std::endl;
//std::cout << "event: " << event << std::endl << std::endl;
}
// if the angle is not parallel to the U/V plane then is the start position offset
else
{
Unotplanedist->Fill(dist);
}
// this checks if the MC yz angle is approximately parallel to the V wire plane
// not actually sure if this corresponds to the U plane or the V plane
if ((MCyz_angle * radtodegrees >= -35.0) && (MCyz_angle * radtodegrees <= -25.0) || (MCyz_angle * radtodegrees >= 145.0) && (MCyz_angle * radtodegrees <= 155.0))
{
Vplanedist->Fill(dist);
}
// if the angle is not parallel to the U/V plane then is the start position offset
else
{
Vnotplanedist->Fill(dist);
}
// this checks if the MC yz angle is approximately parallel to the Y wire plane
if ((MCyz_angle * radtodegrees >= 85.0) && (MCyz_angle * radtodegrees <= 95.0) || (MCyz_angle * radtodegrees >= -95.0) && (MCyz_angle * radtodegrees <= -85.0))
{
Yplanedist->Fill(dist);
}
// if the angle is not parallel to the Y plane then what is the start position offset
else
{
Ynotplanedist->Fill(dist);
}
// checks what is 0 degrees and what is 90 degrees
/*if (fabs(MCxz_angle * radtodegrees) <= 2.0)
{
std::cout << "x: " << Px[0] << std::endl;
std::cout << "y: " << Py[0] << std::endl;
std::cout << "z: " << Pz[0] << std::endl;
}
*/
startdir_MCshwrxzang = Find_Angle(startdir_MCshwrxzang);
startdir_MCshwryzang = Find_Angle(startdir_MCshwryzang);
Startdir_MCshwrxzang->Fill(startdir_MCshwrxzang);
Startdir_MCshwryzang->Fill(startdir_MCshwryzang);
// start direction - shower angle
startdir_shwrxzang = fabs(startxzdir - xz_angle)*radtodegrees;
startdir_shwryzang = fabs(startyzdir - yz_angle)*radtodegrees;
startdir_shwrxzang = Find_Angle(startdir_shwrxzang);
startdir_shwryzang = Find_Angle(startdir_shwryzang);
Startdir_shwrxzang->Fill(startdir_shwrxzang);
Startdir_shwryzang->Fill(startdir_shwryzang);
// start direction - MC first particle
startdir_firstpartxzang = fabs(startxzdir - firstpartxz_angle)*radtodegrees;
startdir_firstpartyzang = fabs(startyzdir - firstpartyz_angle)*radtodegrees;
startdir_firstpartxzang = Find_Angle(startdir_firstpartxzang);
startdir_firstpartyzang = Find_Angle(startdir_firstpartyzang);
Startdir_firstpartxzang->Fill(startdir_firstpartxzang);
Startdir_firstpartyzang->Fill(startdir_firstpartyzang);
// MC shower - MC first particle
mcshwr_firstpartxzang = fabs(MCxz_angle - firstpartxz_angle)*radtodegrees;
mcshwr_firstpartyzang = fabs(MCyz_angle - firstpartyz_angle)*radtodegrees;
mcshwr_firstpartxzang = Find_Angle(mcshwr_firstpartxzang);
mcshwr_firstpartyzang = Find_Angle(mcshwr_firstpartyzang);
MCshwr_firstpartxzang->Fill(mcshwr_firstpartxzang);
MCshwr_firstpartyzang->Fill(mcshwr_firstpartyzang);
// shower start - first particle
shwr_firstpartxzang = fabs(xz_angle - firstpartxz_angle)*radtodegrees;
shwr_firstpartyzang = fabs(yz_angle - firstpartyz_angle)*radtodegrees;
shwr_firstpartxzang = Find_Angle(shwr_firstpartxzang);
shwr_firstpartyzang = Find_Angle(shwr_firstpartyzang);
Shwr_firstpartxzang->Fill(shwr_firstpartxzang);
Shwr_firstpartyzang->Fill(shwr_firstpartyzang);
// we also want to compare the starting position of the shower to the starting position of the first particle
// any shower number greater than 0
if (pdg[0] == 11 || pdg[0] == -11)
{
// difference in the reconstructed shower start position and the first particle in the MC truth
Diffxdist->Fill(shwr_startx[goodshowernumber] - StartPointx[0]);
Diffydist->Fill(shwr_starty[goodshowernumber] - StartPointy[0]);
Diffzdist->Fill(shwr_startz[goodshowernumber] - StartPointz[0]);
// difference in the reconstructed shower start position and the MC shower comb energy start
DiffMCCombxdist->Fill(shwr_startx[goodshowernumber] - mcshwr_CombEngX[0]);
DiffMCCombydist->Fill(shwr_starty[goodshowernumber] - mcshwr_CombEngY[0]);
DiffMCCombzdist->Fill(shwr_startz[goodshowernumber] - mcshwr_CombEngZ[0]);
// difference in the reconstructed shower start and the MC shower start
DiffMCxdist->Fill(shwr_startx[goodshowernumber] - mcshwr_startX[0]);
DiffMCydist->Fill(shwr_starty[goodshowernumber] - mcshwr_startY[0]);
DiffMCzdist->Fill(shwr_startz[goodshowernumber] - mcshwr_startZ[0]);
// difference in the MC shower comb energy start and the MC shower start
DiffMCCxdist->Fill(mcshwr_CombEngX[0] - mcshwr_startX[0]);
DiffMCCydist->Fill(mcshwr_CombEngY[0] - mcshwr_startY[0]);
DiffMCCzdist->Fill(mcshwr_CombEngZ[0] - mcshwr_startZ[0]);
// MC yz angle is greater than 60 degrees then fill with the shower start difference
if ((fabs(MCyz_angle * radtodegrees) >= 60.0))
{
Diffxdistmaggreaterthan60->Fill(shwr_startx[goodshowernumber] - StartPointx[0]);
Diffydistmaggreaterthan60->Fill(shwr_starty[goodshowernumber] - StartPointy[0]);
Diffzdistmaggreaterthan60->Fill(shwr_startz[goodshowernumber] - StartPointz[0]);
//std::cout << "run: " << run << std::endl;
//std::cout << "subrun: " << subrun << std::endl;
//std::cout << "event: " << event << std::endl << std::endl;
}
else
{
Diffxdistmaglessthan60->Fill(shwr_startx[goodshowernumber] - StartPointx[0]);
Diffydistmaglessthan60->Fill(shwr_starty[goodshowernumber] - StartPointy[0]);
Diffzdistmaglessthan60->Fill(shwr_startz[goodshowernumber] - StartPointz[0]);
}
if ((MCyz_angle * radtodegrees >= 60.0) && (MCyz_angle * radtodegrees <= 180.0))
{
Diffxdistgreaterthan60->Fill(shwr_startx[goodshowernumber] - StartPointx[0]);
Diffydistgreaterthan60->Fill(shwr_starty[goodshowernumber] - StartPointy[0]);
Diffzdistgreaterthan60->Fill(shwr_startz[goodshowernumber] - StartPointz[0]);
}
else if ((MCyz_angle * radtodegrees >= -180.0) && (MCyz_angle * radtodegrees <= -60.0))
{
Diffxdistlessthanminus60->Fill(shwr_startx[goodshowernumber] - StartPointx[0]);
Diffydistlessthanminus60->Fill(shwr_starty[goodshowernumber] - StartPointy[0]);
Diffzdistlessthanminus60->Fill(shwr_startz[goodshowernumber] - StartPointz[0]);
}
// we want to see how the start position is bias
// whether the shower start is before the actual shower start or if it is after the atual shower start
if (Px[0] > 0)
{
Posmomentumxdist->Fill(shwr_startx[goodshowernumber] - StartPointx[0]);
}
else
{
Negmomentumxdist->Fill(shwr_startx[goodshowernumber] - StartPointx[0]);
}
if (Py[0] > 0)
{
Posmomentumydist->Fill(shwr_starty[goodshowernumber] - StartPointy[0]);
}
else
{
Negmomentumydist->Fill(shwr_starty[goodshowernumber] - StartPointy[0]);
}
if (Pz[0] > 0)
{
Posmomentumzdist->Fill(shwr_startz[goodshowernumber] - StartPointz[0]);
}
else
{
Negmomentumzdist->Fill(shwr_startz[goodshowernumber] - StartPointz[0]);
}
}
else if (pdg[0] == 22)
{
// calculate the start positon offset
// for first particle in MC truth
Diffxdist->Fill(shwr_startx[goodshowernumber] - EndPointx[0]);
Diffydist->Fill(shwr_starty[goodshowernumber] - EndPointy[0]);
Diffzdist->Fill(shwr_startz[goodshowernumber] - EndPointz[0]);
//for MC shower comb energy
DiffMCCombxdist->Fill(shwr_startx[goodshowernumber] - mcshwr_CombEngX[0]);
DiffMCCombydist->Fill(shwr_starty[goodshowernumber] - mcshwr_CombEngY[0]);
DiffMCCombzdist->Fill(shwr_startz[goodshowernumber] - mcshwr_CombEngZ[0]);
// for MC shower end
DiffMCxdist->Fill(shwr_startx[goodshowernumber] - mcshwr_endX[0]);
DiffMCydist->Fill(shwr_starty[goodshowernumber] - mcshwr_endY[0]);
DiffMCzdist->Fill(shwr_startz[goodshowernumber] - mcshwr_endZ[0]);
DiffMCCxdist->Fill(mcshwr_CombEngX[0] - mcshwr_endX[0]);
DiffMCCydist->Fill(mcshwr_CombEngY[0] - mcshwr_endY[0]);
DiffMCCzdist->Fill(mcshwr_CombEngZ[0] - mcshwr_endZ[0]);
if ((fabs(MCyz_angle * radtodegrees) >= 60.0))
{
Diffxdistmaggreaterthan60->Fill(shwr_startx[goodshowernumber] - EndPointx[0]);
Diffydistmaggreaterthan60->Fill(shwr_starty[goodshowernumber] - EndPointy[0]);
Diffzdistmaggreaterthan60->Fill(shwr_startz[goodshowernumber] - EndPointz[0]);
}
else
{
Diffxdistmaglessthan60->Fill(shwr_startx[goodshowernumber] - EndPointx[0]);
Diffydistmaglessthan60->Fill(shwr_starty[goodshowernumber] - EndPointy[0]);
Diffzdistmaglessthan60->Fill(shwr_startz[goodshowernumber] - EndPointz[0]);
}
if ((MCyz_angle * radtodegrees >= 60.0) && (MCyz_angle * radtodegrees <= 180.0))
{
Diffxdistgreaterthan60->Fill(shwr_startx[goodshowernumber] - EndPointx[0]);
Diffydistgreaterthan60->Fill(shwr_starty[goodshowernumber] - EndPointy[0]);
Diffzdistgreaterthan60->Fill(shwr_startz[goodshowernumber] - EndPointz[0]);
}
else if ((MCyz_angle * radtodegrees >= -180.0) && (MCyz_angle * radtodegrees <= -60.0))
{
Diffxdistlessthanminus60->Fill(shwr_startx[goodshowernumber] - EndPointx[0]);
Diffydistlessthanminus60->Fill(shwr_starty[goodshowernumber] - EndPointy[0]);
Diffzdistlessthanminus60->Fill(shwr_startz[goodshowernumber] - EndPointz[0]);
}
// we want to see how the start position is bias
// whether the shower start is before the actual shower start or if it is after the atual shower start
if (Px[0] > 0)
{
Posmomentumxdist->Fill(shwr_startx[goodshowernumber] - EndPointx[0]);
}
else
{
Negmomentumxdist->Fill(shwr_startx[goodshowernumber] - EndPointx[0]);
}
if (Py[0] > 0)
{
Posmomentumydist->Fill(shwr_starty[goodshowernumber] - EndPointy[0]);
}
else
{
Negmomentumydist->Fill(shwr_starty[goodshowernumber] - EndPointy[0]);
}
if (Pz[0] > 0)
{
Posmomentumzdist->Fill(shwr_startz[goodshowernumber] - EndPointz[0]);
}
else
{
Negmomentumzdist->Fill(shwr_startz[goodshowernumber] - EndPointz[0]);
}
}
// if the angles are within the cut then the boolean variable is true
if (xzdiff < minangle)
{
XZAngle = true;
}
if (yzdiff < minangle)
{
YZAngle = true;
}
// if both booleans are true then Angle is true
if (XZAngle && YZAngle)
{
Angle = true;
}
}
// looking at events with only one shower
// we first find the plane that has the smallest dedx value
// compare that value with the value of the dedx of the best plane
if (nshowers > 0)
{
smallestdiffdedx = 0; // this is the smallest difference between the calculated dedx and the MC dedx
bestdedx = 0; // this is the plane that has the smallest difference in dedx
tempdedx = 0; // this is a variable holder
for (int i = 0; i < 3; i++)
{
smallestdiffdedx = fabs(mcshwr_dEdx[0] - shwr_dedx[0][0]);
tempdedx = fabs(mcshwr_dEdx[0] - shwr_dedx[0][i]);
if (smallestdiffdedx > tempdedx)
{
smallestdiffdedx = tempdedx;
bestdedx = i;
}
}
// checks to see if the best plane has the best dedx?
bestplanededx->Fill(shwr_dedx[0][bestdedx] - shwr_dedx[0][shwr_bestplane[0]]);
// this is the difference in dedx of the MC and of the Reconstructed Shower with the dedx of the min plane
diffshower_dedx->Fill(shwr_dedx[goodshowernumber][bestdedx] - mcshwr_dEdx[0]);
MCshower_dedx->Fill(mcshwr_dEdx[0]);
Recoshowerbest_dedx->Fill(shwr_dedx[goodshowernumber][bestdedx]);
Recoshower1_dedx->Fill(shwr_dedx[0][0]);
Recoshower2_dedx->Fill(shwr_dedx[0][1]);
Recoshower3_dedx->Fill(shwr_dedx[0][2]);
}
// negative dedx
// we first check if any of the planes have a negative dedx
if ((shwr_dedx[0][0] < 0) || (shwr_dedx[0][1] < 0) || (shwr_dedx[0][2]) < 0))
{
// fill with the position of the first MC particle
if (pdg[0] == 11 || pdg[0] == -11)
{
Positionxy->Fill(StartPointx[0], StartPointy[0]);
Positionyz->Fill(StartPointy[0], StartPointz[0]);
}
else
{
Positionxy->Fill(EndPointx[0], EndPointy[0]);
Positionyz->Fill(StartPointy[0], StartPointz[0]);
}
// values of the negative dedx in the first plane
if ((shwr_dedx[0][0] < 0))
{
Negdedx->Fill(shwr_dedx[0][0]);
// if dedx is negative is the shower in the tpc?
if (mcshwr_dEdx[0] == -99999)
{
NotinTPCdedx->Fill(shwr_dedx[0][0]);
}
else
{
// if it is in the TPC is it poorly reconstructed?
if ((dist > 2.5) || (xzdiff > 15) || (yzdiff > 15))
{
PoorRecodedx->Fill(shwr_dedx[0][0]);
}
}
}
// values of the negative dedx in the second plane
else if (shwr_dedx[0][1] < 0)
{
Negdedx->Fill(shwr_dedx[0][1]);
// if dedx is negative is the shower in the tpc?
if (mcshwr_dEdx[0] == -99999)
{
NotinTPCdedx->Fill(shwr_dedx[0][1]);
}
else
{
// if it is in the TPC is it poorly reconstructed?
if ((dist > 2.5) || (xzdiff > 15) || (yzdiff > 15))
{
PoorRecodedx->Fill(shwr_dedx[0][0]);
}
}
}
// values of the negative dedx in the third plane
else if (shwr_dedx[0][2]) < 0)
{
Negdedx->Fill(shwr_dedx[0][2]);
// if dedx is negative is the shower in the tpc?
if (mcshwr_dEdx[0] == -99999)
{
NotinTPCdedx->Fill(shwr_dedx[0][2]);
}
else
{
// if it is in the TPC is it poorly reconstructed?
if ((dist > 2.5) || (xzdiff > 15) || (yzdiff > 15))
{
PoorRecodedx->Fill(shwr_dedx[0][0]);
}
}
}
}
// looking at showers with negative dedx
if (nshowers > 0)
{
if ((shwr_dedx[0][0] < 0) || (shwr_dedx[0][1] < 0) || (shwr_dedx[0][2]) < 0))
{
Negativededxdist->Fill(dist);
Negativededxxzang->Fill(xzdiff);
Negativededxyzang->Fill(yzdiff);
NegativeEnergyFirstPartdedx->Fill(Eng[0] * 1000);
NegativededxMCShowerEnergy->Fill(mcshwr_CombEngE[0]);
NegativededxFirstPart_MCshwreng->Fill(Eng[0] * 1000 - mcshwr_CombEngE[0]);
NegativededxShowerEnergy->Fill(shwr_totEng[goodshowernumber][bestdedx]);
Negativededxfirstpart_Recoshowerenergy->Fill(Eng[0] * 1000 - shwr_totEng[goodshowernumber][bestdedx]);
NegativededxMCshwr_Recoshowerenergy->Fill(mcshwr_CombEngE[0] - shwr_totEng[goodshowernumber][bestdedx]);
}
}
// Number of Showers
NumShowers->Fill(nshowers);
// go through every particle in the shower and find its energy relative to the total energy and find out how far it travels
// find photons with large energy in the shower
// catastrophic brem
for (int i = 1; i < geant_list_size; i++) // checks every particle in the event
{
if (Eng[i] >= Eng[0] * 0.05 && pdg[i] == 22) // if photon has 5% or more of the total energy