-
Notifications
You must be signed in to change notification settings - Fork 0
/
2prova.C
2265 lines (1973 loc) · 120 KB
/
2prova.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
#include <TH1D.h>
#include <TH2F.h>
#include <TGraphErrors.h>
//#include <LHAPDF/LHAPDF.h>
#include <TFile.h>
#include <TCanvas.h>
#include <TVector3.h>
#include <TAxis.h>
#include <vector>
#include <TMath.h>
#include "TLorentzVector.h"
#include <cmath>
// per far funzionare il programma
// . /cvmfs/sft.cern.ch/lcg/views/LCG_105a/x86_64-centos7-gcc11-opt/setup.sh
// root
// .L taskB.C
// .L run_all.C
// run()
// NON SO MAGARI SERVONO PER LA NNPDF
// gSystem->AddIncludePath("/cvmfs/sft.cern.ch/lcg/views/LCG_105a/x86_64-centos7-gcc11-opt/include");
//gSystem->AddLinkPath("/cvmfs/sft.cern.ch/lcg/views/LCG_105a/x86_64-centos7-gcc11-opt/lib");
std::vector<double> CreateLogBinning(int nbins, double xmin, double xmax) {
std::vector<double> bin_edges(nbins + 1);
double logxmin = std::log10(xmin);
double logxmax = std::log10(xmax);
double bin_width = (logxmax - logxmin) / nbins;
for (int i = 0; i <= nbins; ++i) {
bin_edges[i] = std::pow(10, logxmin + i * bin_width);
}
return bin_edges;
}
enum EnPID{
kelectron,
kpion,
kkaon,
kproton,
kany
};
/*
double CalcolaMedia(const std::vector<double>& dati) {
double somma = 0;
for (double valore : dati) {
somma += valore;
}
return somma / dati.size();
}
double CalcolaErroreStatistico(const std::vector<double>& dati) {
double media = CalcolaMedia(dati);
double somma_quad = 0;
for (double valore : dati) {
somma_quad += (valore - media) * (valore - media);
}
double deviazione_std = sqrt(somma_quad / (dati.size() - 1));
return deviazione_std / sqrt(dati.size()); // Errore standard della media
}
*/
int checkRecoID(int recpdg){
switch (std::abs(recpdg)){
case 0 :
return kany;
case 11 :
return kelectron;
case 211 :
return kpion;
case 321 :
return kkaon;
case 2212 :
return kproton;
default :
Printf ("any particle pdg: %i", recpdg);
return kany;
}
}
/*
// 1889, 1888, 1887, 1886, 1885, 1884, 1883, 1882, 1881, 1880, 1822, 1803, 1802, 1801, 1800
// pythia8CCDIS_18x275_minQ2=1000_beamEffects_xAngle=-0.025_hiDiv_5.2026.eicrecon.tree.edm4eic.root
// pythia_ep_noradcor_10x275_q2_0.000000001_1.0_run15.ab.0199.eicrecon.tree.edm4eic.root
// pythia_ep_noradcor_18x275_q2_0.000000001_1.0_run9.ab.1887.eicrecon.tree.edm4eic.root
void pino(TString infile1="pythia_ep_noradcor_18x275_q2_0.000000001_1.0_run9.ab.1887.eicrecon.tree.edm4eic.root",
TString infile2="pythia_ep_noradcor_18x275_q2_0.000000001_1.0_run9.ab.1888.eicrecon.tree.edm4eic.root",
TString infile3="pythia_ep_noradcor_18x275_q2_0.000000001_1.0_run9.ab.1889.eicrecon.tree.edm4eic.root")
{
*/
/*
void pino(TString infile1="pythia_ep_noradcor_10x275_q2_0.000000001_1.0_run15.ab.0199.eicrecon.tree.edm4eic.root",
TString infile2="pythia_ep_noradcor_10x275_q2_0.000000001_1.0_run15.ab.0198.eicrecon.tree.edm4eic.root",
TString infile3="pythia_ep_noradcor_10x275_q2_0.000000001_1.0_run15.ab.0200.eicrecon.tree.edm4eic.root")
{
*/
// pythia8NCDIS_18x275_minQ2=1_beamEffects_xAngle=-0.025_hiDiv_4.1467.eicrecon.tree.edm4eic.root
// pythia8NCDIS_18x275_minQ2=1_beamEffects_xAngle=-0.025_hiDiv_5.1688.eicrecon.tree.edm4eic.root
// da 1449 a 1469
void pino(const char* inputFile1, const char* inputFile2, const char* inputFile3, const char* outputFile){
/*
void pino(TString infile1="pythia8NCDIS_18x275_minQ2=1_beamEffects_xAngle=-0.025_hiDiv_4.1469.eicrecon.tree.edm4eic.root",
TString infile2="pythia8NCDIS_18x275_minQ2=1_beamEffects_xAngle=-0.025_hiDiv_4.1468.eicrecon.tree.edm4eic.root",
TString infile3="pythia8NCDIS_18x275_minQ2=1_beamEffects_xAngle=-0.025_hiDiv_4.1467.eicrecon.tree.edm4eic.root"){
*/
// Set output file for the histograms 11-16
TFile *ofile = TFile::Open(outputFile, "RECREATE");
// Set up input file chain
TChain *mychain = new TChain("events");
mychain->Add(inputFile1);
mychain->Add(inputFile2);
mychain->Add(inputFile3);
// Initialize reader
TTreeReader tree_reader(mychain);
// Get Particle Information
TTreeReaderArray<int> partGenStat(tree_reader, "MCParticles.generatorStatus");
TTreeReaderArray<float> partMomX(tree_reader, "MCParticles.momentum.x");
TTreeReaderArray<float> partMomY(tree_reader, "MCParticles.momentum.y");
TTreeReaderArray<float> partMomZ(tree_reader, "MCParticles.momentum.z");
TTreeReaderArray<int> partPdg(tree_reader, "MCParticles.PDG");
TTreeReaderArray<int> parentsIndex(tree_reader, "_MCParticles_parents.index");
TTreeReaderArray<int> daughterIndex(tree_reader, "_MCParticles_daughters.index");
TTreeReaderArray<unsigned int> par(tree_reader, "MCParticles.parents_end");
// Get Reconstructed Track Information
TTreeReaderArray<float> trackMomX(tree_reader, "ReconstructedChargedParticles.momentum.x");
TTreeReaderArray<float> trackMomY(tree_reader, "ReconstructedChargedParticles.momentum.y");
TTreeReaderArray<float> trackMomZ(tree_reader, "ReconstructedChargedParticles.momentum.z");
TTreeReaderArray<int> recPdg(tree_reader, "ReconstructedChargedParticles.PDG");
// Get Associations Between MCParticles and ReconstructedChargedParticles
TTreeReaderArray<unsigned int> recoAssoc(tree_reader, "ReconstructedChargedParticleAssociations.recID");
TTreeReaderArray<unsigned int> simuAssoc(tree_reader, "ReconstructedChargedParticleAssociations.simID");
// SCATTERED ELECTRON
TH1D *scatEl = new TH1D("scatEl", "scattered electron Mom; GeV^2", 80, 0, 20.);
TH1D *recScatEl = new TH1D("RecScatElectron", "reconstruction of scattered electron Mom; GeV^2",80, 0, 18.);
TH1D *scatElAngle = new TH1D("ScatElAngle", "Angle of the scattered electron; Theta", 80, 0., 180.);
// GRAFICI DI ETA
TH1D *truepionEta = new TH1D("truepionEta","Eta of charged Pions;Eta",80,-3.5,3.5);
TH1D *RecpionEta = new TH1D("RecpionEta","Eta of reconstructed Pions+;Eta",80,-3.5,3.5);
TH1D *truekaonEta = new TH1D("truekaonEta","Eta of charged Kaons;Eta",80,-3.5,3.5);
TH1D *ReckaonEta = new TH1D("ReckaonEta","Eta of reconstructed K+;Eta",80,-3.5,3.5);
TH1D *trueprotonEta = new TH1D("trueprotonEta","Eta of charged Protons;Eta",80,-3.5,3.5);
TH1D *RecprotonEta = new TH1D("RecprotonEta","Eta of reconstructed Protons;Eta",80,-3.5,3.5);
// GRAFICI DI PHI
TH1D *truepionPhi = new TH1D("truepionPhi","Phi of charged Pions; Phi",80,0,25);
TH1D *RecpionPhi = new TH1D("RecpionPhi","Phi of reconstructed Pions+; Phi",80,0,25);
TH1D *truekaonPhi = new TH1D("truekaonPhi","Phi of charged Kaons; Phi",80,0,25);
TH1D *ReckaonPhi = new TH1D("ReckaonPhi","Phi of reconstructed Kaons+; Phi",80,0,25);
TH1D *trueprotonPhi = new TH1D("trueprotonPhi","Phi of charged Protons; Phi",80,0,25);
TH1D *RecprotonPhi = new TH1D("RecprotonPhi","Phi of reconstructed Protons; Phi",80,0,25);
TH2D *PIDgen2rec = new TH2D("controlloPDG", "Reconstruction table; PDG gen; PDG rec",5, 0., 5., 5, 0., 5.);
char part[6][3] = {"","e", "pi", "K", "p", "x"};
for(int i = 1; i<6; i++){
PIDgen2rec->GetXaxis()->SetBinLabel(i, part[i]);
PIDgen2rec->GetYaxis()->SetBinLabel(i, part[i]);
}
// GRAFICI DI Q^2
int nbins = 80;
int nbon = 60;
int nben = 60;
int nbun = 40;
double xmin_xbj = 5e-3;
double xmax_xbj = 1;
double xmin_Q2 = 0.9;
double xmax_Q2 = 100.;
double qm = 1;
double qM = 1e4;
double xM = 1;
std::vector<double> log_bins_Q2 = CreateLogBinning(nbins, xmin_Q2, xmax_Q2);
std::vector<double> log_bins_xbj = CreateLogBinning(nbins, xmin_xbj, xmax_xbj);
std::vector<double> log_bins_x = CreateLogBinning(nbon, xmin_xbj, xM);
std::vector<double> log_bins_Q = CreateLogBinning(nbon, qm, qM);
TH2D *xQplane = new TH2D("xQplane", "Q^2 vs x_B | pion | y<0.95; x_B; Q^2", nbon, log_bins_x.data(), nbon, log_bins_Q.data());
TH1D *truepionQ2 = new TH1D("truepionQ2", "Production of Pions+ in function of Q^2; GeV^2", nbins, log_bins_Q2.data());
TH1D *RecpionQ2 = new TH1D("RecpionQ2", "Reconstruction of Pions+ in function of Q^2; GeV^2", nbins, log_bins_Q2.data());
TH1D *truekaonQ2 = new TH1D("truekaonQ2", "Production of Kaons in function of Q^2; GeV^2", nbins, log_bins_Q2.data());
TH1D *ReckaonQ2 = new TH1D("ReckaonQ2", "Reconstruction of Kaons in function of Q^2; GeV^2", nbins, log_bins_Q2.data());
TH1D *trueprotonQ2 = new TH1D("trueprotonQ2", "Production of Protons in function of Q^2; GeV^2", nbins, log_bins_Q2.data());
TH1D *RecprotonQ2 = new TH1D("RecprotonQ2", "Production of Protons in function of Q^2; GeV^2", nbins, log_bins_Q2.data());
// GRAFICI DI x_B
TH1D *truepion_xbj = new TH1D("truepion_xbj", "Production of Pions+ in function of x_Bj; x_Bj", nbins, log_bins_xbj.data());
TH1D *Recpion_xbj = new TH1D("Recpion_xbj", "Reconstruction of Pions+ in function of x_Bj; x_Bj", nbins, log_bins_xbj.data());
TH1D *truekaon_xbj = new TH1D("truekaon_xbj", "Production of Kaons in function of x_Bj;", nbins, log_bins_xbj.data());
TH1D *Reckaon_xbj = new TH1D("Reckaon_xbj", "Reconstruction of Kaons in function of x_Bj;", nbins, log_bins_xbj.data());
TH1D *trueproton_xbj = new TH1D("trueproton_xbj", "Production of Protons in function of x_Bj", nbins, log_bins_xbj.data());
TH1D *Recproton_xbj = new TH1D("Recproton_xbj", "Reconstruction of Protons in function of x_Bj", nbins, log_bins_xbj.data());
// GRAFICI DI z
double xmin_z = 1e-4;
double xmax_z = 1;
std::vector<double> log_bins_z = CreateLogBinning(nbins, xmin_z, xmax_z);
TH1D *truepion_z = new TH1D("truepion_z", "Production of Pions+ in function of z; z", nbins, log_bins_z.data());
TH1D *Recpion_z = new TH1D("Recpion_z", "Reconstruction of Pions+ in function of z; z", nbins, log_bins_z.data());
TH1D *truekaon_z = new TH1D("truekaon_z", "Production of Kaons in function of z", nbins, log_bins_z.data());
TH1D *Reckaon_z = new TH1D("Reckaon_z", "Reconstruction of kaons in function of z", nbins, log_bins_z.data());
TH1D *trueproton_z = new TH1D("trueproton_z", "Production of Protons in function of z", nbins, log_bins_z.data());
TH1D *Recproton_z = new TH1D("Recproton_z", "Reconstruction of Protons in function of z", nbins, log_bins_z.data());
// GRAFICI DI P_hT
double xmin_PhT = 1e-2;
double xmax_PhT = 50;
std::vector<double> log_bins_PhT = CreateLogBinning(nbins, xmin_PhT, xmax_PhT);
TH1D *truepion_PhT = new TH1D("truepion_PhT", "Production of Pions+ in function of P_hT; GeV", nbins, log_bins_PhT.data());
TH1D *Recpion_PhT = new TH1D("Recpion_PhT", "Reconstruction of Pions+ in function of P_hT; GeV", nbins, log_bins_PhT.data());
TH1D *truekaon_PhT = new TH1D("truekaon_PhT", "Production of Kaons in function of P_hT; GeV", nbins, log_bins_PhT.data());
TH1D *Reckaon_PhT = new TH1D("Reckaon_PhT", "Reconstruction of Kaons in function of P_hT; GeV", nbins, log_bins_PhT.data());
TH1D *trueproton_PhT = new TH1D("trueproton_PhT", "Production of Protons in function of P_hT; GeV", nbins, log_bins_PhT.data());
TH1D *Recproton_PhT = new TH1D("Recproton_PhT", "Reconstruction of Protons in function of P_hT; GeV", nbins, log_bins_PhT.data());
// GRACIFI DEL mom
double xmin_mom = 1e-1;
double xmax_mom = 50;
std::vector<double> log_bins_mom = CreateLogBinning(nbins, xmin_mom, xmax_mom);
TH1D *truepion_mom = new TH1D("truepion_mom", "Production of Pions+ in function of Mom; GeV", 80, log_bins_mom.data());
TH1D *Recpion_mom = new TH1D("Recpion_mom", "Reconstruction of Pions+ in function of Mom; GeV", 80, log_bins_mom.data());
TH1D *truekaon_mom = new TH1D("truekaon_mom", "Production of Kaons in function of Mom; GeV", 80, log_bins_mom.data());
TH1D *Reckaon_mom = new TH1D("Reckaon_mom", "Reconstruction of Kaons in function of Mom; GeV", 80, log_bins_mom.data());
TH1D *trueproton_mom = new TH1D("trueproton_mom", "Production of Protons in function of Mom; GeV", 80, log_bins_mom.data());
TH1D *Recproton_mom = new TH1D("Recproton_mom", "Reconstruction of Protons in function of Mom; GeV", 80, log_bins_mom.data());
// PROVA GRAFICI 2D
double xmin_q2 = 1;
double xmax_q2 = 100;
std::vector<double> log_bins_Mom = CreateLogBinning(nben, xmin_mom, xmax_mom);
std::vector<double> log_bins_Q22 = CreateLogBinning(nben, xmin_q2, xmax_q2);
std::vector<double> log_bins_PhT2 = CreateLogBinning(nben, xmin_PhT, xmax_PhT);
std::vector<double> log_bins_z2 = CreateLogBinning(nben, xmin_z, xmax_z);
std::vector<double> log_bins_xbj2 = CreateLogBinning(nben, xmin_xbj, xmax_xbj);
TH2D *pion_MomVsQ2 = new TH2D("pion_MomVsQ2", "Mom vs Q^2 | pion | y<0.95; Mom [GeV]; Q^2 [GeV^2]", nben, 0, 50, nben, log_bins_Q22.data());
TH2D *pion_MomVsEta = new TH2D("pion_MomVsEta", "Mom vs Eta | pion | y<0.95; Eta; Mom [GeV]", nben, -3.5 ,3.5, nben, 0, 50);
TH2D *pion_MomVsPhi = new TH2D("pion_MomVsTheta", "Mom vs Theta (Polar) | pion | y<0.95; Theta [Deg]; Mom [GeV]", nben, 0, 180, nben, 0, 50);
TH2D *pion_MomVsTheta = new TH2D("pion_MomVsPhi", "Mom vs Phi (Azimuth) | pion | y<0.95; Phi [Deg]; Mom [GeV]", nben, -180, 180, nben, 0, 50);
TH2D *pion_MomVsTheta_HP = new TH2D("pion_MomVsTheta_HP", "Mom vs Theta (Polar, Hadron plane) | pion | y<0.95; Theta [Deg]; Mom [GeV]", nben, 0, 180, nben, 0, 50);
TH2D *pion_MomVsPhi_HP = new TH2D("pion_MomVsPhi_HP", "Mom vs Phi (Azimuth, Hadron plane) | pion | y<0.95; Phi [Deg]; Mom [GeV]", nben, -180, 180, nben, 0, 50);
TH2D *pion_MomVsEta_rec = new TH2D("pion_MomVsEta_rec", "Mom vs Eta (MC Reco) | pion | y<0.95; Eta; Mom [GeV]", nben, -3.5 ,3.5, nben, 0, 50);
TH2D *pion_MomVsPhi_rec = new TH2D("pion_MomVsTheta_rec", "Mom vs Theta (Polar) (MC Reco) | pion | y<0.95; Theta [Deg]; Mom [GeV]", nben, 0, 180, nben, 0, 50);
TH2D *pion_MomVsTheta_rec = new TH2D("pion_MomVsPhi_rec", "Mom vs Phi (Azimuth) (MC Reco) | pion | y<0.95; Phi [Deg]; Mom [GeV]", nben, -180, 180, nben, 0, 50);
TH2D *pion_PhTVsQ2 = new TH2D("pion_PhTVsQ2", "PhT vs Q^2 | pion | y<0.95; PhT [GeV]; Q^2 [GeV^2]", nben, 0, 20, nben, log_bins_Q22.data());
TH2D *pion_PhTvsMom = new TH2D("pion_PhTvsMom", "PhT Vs Mom | pion | y<0.95; PhT [GeV]; Mom [GeV]",nben, 0, 20, nben, 0, 50);
TH2D *pion_PhTvsZ = new TH2D("pion_PhTvsZ", "Z vs PhT | pion | y<0.95; z; PhT [GeV]", nben, 0, 1, nben, 0, 20);
TH2D *pion_PhTvsEta = new TH2D("pion_PhTVsEta", "PhT vs Eta | pion | y<0.95; Eta; PhT [GeV]", nben, -3.5 ,3.5, nben, 0, 20);
TH2D *pion_PhTvsPhi = new TH2D("pion_PhTvsTheta", "Theta (Polar) vs PhT | pion | y<0.95; Theta [Deg]; PhT [GeV]", nben, 0, 180, nben, 0, 20);
TH2D *pion_PhTvsTheta = new TH2D("pion_PhTvsPhi", "Phi (Azimuth) vs PhT | pion | y<0.95; Phi [Deg]; PhT [GeV]", nben, -180, 180, nben, 0, 20);
TH2D *pion_PhTvsTheta_HP = new TH2D("pion_PhTvsTheta_HP", "Theta (Polar, Hadron plane) vs PhT | pion | y<0.95; Phi [Deg]; PhT [GeV]", nben, 0, 180, nben, 0, 20);
TH2D *pion_PhTvsPhi_HP = new TH2D("pion_PhTvsPhi_HP", "Phi (Azimuth, Hadron plane) vs PhT | pion | y<0.95; Theta [Deg]; PhT [GeV]", nben, -180, 180, nben, 0, 20);
TH2D *pion_PhTvsMom_rec = new TH2D("pion_PhTvsMom_rec", "PhT Vs Mom (MC Reco) | pion | y<0.95; PhT [GeV]; Mom [GeV]",nben, 0, 20, nben, 0, 50);
TH2D *pion_PhTvsZ_rec = new TH2D("pion_PhTvsZ_rec", "Z vs PhT (MC Reco) | pion | y<0.95; z; PhT [GeV]", nben, 0, 1, nben, 0, 20);
TH2D *pion_PhTvsEta_rec = new TH2D("pion_PhTVsEta_rec", "PhT vs Eta (MC Reco) | pion | y<0.95; Eta; PhT [GeV]", nben, -3.5 ,3.5, nben, 0, 20);
TH2D *pion_PhTvsPhi_rec = new TH2D("pion_PhTvsTheta_rec", "Theta (Polar) vs PhT (MC Reco) | pion | y<0.95; Theta [Deg]; PhT [GeV]", nben, 0, 180, nben, 0, 20);
TH2D *pion_PhTvsTheta_rec = new TH2D("pion_PhTvsPhi_rec", "Phi (Azimuth) vs PhT (MC Reco) | pion | y<0.95; Phi [Deg]; PhT [GeV]", nben, -180, 180, nben, 0, 20);
TH2D *pion_ThetaVsPhi = new TH2D("pion_PhiVsTheta", "Phi (Azimuth) vs Theta (Polar) | pion | y<0.95; Phi [Deg]; Theta [Deg]", nben, -180, 180, nben, 0, 180);
TH2D *pion_Theta_HPVsPhi_HP = new TH2D("pion_Phi_HPVsTheta_HP", "Phi_HP (Azimuth) vs Theta_HP (Polar) | pion | y<0.95; Phi [Deg]; Theta [Deg]", nben, -180, 180, nben, 0, 180);
TH2D *pion_ThetaVsPhi_rec = new TH2D("pion_PhiVsTheta_rec", "Phi (Azimuth) vs Theta (Polar) (MC Reco) | pion | y<0.95; Phi [Deg]; Theta [deg]", nben, -180, 180, nben, 0, 180);
TH2D *pion_ZvsQ2 = new TH2D("pion_ZvsQ2", "Z vs Q^2 | pion | y<0.95; z ; Q^2 [GeV^2]", nben, 0, 1, nben, log_bins_Q22.data());
TH2D *pion_ZvsMom = new TH2D("pion_ZvsMom", "Z vs Mom | pion | y<0.95; z; Mom [GeV]", nben, 0, 1, nben, 0, 50);
TH2D *pion_ZvsPhi = new TH2D("pion_ZVsTheta", "Z vs Theta (Polar) | pion | y<0.95; Theta [Deg]; z", nben, 0, 180, nben, 0, 1);
TH2D *pion_ZvsTheta = new TH2D("pion_ZvsPhi", "Z vs Phi (Azimuth) | pion | y<0.95; Phi [Deg]; z", nben, -180, 180, nben, 0, 1);
TH2D *pion_ZvsTheta_HP = new TH2D("pion_ZVsTheta_HP", "Z vs Theta (Polar, Hadron plane) | pion | y<0.95; Theta [Deg]; z", nben, 0, 180, nben, 0, 1);
TH2D *pion_ZvsPhi_HP = new TH2D("pion_ZvsPhi_HP", "Z vs Phi (Azimuth, Hadron plane) | pion | y<0.95; Phi [Deg]; z", nben, -180, 180, nben, 0, 1);
TH2D *pion_ZvsMom_rec = new TH2D("pion_ZvsMom_rec", "Z vs Mom (MC Reco) | pion | y<0.95; z; Mom [GeV]", nben, 0, 1, nben, 0, 50);
TH2D *pion_ZvsPhi_rec = new TH2D("pion_ZVsTheta_rec", "Z vs Theta (Polar) (MC Reco) | pion | y<0.95; Theta [Deg]; z", nben, 0, 180, nben, 0, 1);
TH2D *pion_ZvsTheta_rec = new TH2D("pion_ZvsPhi_rec", "Z vs Phi (Azimuth) (MC Reco) | pion | y<0.95; Phi [Deg]; z", nben, -180, 180, nben, 0, 1);
TH2D *pion_XbVsMom = new TH2D("pion_XbVsMom", "Xb vs Mom | pion | y<0.95; xB; Mom [GeV]", nben, log_bins_xbj2.data(), nben, 0, 50);
TH2D *pion_XbVsPhT = new TH2D("pion_XbVsPhT", "Xb vs PhT | pion | y<0.95; xB; PhT [GeV]", nben, log_bins_xbj2.data(), nben, 0, 20);
TH2D *pion_XbVsZ = new TH2D("pion_XbVsZ", "Xb vs Z | pion | y<0.95; xB; z", nben, log_bins_xbj2.data(), nben, 0, 1);
TH2D *pion_XbVsEta = new TH2D("pion_XbVsEta", "Xb vs Eta | pion | y<0.95; xB; Eta",nben, -3.5, 3.5, nben, log_bins_xbj2.data());
TH2D *pion_XbVsPhi = new TH2D("pion_XbVsTheta", "Xb vs Theta (Polar) | pion | y<0.95; Theta [Deg]; xB", nben, 0, 180, nben, log_bins_xbj2.data());
TH2D *pion_XbVsTheta = new TH2D("pion_XbvsPhi", "Xb vs Phi (Azimuth) | pion | y<0.95; Phi [Deg]; xB", nben, -180, 180, nben, log_bins_xbj2.data());
TH2D *pion_XbVsTheta_HP = new TH2D("pion_XbVsTheta_HP", "Xb vs Theta (Polar, Hadron plane) | pion | y<0.95; Theta [Deg]; xB", nben, 0, 180, nben, log_bins_xbj2.data());
TH2D *pion_XbVsPhi_HP = new TH2D("pion_XbvsPhi_HP", "Xb vs Phi (Azimuth, Hadron plane) | pion | y<0.95; Phi [Deg]; xB", nben, -180, 180, nben, log_bins_xbj2.data());
TH2D *pion_XbVsMom_rec = new TH2D("pion_XbVsMom_rec", "Xb vs Mom (MC Reco) | pion | y<0.95; xB; Mom [GeV]", nben, log_bins_xbj2.data(), nben, 0, 50);
TH2D *pion_XbVsPhT_rec = new TH2D("pion_XbVsPhT_rec", "Xb vs PhT (MC Reco) | pion | y<0.95; xB; PhT [GeV]", nben, log_bins_xbj2.data(), nben, 0, 20);
TH2D *pion_XbVsZ_rec = new TH2D("pion_XbVsZ_rec", "Xb vs Z (MC Reco) | pion | y<0.95; xB; z", nben, log_bins_xbj2.data(), nben, 0, 1);
TH2D *pion_XbVsPhi_rec = new TH2D("pion_XbVsTheta_rec", "Xb vs Theta (Polar) (MC Reco) | pion | y<0.95; Theta [Deg]; xB", nben, 0, 180, nben, log_bins_xbj2.data());
TH2D *pion_XbVsTheta_rec = new TH2D("pion_XbVsPhi_rec", "Xb vs Phi (Azimuth) (MC Reco) | pion | y<0.95; Phi [Deg]; xB", nben, -180, 180, nben, log_bins_xbj2.data());
TH2D *pion_XbVsQ2 = new TH2D("pion_XbVsQ2", "Xb vs Q^2 | pion | y<0.95; xB; Q^2 [GeV^2]", nben, log_bins_xbj2.data(), nben, log_bins_Q22.data());
TH2D *kaon_MomVsEta = new TH2D("kaon_MomVsEta", "Mom vs Eta | kaon | y<0.95; Eta; Mom [GeV]", nben, -3.5 ,3.5, nben, 0, 50);
TH2D *kaon_MomVsPhi = new TH2D("kaon_MomVsTheta", "Mom vs Theta (Polar) | kaon | y<0.95; Theta [Deg]; Mom [GeV]", nben, 0, 180, nben, 0, 50);
TH2D *kaon_MomVsTheta = new TH2D("kaon_MomVsPhi", "Mom vs Phi (Azimuth) | kaon | y<0.95; Phi [Deg]; Mom [GeV]", nben, -180, 180, nben, 0, 50);
TH2D *kaon_MomVsEta_rec = new TH2D("kaon_MomVsEta_rec", "Mom vs Eta (MC Reco) | kaon | y<0.95; Eta; Mom [GeV]", nben, -3.5 ,3.5, nben, 0, 50);
TH2D *kaon_MomVsPhi_rec = new TH2D("kaon_MomVsTheta_rec", "Mom vs Theta (Polar) (MC Reco) | kaon | y<0.95; Theta [Deg]; Mom [GeV]", nben, 0, 180, nben, 0, 50);
TH2D *kaon_MomVsTheta_rec = new TH2D("kaon_MomVsPhi_rec", "Mom vs Phi (Azimuth) (MC Reco) | kaon | y<0.95; Phi [Deg]; Mom [GeV]", nben, -180, 180, nben, 0, 50);
TH2D *kaon_PhTvsMom = new TH2D("kaon_PhTvsMom", "PhT Vs Mom | kaon | y<0.95; PhT [GeV]; Mom [GeV]",nben, 0, 20, nben, 0, 50);
TH2D *kaon_PhTvsZ = new TH2D("kaon_PhTvsZ", "Z vs PhT | kaon | y<0.95; z; PhT [GeV]", nben, 0, 1, nben, 0, 20);
TH2D *kaon_PhTvsEta = new TH2D("kaon_PhTVsEta", "PhT vs Eta | kaon | y<0.95; Eta; PhT [GeV]", nben, -3.5 ,3.5, nben, 0, 20);
TH2D *kaon_PhTvsPhi = new TH2D("kaon_PhTVsTheta", "Theta (Polar) vs PhT | kaon | y<0.95; Theta [Deg]; PhT [GeV]", nben, 0, 180, nben, 0, 20);
TH2D *kaon_PhTvsTheta = new TH2D("kaon_PhTvsPhi", "Phi (Azimuth) vs PhT | kaon | y<0.95; Phi [Deg]; PhT [GeV]", nben, -180, 180, nben, 0, 20);
TH2D *kaon_PhTvsMom_rec = new TH2D("kaon_PhTvsMom_rec", "PhT Vs Mom (MC Reco) | kaon | y<0.95; PhT [GeV]; Mom [GeV]",nben, 0, 20, nben, 0, 50);
TH2D *kaon_PhTvsZ_rec = new TH2D("kaon_PhTvsZ_rec", "Z vs PhT (MC Reco) | kaon | y<0.95; z; PhT [GeV]", nben, 0, 1, nben, 0, 20);
TH2D *kaon_PhTvsEta_rec = new TH2D("kaon_PhTVsEta_rec", "PhT vs Eta (MC Reco) | kaon | y<0.95; Eta; PhT [GeV]", nben, -3.5 ,3.5, nben, 0, 20);
TH2D *kaon_PhTvsPhi_rec = new TH2D("kaon_PhTVsTheta_rec", "Theta (Polar) vs PhT (MC Reco) | kaon | y<0.95; Theta [Deg]; PhT [GeV]", nben, 0, 180, nben, 0, 20);
TH2D *kaon_PhTvsTheta_rec = new TH2D("kaon_PhTvsPhi_rec", "Phi (Azimuth) vs PhT (MC Reco) | kaon | y<0.95; Phi [Deg]; PhT [GeV]", nben, -180, 180, nben, 0, 20);
TH2D *kaon_ThetaVsPhi = new TH2D("kaon_PhiVsTheta", "Phi (Azimuth) vs Theta (Polar) | kaon | y<0.95; Phi [Deg]; Theta [Deg]", nben, -180, 180, nben, 0, 180);
TH2D *kaon_ThetaVsPhi_rec = new TH2D("kaon_PhiVsTheta_rec", "Phi (Azimuth) vs Theta (Polar) (MC Reco) | kaon | y<0.95; Phi [Deg]; Theta [deg]", nben, -180, 180, nben, 0, 180);
TH2D *kaon_ZvsMom = new TH2D("kaon_ZvsMom", "Z vs Mom | kaon | y<0.95; z; Mom [GeV]", nben, 0, 1, nben, 0, 50);
TH2D *kaon_ZvsPhi = new TH2D("kaon_ZVsTheta", "Z vs Theta (Polar) | kaon | y<0.95; Theta [Deg]; z", nben, 0, 180, nben, 0, 1);
TH2D *kaon_ZvsTheta = new TH2D("kaon_ZvsPhi", "Z vs Phi (Azimuth) | kaon | y<0.95; Phi [Deg]; z", nben, -180, 180, nben, 0, 1);
TH2D *kaon_ZvsMom_rec = new TH2D("kaon_ZvsMom_rec", "Z vs Mom (MC Reco) | kaon | y<0.95; z; Mom [GeV]", nben, 0, 1, nben, 0, 50);
TH2D *kaon_ZvsPhi_rec = new TH2D("kaon_ZVsTheta_rec", "Z vs Theta (Polar) (MC Reco) | kaon | y<0.95; Theta [Deg]; z", nben, 0, 180, nben, 0, 1);
TH2D *kaon_ZvsTheta_rec = new TH2D("kaon_ZvsPhi_rec", "Z vs Phi (Azimuth) (MC Reco) | kaon | y<0.95; Phi [Deg]; z", nben, -180, 180, nben, 0, 1);
TH2D *kaon_XbVsMom = new TH2D("kaon_XbVsMom", "Xb vs Mom | kaon | y<0.95; xB; Mom [GeV]", nben, log_bins_xbj2.data(), nben, 0, 50);
TH2D *kaon_XbVsPhT = new TH2D("kaon_XbVsPhT", "Xb vs PhT | kaon | y<0.95; xB; PhT [GeV]", nben, log_bins_xbj2.data(), nben, 0, 20);
TH2D *kaon_XbVsZ = new TH2D("kaon_XbVsZ", "Xb vs Z | kaon | y<0.95; xB; z", nben, log_bins_xbj2.data(), nben, 0, 1);
TH2D *kaon_XbVsPhi = new TH2D("kaon_XbVsTheta", "Xb vs Theta (Polar) | kaon | y<0.95; Theta [Deg]; xB", nben, 0, 180, nben, log_bins_xbj2.data());
TH2D *kaon_XbVsTheta = new TH2D("kaon_XbvsPhi", "Xb vs Phi (Azimuth) | kaon | y<0.95; Phi [Deg]; xB", nben, -180, 180, nben, log_bins_xbj2.data());
TH2D *kaon_XbVsMom_rec = new TH2D("kaon_XbVsMom_rec", "Xb vs Mom (MC Reco) | kaon | y<0.95; xB; Mom [GeV]", nben, log_bins_xbj2.data(), nben, 0, 50);
TH2D *kaon_XbVsPhT_rec = new TH2D("kaon_XbVsPhT_rec", "Xb vs PhT (MC Reco) | kaon | y<0.95; xB; PhT [GeV]", nben, log_bins_xbj2.data(), nben, 0, 20);
TH2D *kaon_XbVsZ_rec = new TH2D("kaon_XbVsZ_rec", "Xb vs Z (MC Reco) | kaon | y<0.95; xB; z", nben, log_bins_xbj2.data(), nben, 0, 1);
TH2D *kaon_XbVsPhi_rec = new TH2D("kaon_XbVsTheta_rec", "Xb vs Theta (Polar) (MC Reco) | kaon | y<0.95; Theta [Deg]; xB", nben, 0, 180, nben, log_bins_xbj2.data());
TH2D *kaon_XbVsTheta_rec = new TH2D("kaon_XbVsPhi_rec", "Xb vs Phi (Azimuth) (MC Reco) | kaon | y<0.95; Phi [Deg]; xB", nben, -180, 180, nben, log_bins_xbj2.data());
TH2D *proton_MomVsEta = new TH2D("proton_MomVsEta", "Mom vs Eta | proton | y<0.95; Eta; Mom [GeV]", nben, -3.5 ,3.5, nben, 0, 50);
TH2D *proton_MomVsPhi = new TH2D("proton_MomVsTheta", "Mom vs Theta (Polar) | proton | y<0.95; Theta [Deg]; Mom [GeV]", nben, 0, 180, nben, 0, 50);
TH2D *proton_MomVsEta_rec = new TH2D("proton_MomVsEta_rec", "Mom vs Eta | proton | y<0.95; Eta; Mom [GeV]", nben, -3.5 ,3.5, nben, 0, 50);
TH2D *proton_MomVsPhi_rec = new TH2D("proton_MomVsTheta_rec", "Mom vs Theta (Polar) | proton | y<0.95; Theta [Deg]; Mom [GeV]", nben, 0, 180, nben, 0, 50);
// CERCA DEI PROTONI LANCIATI
double xmin_m = 1e-1;
double xmax_m = 300;
double xmax_m2 = 20;
std::vector<double> log_bins_momA = CreateLogBinning(nbins, xmin_m, xmax_m);
std::vector<double> log_bins_momB = CreateLogBinning(nbins, xmin_m, xmax_m2);
TH1D *beamproton_mom = new TH1D("BeamProton_Mom", "Proton beam; GeV", 80, log_bins_momA.data());
TH1D *beamproton_theta = new TH1D("BeamProton_Phi", "Proton beam angle", 80, 0, 360);
TH1D *beamproton_Phi = new TH1D("BeamProton_Theta", "Proton beam angle", 80, 0, 360);
TH1D *beamelectron_mom = new TH1D("BeamElectron_Mom", "Electron beam; GeV", 80, log_bins_momB.data());
TH1D *beamelectron_theta = new TH1D("BeamElectron_Phi", "Electron beam angle", 80, 0 , 360);
TH1D *beamelectron_Phi = new TH1D("BeamElectron_Theta", "Electron beam angle", 80, 0 , 360);
TGraph2D *graphProton = new TGraph2D(); // Grafico per i protoni
TGraph2D *graphElectron = new TGraph2D(); // Grafico per gli elettroni
int protonIndex = 0, electronIndex = 0;
TH2D *h2 = new TH2D("h2", "Proiezione sferica; Theta (deg); Phi (deg); Intensità",
20, 0, 180, 20, -180, 180);
TH2D *h3 = new TH2D("h3", "Proiezione sferica; Theta (deg); Phi (deg); Intensità",
20, 0, 180, 20, -180, 180);
//PROVA DI TH3D
int nban = 10;
std::vector<double> log_bins_Mom3 = CreateLogBinning(nban, xmin_mom, xmax_mom);
std::vector<double> log_bins_PhT3 = CreateLogBinning(nban, xmin_PhT, xmax_PhT);
std::vector<double> log_bins_z3 = CreateLogBinning(nban, xmin_z, xmax_z);
std::vector<double> log_bins_xbj3 = CreateLogBinning(nban, xmin_xbj, xmax_xbj);
TH3D *pion_MomVsPhiVsTheta = new TH3D("pion_MomVsPhiVsTheta",
"Mom vs Theta (Polar) vs Phi (Azimuth) | pion | y<0.95; Theta [Deg]; Mom [GeV]; Phi [Deg]",
nban, -180, 180, nban, 0, 1, nban, 0, 180);
pion_MomVsPhiVsTheta->GetYaxis()->Set(nban, log_bins_Mom3.data());
TH3D *pion_PhTvsZvsXb = new TH3D("pion_PhTvsZvsXb",
"PhT vs Z vs xB | pion | y<0.95; xB; z; PhT [GeV]",
nban, 0, 1, nban, 0, 1, nban, 0, 100);
pion_PhTvsZvsXb->GetXaxis()->Set(nban, log_bins_xbj3.data());
pion_PhTvsZvsXb->GetYaxis()->Set(nban, log_bins_z3.data());
pion_PhTvsZvsXb->GetZaxis()->Set(nban, log_bins_PhT3.data());
TH3D *z_axisSP = new TH3D("z_axisSP", "Scattered photon polar angle; x; y; z",
30, 0, 1, 30, 0, 1, 30, 0, 1);
// "REAL"
TH1D *RealpionQ2 = new TH1D("RealpionQ2", "Real reconstruction of Pions+ in function of Q^2; GeV^2", nbins, log_bins_Q2.data());
TH1D *RealkaonQ2 = new TH1D("RealkaonQ2", "Reconstruction of Kaons in function of Q^2; GeV^2", nbins, log_bins_Q2.data());
TH1D *RealprotonQ2 = new TH1D("RealprotonQ2", "Production of Protons in function of Q^2; GeV^2", nbins, log_bins_Q2.data());
TH1D *RealpionX = new TH1D("RealpionX", "Real reconstruction of Pions+ in function of Q^2; GeV^2", nbins, log_bins_xbj.data());
TH1D *RealkaonX = new TH1D("RealkaonX", "Reconstruction of Kaons in function of Q^2; GeV^2", nbins, log_bins_xbj.data());
TH1D *RealprotonX = new TH1D("RealprotonX", "Production of Protons in function of Q^2; GeV^2", nbins, log_bins_xbj.data());
TH1D *RealpionZ = new TH1D("RealpionZ", "Real reconstruction of Pions+ in function of Q^2; GeV^2", nbins, log_bins_z.data());
TH1D *RealkaonZ = new TH1D("RealkaonZ", "Reconstruction of Kaons in function of Q^2; GeV^2", nbins, log_bins_z.data());
TH1D *RealprotonZ = new TH1D("RealprotonZ", "Production of Protons in function of Q^2; GeV^2", nbins, log_bins_z.data());
TH1D *RealpionPhT = new TH1D("RealpionPht", "Real reconstruction of Pions+ in function of Q^2; GeV^2", nbins, log_bins_PhT.data());
TH1D *RealkaonPhT= new TH1D("RealkaonPhT", "Reconstruction of Kaons in function of Q^2; GeV^2", nbins, log_bins_PhT.data());
TH1D *RealprotonPhT = new TH1D("RealprotonPhT", "Production of Protons in function of Q^2; GeV^2", nbins, log_bins_PhT.data());
TH1D *RealpionEta = new TH1D("RealpionEta", "Real reconstruction of Pions+ in function of Q^2; GeV^2", 80, -3.5 ,3.5);
TH1D *RealkaonEta = new TH1D("RealkaonEta", "Reconstruction of Kaons in function of Q^2; GeV^2", 80, -3.5 ,3.5);
TH1D *RealprotonEta = new TH1D("RealprotonEta", "Production of Protons in function of Q^2; GeV^2", 80, -3.5 ,3.5);
TH1D *RealpionPhi = new TH1D("RealpionPhi", "Real reconstruction of Pions+ in function of Q^2; GeV^2", 80, 0, 180);
TH1D *RealkaonPhi = new TH1D("RealkaonPhi", "Reconstruction of Kaons in function of Q^2; GeV^2", 80, 0, 180);
TH1D *RealprotonPhi = new TH1D("RealprotonPhi", "Production of Protons in function of Q^2; GeV^2", 80, 0, 180);
TH1D *RealpionMom = new TH1D("RealpionMom", "Real reconstruction of Pions+ in function of Q^2; GeV^2", nbins, log_bins_mom.data());
TH1D *RealkaonMom = new TH1D("RealkaonMom", "Reconstruction of Kaons in function of Q^2; GeV^2", nbins, log_bins_mom.data());
TH1D *RealprotonMom = new TH1D("RealprotonMom", "Production of Protons in function of Q^2; GeV^2", nbins, log_bins_mom.data());
/*
// VEDIAMO SE RIUSCIAMO A FARE LE PDF
LHAPDF::PDFSet pdfSet("NNPDF31_nnlo_as_0118");
auto pdf = pdfSet.mkPDF(0); // '0' è l'indice della replica centrale
TH2F* hPDF = new TH2F("hPDF", "PDF u(x, Q^{2})", nben, log_bins_xbj2.data(), nben, log_bins_Q22.data());
hPDF->GetXaxis()->SetTitle("x");
hPDF->GetYaxis()->SetTitle("Q^{2} [GeV^{2}]");
hPDF->GetZaxis()->SetTitle("x f_{u}(x, Q^{2})");
int pion_count = 0;
TGraphErrors *uPDF = new TGraphErrors();
TGraphErrors *dPDF = new TGraphErrors();
TGraphErrors *glPDF = new TGraphErrors();
std::vector<double> val_uPDF;
std::vector<double> val_dPDF;
std::vector<double> val_glPDF;
std::vector<double> val_x;
*/
// FOTONEEE
TH1D *GammaPolarDeg = new TH1D("GammaPolarDeg", "Scattered photon polar angle; Theta [Deg]", nben, 0, 180);
TH1D *GammaAzimuthDeg = new TH1D("GammaAzimuthDeg", "Scattered photon azimuthal angle; Phi [Deg]", nben, -180, 180);
// ALCUNI VETTORI UTILI
std::vector<TLorentzVector> scatElectron;
std::vector<TVector3> recScatElectron;
std::vector<TVector3> GammaVector;
std::vector<TVector3> BeamElectronVector;
//std::vector<TVector3> z_axis_SP
//std::vector<TVector3> ipsilon;
//std::vector<TVector3> y_axis_SP;
//std::vector<TVector3> x_axis_SP;
std::vector<float> scatPhi;
std::vector<float> PolarGammaRad;
std::vector<float> PolarGammaDeg;
std::vector<float> AzimuthGammaRad;
std::vector<float> AzimuthGammaDeg;
std::vector<TVector3> elMom_pion;
TVector3 ElBeam(0.,0.,-18.);
TLorentzVector ElectronBeam(18., 0, 0, -18.);
TLorentzVector ProtonBeam(275., 0, 0, 275.);
std::vector<TLorentzVector> q;
double currentPhi = 0;
double currentMom = 0;
std::vector<float> scatElPhipion;
// per la costruzione del pione
TVector3 currentQ2pion;
std::vector<TVector3> scatElq_pion;
// del kaone
TVector3 currentQ2kaon;
std::vector<TVector3> scatElq_kaon;
// del protone
TVector3 currentQ2proton;
std::vector<TVector3> scatElq_proton;
double count = 0;
double countEta = 0;
int count_el = 0;
std::set<int> uniqueStatuses;
std::set<int> uniqueParentsIndex;
while(tree_reader.Next()) { // Loop over events
for(unsigned int i=0; i<partGenStat.GetSize(); i++) // Loop over thrown particles
{
count += 1;
TVector3 part(partMomX[i],partMomY[i],partMomZ[i]);
float partEta = part.PseudoRapidity();
double phis = part.Theta();
double y_DA= ((TMath::Tan(phis*0.5)) / (TMath::Tan(phis*0.5) + TMath::Tan(currentPhi*0.5)));
if(partEta <= 3.5){
if(partEta >= -3.5){
if(y_DA <= 0.95){
countEta += 1;
}
}
}
int pdg = (std::abs(partPdg[i]));
// status = 4 is the beam (ref 1767) in HepMC
/*
if(pdg == 11){
uniqueStatuses.insert(parentsIndex[i]);
}
*/
// status = 21 incoming particles of the hardest subprocess
if(partGenStat[i] == 4){
if(pdg == 2212){
TVector3 BeamProton(partMomX[i],partMomY[i],partMomZ[i]);
float Pmom = BeamProton.Mag();
float Peng = sqrt(Pmom*Pmom + 0.939*0.939);
double Beam_pThetaRad = BeamProton.Phi();
double Beam_pThetaDeg = Beam_pThetaRad * (180.0/TMath::Pi());
double Beam_pPhiRad = BeamProton.Theta();
double Beam_pPhiDeg = Beam_pPhiRad * (180.0/TMath::Pi());
double Px = std::abs(1) * TMath::Sin(Beam_pPhiRad) * TMath::Cos(Beam_pThetaRad);
double Py = std::abs(1) * TMath::Sin(Beam_pPhiRad) * TMath::Sin(Beam_pThetaRad);
double Pz = std::abs(1) * TMath::Cos(Beam_pPhiRad);
graphProton->SetPoint(protonIndex++, Px, Py, Pz);
beamproton_mom->Fill(Peng);
beamproton_theta->Fill(Beam_pThetaDeg);
beamproton_Phi->Fill(Beam_pPhiDeg);
h2->Fill(Beam_pPhiDeg, Beam_pThetaDeg, 1);
}
if(pdg == 11){
TVector3 BeamElectron(partMomX[i],partMomY[i],partMomZ[i]);
float Emom = BeamElectron.Mag();
double Beam_EThetaRad = BeamElectron.Phi();
double Beam_EThetaDeg = Beam_EThetaRad * (180.0/TMath::Pi());
double Beam_EPhiRad = BeamElectron.Theta();
double Beam_EPhiDeg = Beam_EPhiRad * (180.0/TMath::Pi());
double Ex = std::abs(1) * TMath::Sin(Beam_EPhiRad) * TMath::Cos(Beam_EThetaRad);
double Ey = std::abs(1) * TMath::Sin(Beam_EPhiRad) * TMath::Sin(Beam_EThetaRad);
double Ez = std::abs(1) * TMath::Cos(Beam_EPhiRad);
graphElectron->SetPoint(electronIndex++, Ex, Ey, Ez);
beamelectron_mom->Fill(Emom);
beamelectron_theta->Fill(Beam_EThetaDeg);
beamelectron_Phi->Fill(Beam_EPhiDeg);
h3->Fill(Beam_EPhiDeg, Beam_EThetaDeg, 1);
}
}
if(partGenStat[i] <= 1)
{
if(pdg == 11)
{
TVector3 ElMom(partMomX[i],partMomY[i],partMomZ[i]);
float mom = ElMom.Mag();
double etta = ElMom.PseudoRapidity();
if(std::abs(etta) <= 3.5){
if(parentsIndex[i]<=500){
TLorentzVector tlv(mom, ElMom.X(), ElMom.Y(), ElMom.Z());
float angleR = ElMom.Theta();
float angle = angleR * (180.0 / TMath::Pi());
currentPhi = ElMom.Theta();
currentMom = ElMom.Mag();
currentQ2pion.SetXYZ(partMomX[i],partMomY[i],partMomZ[i]);
currentQ2kaon.SetXYZ(partMomX[i],partMomY[i],partMomZ[i]);
currentQ2proton.SetXYZ(partMomX[i],partMomY[i],partMomZ[i]);
scatEl->Fill(mom);
scatElAngle->Fill(angle);
//scatElectron.push_back(ElMom); // to use it outside the cycle
scatElectron.push_back(tlv);
scatPhi.push_back(angle);
BeamElectronVector.push_back(ElMom);
for(unsigned int j=0; j<simuAssoc.GetSize(); j++)
{
if(simuAssoc[j] == i) // Find association index matching the index of the thrown particle we are looking at
{
TVector3 recElmom(trackMomX[recoAssoc[j]],trackMomY[recoAssoc[j]],trackMomZ[recoAssoc[j]]);
float momE = recElmom.Mag();
recScatEl->Fill(momE);
recScatElectron.push_back(recElmom);
}
}
}
}
}
if(pdg == 22){ // stiamo cercando il fotone scatterato
if(parentsIndex[i]<=6){
TVector3 ScatPhoton(partMomX[i],partMomY[i],partMomZ[i]);
double Polar_gammaRad = ScatPhoton.Theta();
double Polar_gammaDeg = Polar_gammaRad * (180.0/TMath::Pi());
double Azimuth_gammaRad = ScatPhoton.Phi();
double Azimuth_gammaDeg = Azimuth_gammaRad * (180.0/TMath::Pi());
PolarGammaDeg.push_back(Polar_gammaDeg);
PolarGammaRad.push_back(Polar_gammaRad);
AzimuthGammaDeg.push_back(Azimuth_gammaDeg);
AzimuthGammaRad.push_back(Azimuth_gammaRad);
GammaPolarDeg->Fill(Polar_gammaDeg);
GammaAzimuthDeg->Fill(Azimuth_gammaDeg);
GammaVector.push_back(ScatPhoton);
}
}
}
// IDK IF THIS WILL WORK HERE...
for (const auto& vec : scatElectron) {
q.push_back(ElectronBeam - vec);
}
if(partGenStat[i] == 1) // Select stable thrown particles
{
//int pdg = partPdg[i];
//if(pdg == 11 || pdg == 13 || pdg == 211 || pdg == 321 || pdg == 2212) // Look at charged particles (electrons, muons, pions, kaons, protons)
// PION
if(pdg == 211)
{
TVector3 truePionMom(partMomX[i],partMomY[i],partMomZ[i]);
float mom_pion = truePionMom.Mag();
float E_pion = sqrt(mom_pion*mom_pion + 0.139*0.139);
TLorentzVector pion(E_pion, partMomX[i],partMomY[i],partMomZ[i]);
float pionEta = truePionMom.PseudoRapidity();
if(pionEta >= -3.5 && pionEta <= 3.5){
double pionPhiRad = truePionMom.Theta(); // MOLTO CONFUSO LO SO, PHI (MIO) ANGOLO POLARE
double pionThetaRad = truePionMom.Phi() + TMath::Pi(); // THETA ANGOLO AZIMUTALE
if(pionThetaRad >= TMath::Pi()){
pionThetaRad -= 2*TMath::Pi();
}
float pionPhi = pionPhiRad * (180.0 / TMath::Pi());
float pionTheta = pionThetaRad * (180.0 / TMath::Pi());
TLorentzVector scatElpion(currentMom, currentQ2pion.X(), currentQ2pion.Y(), currentQ2pion.Z());
TLorentzVector photon_pion = ElectronBeam - scatElpion;
for(unsigned int j=0; j<simuAssoc.GetSize(); j++)
{
int recpdg = std::abs(recPdg[j]);
if(simuAssoc[j] == i) // Find association index matching the index of the thrown particle we are looking at
{
TVector3 recPionMom(trackMomX[recoAssoc[j]],trackMomY[recoAssoc[j]],trackMomZ[recoAssoc[j]]);
float mom_pion_Rec = recPionMom.Mag();
float E_pion_rec = sqrt(mom_pion_Rec*mom_pion_Rec + 0.139*0.139);
TLorentzVector pion_Rec(E_pion_rec, trackMomX[recoAssoc[j]],trackMomY[recoAssoc[j]],trackMomZ[recoAssoc[j]]);
float recpionEta = recPionMom.PseudoRapidity();
if(recpionEta <= 3.5 && recpionEta >= -3.5){
double recpPhi = recPionMom.Theta();
double recpTheta = recPionMom.Phi() + TMath::Pi();
if(recpTheta >= TMath::Pi()){
recpTheta -= 2*TMath::Pi();
}
float recpionTheta = recpTheta * (180.0 / TMath::Pi());
float recpionPhi = recpPhi * (180.0 / TMath::Pi());
TLorentzVector scatElpion_Rec(currentMom, currentQ2pion.X(), currentQ2pion.Y(), currentQ2pion.Z());
TLorentzVector photon_pion_Rec = ElectronBeam - scatElpion_Rec;
double y_DA_pion_Rec = ((TMath::Tan(recpPhi*0.5)) / (TMath::Tan(recpPhi*0.5) + TMath::Tan(currentPhi*0.5)));
if(y_DA_pion_Rec <= 0.95){
if(parentsIndex[i]<=5){
double Q2_DA_pion_Rec = ((4*18*18*(1-y_DA_pion_Rec)) / (TMath::Tan(currentPhi*0.5)*TMath::Tan(currentPhi*0.5)));
double xbj_DA_pion_Rec = (Q2_DA_pion_Rec) / (4*18*275*y_DA_pion_Rec);
double z_DA_pion_Rec = (ProtonBeam * pion_Rec) / (ProtonBeam * photon_pion_Rec);
TVector3 PhT_pion_vec_Rec = recPionMom - ((recPionMom * currentQ2pion) / currentQ2pion.Mag())*currentQ2pion.Unit();
double PhT_pion_Rec = PhT_pion_vec_Rec.Mag();
if(z_DA_pion_Rec <= 1){
RecpionQ2->Fill(Q2_DA_pion_Rec);
Recpion_xbj->Fill(xbj_DA_pion_Rec);
Recpion_z->Fill(z_DA_pion_Rec);
Recpion_PhT->Fill(PhT_pion_Rec);
Recpion_mom->Fill(mom_pion_Rec);
RecpionEta->Fill(recpionEta);
RecpionPhi->Fill(recpionPhi);
pion_MomVsEta_rec->Fill(recpionEta, mom_pion_Rec);
pion_PhTvsEta_rec->Fill(recpionEta, PhT_pion_Rec);
pion_MomVsPhi_rec->Fill(recpionPhi, mom_pion_Rec);
pion_PhTvsZ_rec->Fill(z_DA_pion_Rec, PhT_pion_Rec);
pion_MomVsTheta_rec->Fill(recpionTheta, mom_pion_Rec);
pion_ThetaVsPhi_rec->Fill(recpionTheta,recpionPhi);
pion_PhTvsPhi_rec->Fill(recpionPhi, PhT_pion_Rec);
pion_PhTvsTheta_rec->Fill(recpionTheta, PhT_pion_Rec);
pion_PhTvsMom_rec->Fill(PhT_pion_Rec, mom_pion_Rec);
pion_ZvsMom_rec->Fill(z_DA_pion_Rec, mom_pion_Rec);
pion_ZvsPhi_rec->Fill(recpionPhi,z_DA_pion_Rec);
pion_ZvsTheta_rec->Fill(recpionTheta, z_DA_pion_Rec);
pion_XbVsMom_rec->Fill(xbj_DA_pion_Rec, mom_pion_Rec);
pion_XbVsPhT_rec->Fill(xbj_DA_pion_Rec, PhT_pion_Rec);
pion_XbVsZ_rec->Fill(xbj_DA_pion_Rec, z_DA_pion_Rec);
pion_XbVsPhi_rec->Fill(recpionPhi, xbj_DA_pion_Rec);
pion_XbVsTheta_rec->Fill(recpionTheta, xbj_DA_pion_Rec);
if(recpdg==pdg){
RealpionQ2->Fill(Q2_DA_pion_Rec);
RealpionX->Fill(xbj_DA_pion_Rec);
RealpionZ->Fill(z_DA_pion_Rec);
RealpionPhT->Fill(PhT_pion_Rec);
RealpionEta->Fill(recpionEta);
RealpionPhi->Fill(recpionPhi);
RealpionMom->Fill(mom_pion_Rec);
}
}
PIDgen2rec->Fill(kpion, checkRecoID(recpdg));
}
}
}
}
}
scatElPhipion.push_back(currentPhi); // that generate an array with the angle of the scat. el with the # of pions
scatElq_pion.push_back(currentQ2pion);
double y_DA_pion = ((TMath::Tan(pionPhiRad*0.5)) / (TMath::Tan(pionPhiRad*0.5) + TMath::Tan(currentPhi*0.5)));
// PROVIAMO A METTERE LE COSE DEL FOTONE
// prendo le tre componenti del fotone, siccome i loro versori sono allineati con gli assi del piano di scattering
TVector3 CurrentGammaVector = GammaVector[i];
TVector3 z_axis_SP = CurrentGammaVector.Unit(); // voglio che l'asse z sia lungo la direzione di gamma
double z_axis_z = z_axis_SP.Z();
double z_axis_y = z_axis_SP.Y();
double z_axis_x = z_axis_SP.X();
// per calcolare y mi serve il prodotto vettoriale tra il leptone entrante e gamma
TVector3 CurrentBeamElectronVector = BeamElectronVector[i];
TVector3 ipsilon = CurrentGammaVector.Cross(CurrentBeamElectronVector);
TVector3 y_axis_SP = ipsilon.Unit();
TVector3 x_axis_SP = y_axis_SP.Cross(z_axis_SP);
// BENE ADESSO ABBIAMO I NOSTRI ASSI DEL PIANO DI SCATTERING
double P_T = truePionMom.Perp(z_axis_SP); // questo comando mi da il vettore ortogonale a z, quindi il momento trasverso
double Theta_HP_Rad = truePionMom.Angle(z_axis_SP); // dovrebbe fornire l'angolo polare del hadron plane
double Theta_HP_Deg = Theta_HP_Rad * (180.0/TMath::Pi());
// però vogliamo anche il vettore del momento trasverso
double PdotZ = truePionMom.Dot(z_axis_SP); // momento proiettato sull'asse z
TVector3 Momentum_Z = PdotZ * z_axis_SP;
TVector3 P_T_Vector = truePionMom - Momentum_Z; // ora lo possiamo usare per trovare l'angolo azimutale
double P_T_Vector_x = P_T_Vector * x_axis_SP;
double P_T_Vector_y = P_T_Vector * y_axis_SP; // calcolo il momento trasverso sugli assi x e y
double Phi_HP_Rad = std::atan2(P_T_Vector_y, P_T_Vector_x);
double Phi_HP_Deg = Phi_HP_Rad * (180.0/TMath::Pi());
if(y_DA_pion <= 0.95){
double Q2_DA_pion = ((4*18*18*(1-y_DA_pion)) / (TMath::Tan(currentPhi*0.5)*TMath::Tan(currentPhi*0.5)));
//double Q2_DA_pion = (scp*scp*TMath::Sin(currentPhi)*TMath::Sin(currentPhi))/(1-y_DA_pion);
double xbj_DA_pion = (Q2_DA_pion) / (4*18*275*y_DA_pion);
double z_DA_pion = (ProtonBeam * pion) / (ProtonBeam * photon_pion);
TVector3 PhT_pion_vec = truePionMom - ((truePionMom * currentQ2pion) / currentQ2pion.Mag())*currentQ2pion.Unit();
double PhT_pion = PhT_pion_vec.Mag();
TLorentzVector sq = ElectronBeam + ProtonBeam;
if(parentsIndex[i]<=5 ){
if(z_DA_pion <= 1){
truepionEta->Fill(pionEta);
truepionPhi->Fill(pionPhi);
truepionQ2->Fill(Q2_DA_pion);
truepion_xbj->Fill(xbj_DA_pion);
truepion_z->Fill(z_DA_pion);
truepion_PhT->Fill(PhT_pion);
truepion_mom->Fill(mom_pion);
xQplane->Fill(xbj_DA_pion, Q2_DA_pion);
pion_MomVsQ2->Fill(mom_pion, Q2_DA_pion);
pion_MomVsEta->Fill(pionEta, mom_pion);
pion_PhTVsQ2->Fill(PhT_pion, Q2_DA_pion);
pion_PhTvsEta->Fill(pionEta, PhT_pion);
pion_MomVsPhi->Fill(pionPhi, mom_pion);
pion_PhTvsZ->Fill(z_DA_pion, PhT_pion);
pion_MomVsTheta->Fill(pionTheta, mom_pion);
pion_MomVsTheta_HP->Fill(Theta_HP_Deg, mom_pion);
pion_MomVsPhi_HP->Fill(Phi_HP_Deg, mom_pion);
pion_ThetaVsPhi->Fill(pionTheta,pionPhi);
pion_Theta_HPVsPhi_HP->Fill(Phi_HP_Deg, Theta_HP_Deg);
pion_PhTvsPhi->Fill(pionPhi, PhT_pion);
pion_PhTvsTheta->Fill(pionTheta, PhT_pion);
pion_PhTvsPhi_HP->Fill(Phi_HP_Deg, PhT_pion);
pion_PhTvsTheta_HP->Fill(Theta_HP_Deg, PhT_pion);
pion_MomVsPhiVsTheta->Fill(pionTheta, mom_pion, pionPhi);
pion_PhTvsMom->Fill(PhT_pion,mom_pion);
pion_ZvsQ2->Fill(z_DA_pion, Q2_DA_pion);
pion_ZvsMom->Fill(z_DA_pion, mom_pion);
pion_ZvsPhi->Fill(pionPhi,z_DA_pion);
pion_ZvsTheta->Fill(pionTheta, z_DA_pion);
pion_ZvsPhi_HP->Fill(Phi_HP_Deg,z_DA_pion);
pion_ZvsTheta_HP->Fill(Theta_HP_Deg, z_DA_pion);
pion_XbVsMom->Fill(xbj_DA_pion, mom_pion);
pion_XbVsPhT->Fill(xbj_DA_pion, PhT_pion);
pion_XbVsZ->Fill(xbj_DA_pion, z_DA_pion);
pion_XbVsPhi->Fill(pionPhi, xbj_DA_pion);
pion_XbVsTheta->Fill(pionTheta, xbj_DA_pion);
pion_XbVsPhi_HP->Fill(Phi_HP_Deg, xbj_DA_pion);
pion_XbVsTheta_HP->Fill(Theta_HP_Deg, xbj_DA_pion);
pion_XbVsQ2->Fill(xbj_DA_pion, Q2_DA_pion);
pion_PhTvsZvsXb->Fill(xbj_DA_pion, z_DA_pion, PhT_pion);
pion_XbVsEta->Fill(pionEta, xbj_DA_pion);
z_axisSP->Fill(z_axis_x, z_axis_y, z_axis_z);
/*
if(xbj_DA_pion<=1){
for(int ix = 1; ix <= nben; ++ix){
double uVal = pdf->xfxQ(2, xbj_DA_pion, Q2_DA_pion);
hPDF->SetBinContent(i, ix, uVal);
}
if(Q2_DA_pion >= 3 && Q2_DA_pion <= 3.2){
pion_count += 1;
double uVal2 = pdf->xfxQ(2, xbj_DA_pion, Q2_DA_pion);
double dVal2 = pdf->xfxQ(1, xbj_DA_pion, Q2_DA_pion);
double glVal2 = pdf->xfxQ(21, xbj_DA_pion, Q2_DA_pion);
val_x.push_back(xbj_DA_pion);
if(uVal2 >0 && uVal2 <= 1){
uPDF->SetPoint(i, xbj_DA_pion, uVal2);
val_uPDF.push_back(uVal2);
}
if(dVal2 > 0 && dVal2 < 1){
dPDF->SetPoint(i, xbj_DA_pion, dVal2);
val_dPDF.push_back(dVal2);
}
if(glVal2 > 0 && glVal2 >= 1){
glPDF->SetPoint(i, xbj_DA_pion, 0.1*glVal2);
val_glPDF.push_back(glVal2);
}
}
} */
}
}
}
}
}
// KAON
if(pdg == 321)
{
TVector3 trueKaonMom(partMomX[i],partMomY[i],partMomZ[i]);
float mom_kaon = trueKaonMom.Mag();
float E_kaon = sqrt(mom_kaon*mom_kaon + 0.493*0.493);
TLorentzVector kaon(E_kaon, partMomX[i],partMomY[i],partMomZ[i]);
float kaonEta = trueKaonMom.PseudoRapidity();
if(kaonEta <= 3.5 && kaonEta >= -3.5){
double kaonPhiRad = trueKaonMom.Theta();
double kaonThetaRad = trueKaonMom.Phi() + TMath::Pi(); // THETA ANGOLO AZIMUTALE
if(kaonThetaRad >= TMath::Pi()){
kaonThetaRad -= 2*TMath::Pi();
}
float kaonPhi = kaonPhiRad * (180.0 / TMath::Pi());
float kaonTheta = kaonThetaRad * (180.0 / TMath::Pi());
TLorentzVector scatElkaon(currentMom, currentQ2kaon.X(), currentQ2kaon.Y(), currentQ2kaon.Z());
TLorentzVector photon_kaon = ElectronBeam - scatElkaon;
for(unsigned int j=0; j<simuAssoc.GetSize(); j++)
{
int recpdg = std::abs(recPdg[j]);
if(simuAssoc[j] == i) // Find association index matching the index of the thrown particle we are looking at
{
TVector3 recKaonMom(trackMomX[recoAssoc[j]],trackMomY[recoAssoc[j]],trackMomZ[recoAssoc[j]]);
float mom_kaon_Rec = recKaonMom.Mag();
float E_kaon_rec = sqrt(mom_kaon_Rec*mom_kaon_Rec);
TLorentzVector kaon_Rec(E_kaon_rec, trackMomX[recoAssoc[j]],trackMomY[recoAssoc[j]],trackMomZ[recoAssoc[j]]);
float reckaonEta = recKaonMom.PseudoRapidity();
if(reckaonEta <= 3.5 && reckaonEta >= -3.5){
double reckPhi = recKaonMom.Theta();
double reckTheta = recKaonMom.Phi() + TMath::Pi();
if(reckTheta >= TMath::Pi()){
reckTheta -= 2*TMath::Pi();
}
float reckaonTheta = reckTheta * (180.0 / TMath::Pi());
float reckaonPhi = reckPhi * (180.0 / TMath::Pi());
TLorentzVector scatElkaon_Rec(currentMom, currentQ2kaon.X(), currentQ2kaon.Y(), currentQ2kaon.Z());
TLorentzVector photon_kaon_Rec = ElectronBeam - scatElkaon_Rec;
double y_DA_kaon_Rec = ((TMath::Tan(reckPhi*0.5)) / (TMath::Tan(reckPhi*0.5) + TMath::Tan(currentPhi*0.5)));
if(y_DA_kaon_Rec <= 0.95){
if(parentsIndex[i]<=5){
double Q2_DA_kaon_Rec = ((4*18*18*(1-y_DA_kaon_Rec)) / (TMath::Tan(currentPhi*0.5)*TMath::Tan(currentPhi*0.5)));
double xbj_DA_kaon_Rec = (Q2_DA_kaon_Rec) / (4*18*275*y_DA_kaon_Rec);
double z_DA_kaon_Rec = (ProtonBeam * kaon_Rec) / (ProtonBeam * photon_kaon_Rec);
TVector3 PhT_kaon_vec_Rec = recKaonMom - ((recKaonMom * currentQ2kaon) / currentQ2kaon.Mag())*currentQ2kaon.Unit();
double PhT_kaon_Rec = PhT_kaon_vec_Rec.Mag();
if(z_DA_kaon_Rec <= 1){
ReckaonQ2->Fill(Q2_DA_kaon_Rec);
Reckaon_xbj->Fill(xbj_DA_kaon_Rec);
Reckaon_z->Fill(z_DA_kaon_Rec);
Reckaon_PhT->Fill(PhT_kaon_Rec);
Reckaon_mom->Fill(mom_kaon_Rec);
ReckaonEta->Fill(reckaonEta);
ReckaonPhi->Fill(reckaonPhi);
kaon_MomVsEta_rec->Fill(reckaonEta, mom_kaon_Rec);
kaon_PhTvsEta_rec->Fill(reckaonEta, PhT_kaon_Rec);
kaon_MomVsPhi_rec->Fill(reckaonPhi, mom_kaon_Rec);
kaon_PhTvsZ_rec->Fill(z_DA_kaon_Rec, PhT_kaon_Rec);
kaon_MomVsTheta_rec->Fill(reckaonTheta, mom_kaon_Rec);
kaon_ThetaVsPhi_rec->Fill(reckaonTheta,reckaonPhi);
kaon_PhTvsPhi_rec->Fill(reckaonPhi, PhT_kaon_Rec);
kaon_PhTvsTheta_rec->Fill(reckaonTheta, PhT_kaon_Rec);
kaon_PhTvsMom_rec->Fill(PhT_kaon_Rec, mom_kaon_Rec);
kaon_ZvsMom_rec->Fill(z_DA_kaon_Rec, mom_kaon_Rec);
kaon_ZvsPhi_rec->Fill(reckaonPhi,z_DA_kaon_Rec);
kaon_ZvsTheta_rec->Fill(reckaonTheta, z_DA_kaon_Rec);
kaon_XbVsMom_rec->Fill(xbj_DA_kaon_Rec, mom_kaon_Rec);
kaon_XbVsPhT_rec->Fill(xbj_DA_kaon_Rec, PhT_kaon_Rec);
kaon_XbVsZ_rec->Fill(xbj_DA_kaon_Rec, z_DA_kaon_Rec);
kaon_XbVsPhi_rec->Fill(reckaonPhi, xbj_DA_kaon_Rec);
kaon_XbVsTheta_rec->Fill(reckaonTheta, xbj_DA_kaon_Rec);
if(recpdg==pdg){
RealkaonQ2->Fill(Q2_DA_kaon_Rec);
RealkaonX->Fill(xbj_DA_kaon_Rec);
RealkaonZ->Fill(z_DA_kaon_Rec);
RealkaonPhT->Fill(PhT_kaon_Rec);
RealkaonEta->Fill(reckaonEta);
RealkaonPhi->Fill(reckaonPhi);
RealkaonMom->Fill(mom_kaon_Rec);
}
}
PIDgen2rec->Fill(kkaon, checkRecoID(recpdg));
}
}
}
}
}
scatElq_kaon.push_back(currentQ2kaon);
double y_DA_kaon = ((TMath::Tan(kaonPhiRad*0.5)) / (TMath::Tan(kaonPhiRad*0.5) + TMath::Tan(currentPhi*0.5)));
if(y_DA_kaon <= 0.95){
if(parentsIndex[i]<=5){
double Q2_DA_kaon = ((4*18*18*(1-y_DA_kaon)) / (TMath::Tan(currentPhi*0.5)*TMath::Tan(currentPhi*0.5)));
double xbj_DA_kaon = (Q2_DA_kaon) / (4*18*275*y_DA_kaon);
double z_DA_kaon = (ProtonBeam * kaon) / (ProtonBeam * photon_kaon);
TVector3 PhT_kaon_vec = trueKaonMom - ((trueKaonMom * currentQ2kaon) / currentQ2kaon.Mag())*currentQ2kaon.Unit();
double PhT_kaon = PhT_kaon_vec.Mag();
if(z_DA_kaon <= 1){
truekaonQ2->Fill(Q2_DA_kaon);
truekaon_xbj->Fill(xbj_DA_kaon);
truekaon_z->Fill(z_DA_kaon);
truekaon_PhT->Fill(PhT_kaon);
truekaon_mom->Fill(mom_kaon);
truekaonEta->Fill(kaonEta);
truekaonPhi->Fill(kaonPhi);
kaon_MomVsEta->Fill(kaonEta, mom_kaon);
kaon_PhTvsEta->Fill(kaonEta, PhT_kaon);
kaon_MomVsPhi->Fill(kaonPhi, mom_kaon);
kaon_PhTvsZ->Fill(z_DA_kaon, PhT_kaon);
kaon_MomVsTheta->Fill(kaonTheta, mom_kaon);
kaon_ThetaVsPhi->Fill(kaonTheta,kaonPhi);
kaon_PhTvsPhi->Fill(kaonPhi, PhT_kaon);
kaon_PhTvsTheta->Fill(kaonTheta, PhT_kaon);
//kaon_MomVsPhiVsTheta->Fill(kaonTheta, mom_kaon, kaonPhi);
kaon_PhTvsMom->Fill(PhT_kaon,mom_kaon);
kaon_ZvsMom->Fill(z_DA_kaon, mom_kaon);
kaon_ZvsPhi->Fill(kaonPhi,z_DA_kaon);
kaon_ZvsTheta->Fill(kaonTheta, z_DA_kaon);
kaon_XbVsMom->Fill(xbj_DA_kaon, mom_kaon);
kaon_XbVsPhT->Fill(xbj_DA_kaon, PhT_kaon);
kaon_XbVsZ->Fill(xbj_DA_kaon, z_DA_kaon);
kaon_XbVsPhi->Fill(kaonPhi, xbj_DA_kaon);
kaon_XbVsTheta->Fill(kaonTheta, xbj_DA_kaon);
//kaon_PhTvsZvsXb->Fill(xbj_DA_kaon, z_DA_kaon, PhT_kaon);
}
}
}
}
}
// ELECTRON PDG
if(pdg == 11)
{
for(unsigned int j=0; j<simuAssoc.GetSize(); j++)
{
int recpdg = recPdg[j];
if(simuAssoc[j] == i) // Find association index matching the index of the thrown particle we are looking at
{
if(parentsIndex[i]<=5){
PIDgen2rec->Fill(kelectron, checkRecoID(recpdg));
}
}
}
}
// PROTON
if(pdg == 2212)
{
TVector3 trueProtonMom(partMomX[i],partMomY[i],partMomZ[i]);
float mom_proton = trueProtonMom.Mag();
float E_proton = sqrt(mom_proton*mom_proton + 0.937*0.937);
TLorentzVector proton(E_proton, partMomX[i],partMomY[i],partMomZ[i]);
float protonEta = trueProtonMom.PseudoRapidity();
if(protonEta <= 3.5 && protonEta >= -3.5){
double protonPhiRad = trueProtonMom.Theta();
float protonPhi = protonPhiRad * (180.0 / TMath::Pi());
TLorentzVector scatElproton(currentMom, currentQ2proton.X(), currentQ2proton.Y(), currentQ2proton.Z());
TLorentzVector photon_proton = ElectronBeam - scatElproton;
for(unsigned int j=0; j<simuAssoc.GetSize(); j++)
{
int recpdg = std::abs(recPdg[j]);
if(simuAssoc[j] == i) // Find association index matching the index of the thrown particle we are looking at
{
TVector3 recProtMom(trackMomX[recoAssoc[j]],trackMomY[recoAssoc[j]],trackMomZ[recoAssoc[j]]);
float mom_proton_Rec = recProtMom.Mag();
float E_proton_rec = sqrt(mom_proton_Rec*mom_proton_Rec + 0.937*0.937);
TLorentzVector proton_Rec(E_proton_rec, trackMomX[recoAssoc[j]],trackMomY[recoAssoc[j]],trackMomZ[recoAssoc[j]]);
float recprotEta = recProtMom.PseudoRapidity();
if(recprotEta <= 3.5 && recprotEta >= -3.5){
double recprPhi = recProtMom.Theta();
float recprotPhi = recprPhi * (180.0 / TMath::Pi());
TLorentzVector scatElproton_Rec(currentMom, currentQ2proton.X(), currentQ2proton.Y(), currentQ2proton.Z());
TLorentzVector photon_proton_Rec = ElectronBeam - scatElproton_Rec;
double y_DA_proton_Rec = ((TMath::Tan(recprPhi*0.5)) / (TMath::Tan(recprPhi*0.5) + TMath::Tan(currentPhi*0.5)));
if(y_DA_proton_Rec <= 0.95){
if(parentsIndex[i]<=5){
double Q2_DA_proton_Rec = ((4*18*18*(1-y_DA_proton_Rec)) / (TMath::Tan(currentPhi*0.5)*TMath::Tan(currentPhi*0.5)));
double xbj_DA_proton_Rec = (Q2_DA_proton_Rec) / (4*18*275*y_DA_proton_Rec);
double z_DA_proton_Rec = (ProtonBeam * proton_Rec) / (ProtonBeam * photon_proton_Rec);
TVector3 PhT_proton_vec_Rec = recProtMom - ((recProtMom * currentQ2proton) / currentQ2proton.Mag())*currentQ2proton.Unit();
double PhT_proton_Rec = PhT_proton_vec_Rec.Mag();
if(z_DA_proton_Rec <= 1){
RecprotonQ2->Fill(Q2_DA_proton_Rec);
Recproton_xbj->Fill(xbj_DA_proton_Rec);
Recproton_z->Fill(z_DA_proton_Rec);
Recproton_PhT->Fill(PhT_proton_Rec);
Recproton_mom->Fill(mom_proton_Rec);
RecprotonEta->Fill(recprotEta);
RecprotonPhi->Fill(recprotPhi);
proton_MomVsEta_rec->Fill(recprotEta, mom_proton_Rec);
proton_MomVsPhi_rec->Fill(recprotPhi, mom_proton_Rec);
if(recpdg==pdg){
RealprotonQ2->Fill(Q2_DA_proton_Rec);
RealprotonX->Fill(xbj_DA_proton_Rec);
RealprotonZ->Fill(z_DA_proton_Rec);
RealprotonPhT->Fill(PhT_proton_Rec);
RealprotonEta->Fill(recprotEta);
RealprotonPhi->Fill(recprotPhi);
RealprotonMom->Fill(mom_proton_Rec);
}
}
PIDgen2rec->Fill(kproton, checkRecoID(recpdg));
}
}
}
}
}
scatElq_proton.push_back(currentQ2proton);
double y_DA_proton = ((TMath::Tan(protonPhiRad*0.5)) / (TMath::Tan(protonPhiRad*0.5) + TMath::Tan(currentPhi*0.5)));
if(y_DA_proton <= 0.95){
if(parentsIndex[i]<=5){
double Q2_DA_proton = ((4*18*18*(1-y_DA_proton)) / (TMath::Tan(currentPhi*0.5)*TMath::Tan(currentPhi*0.5)));
double xbj_DA_proton = (Q2_DA_proton) / (4*18*275*y_DA_proton);
double z_DA_proton = (ProtonBeam * proton) / (ProtonBeam * photon_proton);
TVector3 PhT_proton_vec = trueProtonMom - ((trueProtonMom * currentQ2proton) / currentQ2proton.Mag())*currentQ2proton.Unit();
double PhT_proton = PhT_proton_vec.Mag();
if(z_DA_proton <= 1){
trueprotonQ2->Fill(Q2_DA_proton);
trueproton_xbj->Fill(xbj_DA_proton);
trueproton_z->Fill(z_DA_proton);