-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestLbarLGen.cpp
1873 lines (1601 loc) · 92.7 KB
/
TestLbarLGen.cpp
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
// A macro attempted to perform event generator that only based and run on (CERN) ROOT.
// For the reaction of PbarP -> LambdabarLambda -> PbarPiplus PPiminus in this test
// And might try to extend to PbarP -> OmegabarOmega in the future.
//
// Random (uniform) angle distribution of decay particles in lambda(and lambdabar) rest frame
// And them boost to CM frame with caluclation of corresponding 4-vectors relations
// In LambdaRest, LambdabarRest and CM frame.
//
// author: Vitor Jose Shen
// supervisor: Michael Papenbrock
// at Uppsala University
//
// Version 02 May 2022
// Revised 20 June 2022
//------------------------------------------------------------------------
// include section
#include <iostream>
using namespace std;
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "TLorentzVector.h"
#include "TVector3.h"
#include "TMath.h"
#include "TTree.h"
//------------------------------------------------------------------------
int TestLbarLGen(){
cout << "As ROOT macro to perform llbar with default generation of 10^6 events or set the event number inside () of function:" << endl;
cout << "To test the angle's distribution only, use function: testAngle()" << endl;
cout << "The overall event generation including 4-momentum and angles, use function: testGenllbar()" << endl;
// cout << "The number of events can be also set by enter number inside (), the default number is 1 million" << endl;
cout << "Check 4-vector conservation, use function: CheckLbarL()" << endl;
return 0;
}
//------------------------------------------------------------------------
void testGenllbar(Int_t nrEvents=1000000){
// Int_t nrEvents=1000000
// cout << "The number of events should be an integer and greater than 0" << endl;
// cout << "Please enter the number of events that you want to simulatie:" << endl;
// cin >> nrEvents;
// cout << nrEvents << "Events will be simulated then!" << endl;
TFile* f = TFile::Open("testGenllbar.root","RECREATE");
TRandom3 *r3=new TRandom3();
r3->SetSeed(time(NULL));
// TNtuple *ntuple = new TNtuple;
/////////////////////////////////////////////////////////////////////////////
// Tree: Rest frame of lambda or lambdabar
/////////////////////////////////////////////////////////////////////////////
//
// Hyperon side
TTree *protonTree=new TTree("Proton_LambdaRF","Proton in Lambda Rest Frame");
Float_t protonPhi, protonCosTheta, protonTheta;
Float_t m_proton, E_proton, p_proton, px_proton, py_proton, pz_proton, pt_proton; //used in Tree Branch
// Float_t m_protontest;
protonTree->Branch("protonPhi", &protonPhi, "protonPhi/F");
protonTree->Branch("protonCosTheta", &protonCosTheta, "protonCosTheta/F");
protonTree->Branch("protonTheta", &protonTheta, "protonTheta/F");
protonTree->Branch("m_proton", &m_proton, "m_proton/F");
// protonTree->Branch("m_protontest", &m_protontest, "m_protontest/F");
protonTree->Branch("E_proton", &E_proton, "E_proton/F");
protonTree->Branch("p_proton", &p_proton, "p_proton/F");
protonTree->Branch("px_proton", &px_proton, "px_proton/F");
protonTree->Branch("py_proton", &py_proton, "py_proton/F");
protonTree->Branch("pz_proton", &pz_proton, "pz_proton/F");
protonTree->Branch("pt_proton", &pt_proton, "pt_proton/F");
TTree *piminusTree=new TTree("Piminus_LambdaRF","Piminus in Lambda Rest Frame");
Float_t piminusPhi, piminusCosTheta, piminusTheta;
Float_t E_piminus, p_piminus, px_piminus, py_piminus, pz_piminus, pt_piminus; //used in Tree Branch
// Float_t m_piminustest;
Float_t m_piminus;
piminusTree->Branch("piminusPhi", &piminusPhi, "piminusPhi/F");
piminusTree->Branch("piminusCosTheta", &piminusCosTheta, "piminusCosTheta/F");
piminusTree->Branch("piminusTheta", &piminusTheta, "piminusTheta/F");
piminusTree->Branch("m_piminus", &m_piminus, "m_piminus/F");
// piminusTree->Branch("m_piminustest", &m_piminustest, "m_piminustest/F");
piminusTree->Branch("E_piminus", &E_piminus, "E_piminus/F");
piminusTree->Branch("p_piminus", &p_piminus, "p_piminus/F");
piminusTree->Branch("px_piminus", &px_piminus, "px_piminus/F");
piminusTree->Branch("py_piminus", &py_piminus, "py_piminus/F");
piminusTree->Branch("pz_piminus", &pz_piminus, "pz_piminus/F");
piminusTree->Branch("pt_piminus", &pt_piminus, "pt_piminus/F");
//
// Anti-hyperon side
TTree *protonbarTree=new TTree("Protonbar_LambdaRF","Protonbar in Lambda Rest Frame");
Float_t protonbarPhi, protonbarCosTheta, protonbarTheta;
Float_t m_protonbar, E_protonbar, p_protonbar, px_protonbar, py_protonbar, pz_protonbar, pt_protonbar; //used in Tree Branch
// Float_t m_protonbartest;
protonbarTree->Branch("protonbarPhi", &protonbarPhi, "protonbarPhi/F");
protonbarTree->Branch("protonbarCosTheta", &protonbarCosTheta, "protonbarCosTheta/F");
protonbarTree->Branch("protonbarTheta", &protonbarTheta, "protonbarTheta/F");
protonbarTree->Branch("m_protonbar", &m_protonbar, "m_protonbar/F");
// protonbarTree->Branch("m_protonbartest", &m_protonbartest, "m_protonbartest/F");
protonbarTree->Branch("E_protonbar", &E_protonbar, "E_protonbar/F");
protonbarTree->Branch("p_protonbar", &p_protonbar, "p_protonbar/F");
protonbarTree->Branch("px_protonbar", &px_protonbar, "px_protonbar/F");
protonbarTree->Branch("py_protonbar", &py_protonbar, "py_protonbar/F");
protonbarTree->Branch("pz_protonbar", &pz_protonbar, "pz_protonbar/F");
protonbarTree->Branch("pt_protonbar", &pt_protonbar, "pt_protonbar/F");
TTree *piplusTree=new TTree("Piplus_LambdaRF","Piplus in Lambda Rest Frame");
Float_t piplusPhi, piplusCosTheta, piplusTheta;
Float_t E_piplus, p_piplus, px_piplus, py_piplus, pz_piplus, pt_piplus; //used in Tree Branch
// Float_t m_piplustest;
Float_t m_piplus;
piplusTree->Branch("piplusPhi", &piplusPhi, "piplusPhi/F");
piplusTree->Branch("piplusCosTheta", &piplusCosTheta, "piplusCosTheta/F");
piplusTree->Branch("piplusTheta", &piplusTheta, "piplusTheta/F");
piplusTree->Branch("m_piplus", &m_piplus, "m_piplus/F");
// piplusTree->Branch("m_piplustest", &m_piplustest, "m_piplustest/F");
piplusTree->Branch("E_piplus", &E_piplus, "E_piplus/F");
piplusTree->Branch("p_piplus", &p_piplus, "p_piplus/F");
piplusTree->Branch("px_piplus", &px_piplus, "px_piplus/F");
piplusTree->Branch("py_piplus", &py_piplus, "py_piplus/F");
piplusTree->Branch("pz_piplus", &pz_piplus, "pz_piplus/F");
piplusTree->Branch("pt_piplus", &pt_piplus, "pt_piplus/F");
/////////////////////////////////////////////////////////////////////////////
// Tree: CM frame
/////////////////////////////////////////////////////////////////////////////
//
// Hyperon side
TTree *protonCMTree=new TTree("Proton_CM","Proton in CM Frame");
Float_t protonPhiCM, protonCosThetaCM, protonThetaCM;
Float_t m_protonCM, E_protonCM, p_protonCM, px_protonCM, py_protonCM, pz_protonCM, pt_protonCM; //used in Tree Branch
protonCMTree->Branch("protonPhiCM", &protonPhiCM, "protonPhiCM/F");
protonCMTree->Branch("protonCosThetaCM", &protonCosThetaCM, "protonCosThetaCM/F");
protonCMTree->Branch("protonThetaCM", &protonThetaCM, "protonThetaCM/F");
protonCMTree->Branch("m_protonCM", &m_protonCM, "m_protonCM/F");
protonCMTree->Branch("E_protonCM", &E_protonCM, "E_protonCM/F");
protonCMTree->Branch("p_protonCM", &p_protonCM, "p_protonCM/F");
protonCMTree->Branch("px_protonCM", &px_protonCM, "px_protonCM/F");
protonCMTree->Branch("py_protonCM", &py_protonCM, "py_protonCM/F");
protonCMTree->Branch("pz_protonCM", &pz_protonCM, "pz_protonCM/F");
protonCMTree->Branch("pt_protonCM", &pt_protonCM, "pt_protonCM/F");
TTree *piminusCMTree=new TTree("Piminus_CM","Piminus in CM Frame");
Float_t piminusPhiCM, piminusCosThetaCM, piminusThetaCM;
Float_t E_piminusCM, p_piminusCM, px_piminusCM, py_piminusCM, pz_piminusCM, pt_piminusCM; //used in Tree Branch
Float_t m_piminusCM;
piminusCMTree->Branch("piminusPhiCM", &piminusPhiCM, "piminusPhiCM/F");
piminusCMTree->Branch("piminusCosThetaCM", &piminusCosThetaCM, "piminusCosThetaCM/F");
piminusCMTree->Branch("piminusThetaCM", &piminusThetaCM, "piminusThetaCM/F");
piminusCMTree->Branch("m_piminusCM", &m_piminusCM, "m_piminusCM/F");
piminusCMTree->Branch("E_piminusCM", &E_piminusCM, "E_piminusCM/F");
piminusCMTree->Branch("p_piminusCM", &p_piminusCM, "p_piminusCM/F");
piminusCMTree->Branch("px_piminusCM", &px_piminusCM, "px_piminusCM/F");
piminusCMTree->Branch("py_piminusCM", &py_piminusCM, "py_piminusCM/F");
piminusCMTree->Branch("pz_piminusCM", &pz_piminusCM, "pz_piminusCM/F");
piminusCMTree->Branch("pt_piminusCM", &pt_piminusCM, "pt_piminusCM/F");
TTree *lambdaCMTree=new TTree("Lambda_CM","Lambda in CM Frame");
Float_t lambdaPhiCM, lambdaCosThetaCM, lambdaThetaCM;
Float_t E_lambdaCM, p_lambdaCM, px_lambdaCM, py_lambdaCM, pz_lambdaCM, pt_lambdaCM; //used in Tree Branch
Float_t m_lambdaCM;
lambdaCMTree->Branch("lambdaPhiCM", &lambdaPhiCM, "lambdaPhiCM/F");
lambdaCMTree->Branch("lambdaCosThetaCM", &lambdaCosThetaCM, "lambdaCosThetaCM/F");
lambdaCMTree->Branch("lambdaThetaCM", &lambdaThetaCM, "lambdaThetaCM/F");
lambdaCMTree->Branch("m_lambdaCM", &m_lambdaCM, "m_lambdaCM/F");
lambdaCMTree->Branch("E_lambdaCM", &E_lambdaCM, "E_lambdaCM/F");
lambdaCMTree->Branch("p_lambdaCM", &p_lambdaCM, "p_lambdaCM/F");
lambdaCMTree->Branch("px_lambdaCM", &px_lambdaCM, "px_lambdaCM/F");
lambdaCMTree->Branch("py_lambdaCM", &py_lambdaCM, "py_lambdaCM/F");
lambdaCMTree->Branch("pz_lambdaCM", &pz_lambdaCM, "pz_lambdaCM/F");
lambdaCMTree->Branch("pt_lambdaCM", &pt_lambdaCM, "pt_lambdaCM/F");
//
// Anti-hyperon side
TTree *protonbarCMTree=new TTree("Protonbar_CM","Protonbar in CM Frame");
Float_t protonbarPhiCM, protonbarCosThetaCM, protonbarThetaCM;
Float_t m_protonbarCM, E_protonbarCM, p_protonbarCM, px_protonbarCM, py_protonbarCM, pz_protonbarCM, pt_protonbarCM; //used in Tree Branch
protonbarCMTree->Branch("protonbarPhiCM", &protonbarPhiCM, "protonbarPhiCM/F");
protonbarCMTree->Branch("protonbarCosThetaCM", &protonbarCosThetaCM, "protonbarCosThetaCM/F");
protonbarCMTree->Branch("protonbarThetaCM", &protonbarThetaCM, "protonbarThetaCM/F");
protonbarCMTree->Branch("m_protonbarCM", &m_protonbarCM, "m_protonbarCM/F");
protonbarCMTree->Branch("E_protonbarCM", &E_protonbarCM, "E_protonbarCM/F");
protonbarCMTree->Branch("p_protonbarCM", &p_protonbarCM, "p_protonbarCM/F");
protonbarCMTree->Branch("px_protonbarCM", &px_protonbarCM, "px_protonbarCM/F");
protonbarCMTree->Branch("py_protonbarCM", &py_protonbarCM, "py_protonbarCM/F");
protonbarCMTree->Branch("pz_protonbarCM", &pz_protonbarCM, "pz_protonbarCM/F");
protonbarCMTree->Branch("pt_protonbarCM", &pt_protonbarCM, "pt_protonbarCM/F");
TTree *piplusCMTree=new TTree("Piplus_CM","Piplus in CM Frame");
Float_t piplusPhiCM, piplusCosThetaCM, piplusThetaCM;
Float_t E_piplusCM, p_piplusCM, px_piplusCM, py_piplusCM, pz_piplusCM, pt_piplusCM; //used in Tree Branch
Float_t m_piplusCM;
piplusCMTree->Branch("piplusPhiCM", &piplusPhiCM, "piplusPhiCM/F");
piplusCMTree->Branch("piplusCosThetaCM", &piplusCosThetaCM, "piplusCosThetaCM/F");
piplusCMTree->Branch("piplusThetaCM", &piplusThetaCM, "piplusThetaCM/F");
piplusCMTree->Branch("m_piplusCM", &m_piplusCM, "m_piplusCM/F");
piplusCMTree->Branch("E_piplusCM", &E_piplusCM, "E_piplusCM/F");
piplusCMTree->Branch("p_piplusCM", &p_piplusCM, "p_piplusCM/F");
piplusCMTree->Branch("px_piplusCM", &px_piplusCM, "px_piplusCM/F");
piplusCMTree->Branch("py_piplusCM", &py_piplusCM, "py_piplusCM/F");
piplusCMTree->Branch("pz_piplusCM", &pz_piplusCM, "pz_piplusCM/F");
piplusCMTree->Branch("pt_piplusCM", &pt_piplusCM, "pt_piplusCM/F");
TTree *lambdabarCMTree=new TTree("Lambdabar_CM","Lambdabar in CM Frame");
Float_t lambdabarPhiCM, lambdabarCosThetaCM, lambdabarThetaCM;
Float_t E_lambdabarCM, p_lambdabarCM, px_lambdabarCM, py_lambdabarCM, pz_lambdabarCM, pt_lambdabarCM; //used in Tree Branch
Float_t m_lambdabarCM;
lambdabarCMTree->Branch("lambdabarPhiCM", &lambdabarPhiCM, "lambdabarPhiCM/F");
lambdabarCMTree->Branch("lambdabarCosThetaCM", &lambdabarCosThetaCM, "lambdabarCosThetaCM/F");
lambdabarCMTree->Branch("lambdabarThetaCM", &lambdabarThetaCM, "lambdabarThetaCM/F");
lambdabarCMTree->Branch("m_lambdabarCM", &m_lambdabarCM, "m_lambdabarCM/F");
lambdabarCMTree->Branch("E_lambdabarCM", &E_lambdabarCM, "E_lambdabarCM/F");
lambdabarCMTree->Branch("p_lambdabarCM", &p_lambdabarCM, "p_lambdabarCM/F");
lambdabarCMTree->Branch("px_lambdabarCM", &px_lambdabarCM, "px_lambdabarCM/F");
lambdabarCMTree->Branch("py_lambdabarCM", &py_lambdabarCM, "py_lambdabarCM/F");
lambdabarCMTree->Branch("pz_lambdabarCM", &pz_lambdabarCM, "pz_lambdabarCM/F");
lambdabarCMTree->Branch("pt_lambdabarCM", &pt_lambdabarCM, "pt_lambdabarCM/F");
// //
// // pbarp CM
TTree *pbarpCMTree=new TTree("PbarP_CM","PbarP in CM Frame");
Float_t pbarPhiCM, pPhiCM, pbarCosThetaCM, pCosThetaCM,pbarThetaCM, pThetaCM;
pbarpCMTree->Branch("pPhiCM", &pPhiCM, "pPhiCM/F");
pbarpCMTree->Branch("pCosThetaCM", &pCosThetaCM, "pCosThetaCM/F");
pbarpCMTree->Branch("pThetaCM", &pThetaCM, "pThetaCM/F");
pbarpCMTree->Branch("pbarPhiCM", &pbarPhiCM, "pbarPhiCM/F");
pbarpCMTree->Branch("pbarCosThetaCM", &pbarCosThetaCM, "pbarCosThetaCM/F");
pbarpCMTree->Branch("pbarThetaCM", &pbarThetaCM, "pbarThetaCM/F");
/////////////////////////////////////////////////////////////////////////////
// Tree: Rotated CM frame
/////////////////////////////////////////////////////////////////////////////
// Hyperon side
TTree *lambdaCMrotTree=new TTree("Lambda_CMrot","Lambda in CM Rotation Frame");
Float_t lambdaPhiCMrot, lambdaCosThetaCMrot, lambdaThetaCMrot;
Float_t E_lambdaCMrot, p_lambdaCMrot, px_lambdaCMrot, py_lambdaCMrot, pz_lambdaCMrot, pt_lambdaCMrot; //used in Tree Branch
Float_t m_lambdaCMrot;
lambdaCMrotTree->Branch("lambdaPhiCMrot", &lambdaPhiCMrot, "lambdaPhiCMrot/F");
lambdaCMrotTree->Branch("lambdaCosThetaCMrot", &lambdaCosThetaCMrot, "lambdaCosThetaCMrot/F");
lambdaCMrotTree->Branch("lambdaThetaCMrot", &lambdaThetaCMrot, "lambdaThetaCMrot/F");
lambdaCMrotTree->Branch("m_lambdaCMrot", &m_lambdaCMrot, "m_lambdaCMrot/F");
lambdaCMrotTree->Branch("E_lambdaCMrot", &E_lambdaCMrot, "E_lambdaCMrot/F");
lambdaCMrotTree->Branch("p_lambdaCMrot", &p_lambdaCMrot, "p_lambdaCMrot/F");
lambdaCMrotTree->Branch("px_lambdaCMrot", &px_lambdaCMrot, "px_lambdaCMrot/F");
lambdaCMrotTree->Branch("py_lambdaCMrot", &py_lambdaCMrot, "py_lambdaCMrot/F");
lambdaCMrotTree->Branch("pz_lambdaCMrot", &pz_lambdaCMrot, "pz_lambdaCMrot/F");
lambdaCMrotTree->Branch("pt_lambdaCMrot", &pt_lambdaCMrot, "pt_lambdaCMrot/F");
TTree *protonCMrotTree=new TTree("Proton_CMrot","Proton in CM Rotation Frame");
Float_t protonPhiCMrot, protonCosThetaCMrot, protonThetaCMrot;
Float_t m_protonCMrot, E_protonCMrot, p_protonCMrot, px_protonCMrot, py_protonCMrot, pz_protonCMrot, pt_protonCMrot; //used in Tree Branch
protonCMrotTree->Branch("protonPhiCMrot", &protonPhiCMrot, "protonPhiCMrot/F");
protonCMrotTree->Branch("protonCosThetaCMrot", &protonCosThetaCMrot, "protonCosThetaCMrot/F");
protonCMrotTree->Branch("protonThetaCMrot", &protonThetaCMrot, "protonThetaCMrot/F");
protonCMrotTree->Branch("m_protonCMrot", &m_protonCMrot, "m_protonCMrot/F");
protonCMrotTree->Branch("E_protonCMrot", &E_protonCMrot, "E_protonCMrot/F");
protonCMrotTree->Branch("p_protonCMrot", &p_protonCMrot, "p_protonCMrot/F");
protonCMrotTree->Branch("px_protonCMrot", &px_protonCMrot, "px_protonCMrot/F");
protonCMrotTree->Branch("py_protonCMrot", &py_protonCMrot, "py_protonCMrot/F");
protonCMrotTree->Branch("pz_protonCMrot", &pz_protonCMrot, "pz_protonCMrot/F");
protonCMrotTree->Branch("pt_protonCMrot", &pt_protonCMrot, "pt_protonCMrot/F");
TTree *piminusCMrotTree=new TTree("Piminus_CMrot","Piminus in CM Rotation Frame");
Float_t piminusPhiCMrot, piminusCosThetaCMrot, piminusThetaCMrot;
Float_t E_piminusCMrot, p_piminusCMrot, px_piminusCMrot, py_piminusCMrot, pz_piminusCMrot, pt_piminusCMrot; //used in Tree Branch
Float_t m_piminusCMrot;
piminusCMrotTree->Branch("piminusPhiCMrot", &piminusPhiCMrot, "piminusPhiCMrot/F");
piminusCMrotTree->Branch("piminusCosThetaCMrot", &piminusCosThetaCMrot, "piminusCosThetaCMrot/F");
piminusCMrotTree->Branch("piminusThetaCMrot", &piminusThetaCMrot, "piminusThetaCMrot/F");
piminusCMrotTree->Branch("m_piminusCMrot", &m_piminusCMrot, "m_piminusCMrot/F");
piminusCMrotTree->Branch("E_piminusCMrot", &E_piminusCMrot, "E_piminusCMrot/F");
piminusCMrotTree->Branch("p_piminusCMrot", &p_piminusCMrot, "p_piminusCMrot/F");
piminusCMrotTree->Branch("px_piminusCMrot", &px_piminusCMrot, "px_piminusCMrot/F");
piminusCMrotTree->Branch("py_piminusCMrot", &py_piminusCMrot, "py_piminusCMrot/F");
piminusCMrotTree->Branch("pz_piminusCMrot", &pz_piminusCMrot, "pz_piminusCMrot/F");
piminusCMrotTree->Branch("pt_piminusCMrot", &pt_piminusCMrot, "pt_piminusCMrot/F");
//
// Anti-hyperon side
TTree *lambdabarCMrotTree=new TTree("Lambdabar_CMrot","Lambdabar in CM Rotation Frame");
Float_t lambdabarPhiCMrot, lambdabarCosThetaCMrot, lambdabarThetaCMrot;
Float_t E_lambdabarCMrot, p_lambdabarCMrot, px_lambdabarCMrot, py_lambdabarCMrot, pz_lambdabarCMrot, pt_lambdabarCMrot; //used in Tree Branch
Float_t m_lambdabarCMrot;
lambdabarCMrotTree->Branch("lambdabarPhiCMrot", &lambdabarPhiCMrot, "lambdabarPhiCMrot/F");
lambdabarCMrotTree->Branch("lambdabarCosThetaCMrot", &lambdabarCosThetaCMrot, "lambdabarCosThetaCMrot/F");
lambdabarCMrotTree->Branch("lambdabarThetaCMrot", &lambdabarThetaCMrot, "lambdabarThetaCMrot/F");
lambdabarCMrotTree->Branch("m_lambdabarCMrot", &m_lambdabarCMrot, "m_lambdabarCMrot/F");
lambdabarCMrotTree->Branch("E_lambdabarCMrot", &E_lambdabarCMrot, "E_lambdabarCMrot/F");
lambdabarCMrotTree->Branch("p_lambdabarCMrot", &p_lambdabarCMrot, "p_lambdabarCMrot/F");
lambdabarCMrotTree->Branch("px_lambdabarCMrot", &px_lambdabarCMrot, "px_lambdabarCMrot/F");
lambdabarCMrotTree->Branch("py_lambdabarCMrot", &py_lambdabarCMrot, "py_lambdabarCMrot/F");
lambdabarCMrotTree->Branch("pz_lambdabarCMrot", &pz_lambdabarCMrot, "pz_lambdabarCMrot/F");
lambdabarCMrotTree->Branch("pt_lambdabarCMrot", &pt_lambdabarCMrot, "pt_lambdabarCMrot/F");
TTree *protonbarCMrotTree=new TTree("Protonbar_CMrot","Protonbar in CM Rotation Frame");
Float_t protonbarPhiCMrot, protonbarCosThetaCMrot, protonbarThetaCMrot;
Float_t m_protonbarCMrot, E_protonbarCMrot, p_protonbarCMrot, px_protonbarCMrot, py_protonbarCMrot, pz_protonbarCMrot, pt_protonbarCMrot; //used in Tree Branch
protonbarCMrotTree->Branch("protonbarPhiCMrot", &protonbarPhiCMrot, "protonbarPhiCMrot/F");
protonbarCMrotTree->Branch("protonbarCosThetaCMrot", &protonbarCosThetaCMrot, "protonbarCosThetaCMrot/F");
protonbarCMrotTree->Branch("protonbarThetaCMrot", &protonbarThetaCMrot, "protonbarThetaCMrot/F");
protonbarCMrotTree->Branch("m_protonbarCMrot", &m_protonbarCMrot, "m_protonbarCMrot/F");
protonbarCMrotTree->Branch("E_protonbarCMrot", &E_protonbarCMrot, "E_protonbarCMrot/F");
protonbarCMrotTree->Branch("p_protonbarCMrot", &p_protonbarCMrot, "p_protonbarCMrot/F");
protonbarCMrotTree->Branch("px_protonbarCMrot", &px_protonbarCMrot, "px_protonbarCMrot/F");
protonbarCMrotTree->Branch("py_protonbarCMrot", &py_protonbarCMrot, "py_protonbarCMrot/F");
protonbarCMrotTree->Branch("pz_protonbarCMrot", &pz_protonbarCMrot, "pz_protonbarCMrot/F");
protonbarCMrotTree->Branch("pt_protonbarCMrot", &pt_protonbarCMrot, "pt_protonbarCMrot/F");
TTree *piplusCMrotTree=new TTree("Piplus_CMrot","Piplus in CM Rotation Frame");
Float_t piplusPhiCMrot, piplusCosThetaCMrot, piplusThetaCMrot;
Float_t E_piplusCMrot, p_piplusCMrot, px_piplusCMrot, py_piplusCMrot, pz_piplusCMrot, pt_piplusCMrot; //used in Tree Branch
Float_t m_piplusCMrot;
piplusCMrotTree->Branch("piplusPhiCMrot", &piplusPhiCMrot, "piplusPhiCMrot/F");
piplusCMrotTree->Branch("piplusCosThetaCMrot", &piplusCosThetaCMrot, "piplusCosThetaCMrot/F");
piplusCMrotTree->Branch("piplusThetaCMrot", &piplusThetaCMrot, "piplusThetaCMrot/F");
piplusCMrotTree->Branch("m_piplusCMrot", &m_piplusCMrot, "m_piplusCMrot/F");
piplusCMrotTree->Branch("E_piplusCMrot", &E_piplusCMrot, "E_piplusCMrot/F");
piplusCMrotTree->Branch("p_piplusCMrot", &p_piplusCMrot, "p_piplusCMrot/F");
piplusCMrotTree->Branch("px_piplusCMrot", &px_piplusCMrot, "px_piplusCMrot/F");
piplusCMrotTree->Branch("py_piplusCMrot", &py_piplusCMrot, "py_piplusCMrot/F");
piplusCMrotTree->Branch("pz_piplusCMrot", &pz_piplusCMrot, "pz_piplusCMrot/F");
piplusCMrotTree->Branch("pt_piplusCMrot", &pt_piplusCMrot, "pt_piplusCMrot/F");
//
/////////////////////////////////////////////////////////////////////////////
// Tree: Rotated in rest frame of lambda or lambdabar
/////////////////////////////////////////////////////////////////////////////
//
// Hyperon side
TTree *protonRotTree=new TTree("ProtonRot_LambdaRF","Proton in Lambda Rest Frame after rotation");
Float_t protonRotPhi, protonRotCosTheta, protonRotTheta;
Float_t m_protonRot, E_protonRot, p_protonRot, px_protonRot, py_protonRot, pz_protonRot, pt_protonRot; //used in Tree Branch
// Float_t m_protonRottest;
protonRotTree->Branch("protonRotPhi", &protonRotPhi, "protonRotPhi/F");
protonRotTree->Branch("protonRotCosTheta", &protonRotCosTheta, "protonRotCosTheta/F");
protonRotTree->Branch("protonRotTheta", &protonRotTheta, "protonRotTheta/F");
protonRotTree->Branch("m_protonRot", &m_protonRot, "m_protonRot/F");
// protonRotTree->Branch("m_protonRottest", &m_protonRottest, "m_protonRottest/F");
protonRotTree->Branch("E_protonRot", &E_protonRot, "E_protonRot/F");
protonRotTree->Branch("p_protonRot", &p_protonRot, "p_protonRot/F");
protonRotTree->Branch("px_protonRot", &px_protonRot, "px_protonRot/F");
protonRotTree->Branch("py_protonRot", &py_protonRot, "py_protonRot/F");
protonRotTree->Branch("pz_protonRot", &pz_protonRot, "pz_protonRot/F");
protonRotTree->Branch("pt_protonRot", &pt_protonRot, "pt_protonRot/F");
TTree *piminusRotTree=new TTree("PiminusRot_LambdaRF","Piminus in Lambda Rest Frame after rotation");
Float_t piminusRotPhi, piminusRotCosTheta, piminusRotTheta;
Float_t E_piminusRot, p_piminusRot, px_piminusRot, py_piminusRot, pz_piminusRot, pt_piminusRot; //used in Tree Branch
// Float_t m_piminusRottest;
Float_t m_piminusRot;
piminusRotTree->Branch("piminusRotPhi", &piminusRotPhi, "piminusRotPhi/F");
piminusRotTree->Branch("piminusRotCosTheta", &piminusRotCosTheta, "piminusRotCosTheta/F");
piminusRotTree->Branch("piminusRotTheta", &piminusRotTheta, "piminusRotTheta/F");
piminusRotTree->Branch("m_piminusRot", &m_piminusRot, "m_piminusRot/F");
// piminusRotTree->Branch("m_piminusRottest", &m_piminusRottest, "m_piminusRottest/F");
piminusRotTree->Branch("E_piminusRot", &E_piminusRot, "E_piminusRot/F");
piminusRotTree->Branch("p_piminusRot", &p_piminusRot, "p_piminusRot/F");
piminusRotTree->Branch("px_piminusRot", &px_piminusRot, "px_piminusRot/F");
piminusRotTree->Branch("py_piminusRot", &py_piminusRot, "py_piminusRot/F");
piminusRotTree->Branch("pz_piminusRot", &pz_piminusRot, "pz_piminusRot/F");
piminusRotTree->Branch("pt_piminusRot", &pt_piminusRot, "pt_piminusRot/F");
//
// Anti-hyperon side
TTree *protonbarRotTree=new TTree("ProtonbarRot_LambdaRF","Protonbar in Lambda Rest Frame after rotation");
Float_t protonbarRotPhi, protonbarRotCosTheta, protonbarRotTheta;
Float_t m_protonbarRot, E_protonbarRot, p_protonbarRot, px_protonbarRot, py_protonbarRot, pz_protonbarRot, pt_protonbarRot; //used in Tree Branch
// Float_t m_protonbarRottest;
protonbarRotTree->Branch("protonbarRotPhi", &protonbarRotPhi, "protonbarRotPhi/F");
protonbarRotTree->Branch("protonbarRotCosTheta", &protonbarRotCosTheta, "protonbarRotCosTheta/F");
protonbarRotTree->Branch("protonbarRotTheta", &protonbarRotTheta, "protonbarRotTheta/F");
protonbarRotTree->Branch("m_protonbarRot", &m_protonbarRot, "m_protonbarRot/F");
// protonbarRotTree->Branch("m_protonbarRottest", &m_protonbarRottest, "m_protonbarRottest/F");
protonbarRotTree->Branch("E_protonbarRot", &E_protonbarRot, "E_protonbarRot/F");
protonbarRotTree->Branch("p_protonbarRot", &p_protonbarRot, "p_protonbarRot/F");
protonbarRotTree->Branch("px_protonbarRot", &px_protonbarRot, "px_protonbarRot/F");
protonbarRotTree->Branch("py_protonbarRot", &py_protonbarRot, "py_protonbarRot/F");
protonbarRotTree->Branch("pz_protonbarRot", &pz_protonbarRot, "pz_protonbarRot/F");
protonbarRotTree->Branch("pt_protonbarRot", &pt_protonbarRot, "pt_protonbarRot/F");
TTree *piplusRotTree=new TTree("PiplusRot_LambdaRF","PiplusRot in Lambda Rest Frame");
Float_t piplusRotPhi, piplusRotCosTheta, piplusRotTheta;
Float_t E_piplusRot, p_piplusRot, px_piplusRot, py_piplusRot, pz_piplusRot, pt_piplusRot; //used in Tree Branch
// Float_t m_piplusRottest;
Float_t m_piplusRot;
piplusRotTree->Branch("piplusRotPhi", &piplusRotPhi, "piplusRotPhi/F");
piplusRotTree->Branch("piplusRotCosTheta", &piplusRotCosTheta, "piplusRotCosTheta/F");
piplusRotTree->Branch("piplusRotTheta", &piplusRotTheta, "piplusRotTheta/F");
piplusRotTree->Branch("m_piplusRot", &m_piplusRot, "m_piplusRot/F");
// piplusRotTree->Branch("m_piplusRottest", &m_piplusRottest, "m_piplusRottest/F");
piplusRotTree->Branch("E_piplusRot", &E_piplusRot, "E_piplusRot/F");
piplusRotTree->Branch("p_piplusRot", &p_piplusRot, "p_piplusRot/F");
piplusRotTree->Branch("px_piplusRot", &px_piplusRot, "px_piplusRot/F");
piplusRotTree->Branch("py_piplusRot", &py_piplusRot, "py_piplusRot/F");
piplusRotTree->Branch("pz_piplusRot", &pz_piplusRot, "pz_piplusRot/F");
piplusRotTree->Branch("pt_piplusRot", &pt_piplusRot, "pt_piplusRot/F");
//
//
////////////////////////////////////////////////////////////////////////////////
Float_t m_p=0.9383, m_pi=0.1396, m_lam=1.115, m_ome=1.672; // Mass in GeV
Float_t E_p, E_pi, E_lam; // Energy in GeV
Float_t p_p, p_pi, p_lam; // Magnitude of 3-vector
TStopwatch *st=new TStopwatch();
st->Start();
////////////////////////////////////////
// Lambda Rest frame related pre-computation
// (checked in April 2022)
////////////////////////////////////////
p_p = (sqrt(pow((pow(m_lam,2)+pow(m_p,2)-pow(m_pi,2)),2)-4*pow(m_lam,2)*pow(m_p,2))) / (2*m_lam) ; //proton's magnitute of momentum
// cout << "Momentum magnitute of proton:" << p_p << endl;
// E_p = (pow(m_lam,2)+pow(m_p,2)-pow(m_pi,2)) / (2*m_lam); //proton's Energy
E_p = sqrt(m_p*m_p + p_p*p_p); // MP: calculate proton energy from mass and momentum
// cout << "Energy of proton:" << E_p << endl;
// E_pi = (pow(m_lam,2)+pow(m_pi,2)-pow(m_p,2)) / (2*m_lam); //piminus's Energy
E_pi = sqrt(m_pi*m_pi + p_p*p_p); // MP: calculate pion energy from mass and momentum
// cout << "Energy of piminus:" << E_pi << endl;
p_pi = p_p; //the same piminus's magnitute of momentum
// cout << "Momentum magnitute of piminus:" << p_pi << endl;
////////////////////////////////////////
// CM frame related pre-computation
// (checked in April 2022)
////////////////////////////////////////
Float_t p_beam = 1.64; //beam momentum in \pbarp lab frame using 1.64GeV
Float_t E_pbarp; //CM frame
E_pbarp = sqrt(pow(m_p,2)+2*sqrt(pow(p_beam,2)+pow(m_p,2))*m_p+pow(m_p,2));
E_lam = E_pbarp/2 ;
// cout << "Energy of lambdaCM:" << E_lam << endl;
p_lam = sqrt(pow(E_lam,2)-pow(m_lam,2));
Float_t gamma_lam, v_lam;
gamma_lam = E_lam / m_lam;
v_lam = p_lam / E_lam; // gamma_lam = 1/sqrt(1-pow(v_lam,2))
Float_t beta_lam;
beta_lam = sqrt(1-(1/(pow(gamma_lam,2))));
Float_t tau_lam = 2.631E-10; //mean life time
TVector3 *v_p = new TVector3; // 3-momentum
TVector3 *v_pi = new TVector3; // 3-momentum
TLorentzVector *lv_p = new TLorentzVector; // 4-momentum
TLorentzVector *lv_pi = new TLorentzVector; // 4-momentum
TVector3 *v_l = new TVector3; // 3-momentum
TLorentzVector *lv_l = new TLorentzVector; // 4-momentum
// add antihyperon side
TVector3 *v_pbar = new TVector3; // 3-momentum
TVector3 *v_piplus = new TVector3; // 3-momentum
TLorentzVector *lv_pbar = new TLorentzVector; // 4-momentum
TLorentzVector *lv_piplus = new TLorentzVector; // 4-momentum
TVector3 *v_lbar = new TVector3; // 3-momentum
TLorentzVector *lv_lbar = new TLorentzVector; // 4-momentum
// TLorentzVector lv_pi;
Float_t RadTheta , RadPhi;
////////////////////////////////////////////////////////////////////////////////
// Generate random angles and corresponding physical poperty by the loop
////////////////////////////////////////////////////////////////////////////////
for (Int_t i=0; i<nrEvents; i++) {
// // Hyperon side of LamRestFrame
// proton in LamRestFrame below ///////////////////////////////
// (checked in April 2022)
protonPhi = r3->Uniform(0,360); // Phi in degree
protonCosTheta = r3->Uniform(-1,1);
protonTheta = TMath::RadToDeg()*TMath::ACos(protonCosTheta); // Theta in degree
RadTheta = TMath::DegToRad()*protonTheta; // Theta in radian
RadPhi = TMath::DegToRad()*protonPhi; // Phi in radian
v_p -> TVector3::SetMagThetaPhi(p_p,RadTheta,RadPhi); // set momentum component by mag,theta,phi
lv_p -> TLorentzVector::SetPxPyPzE(v_p->Px(),v_p->Py(),v_p->Pz(),E_p);
// lv_p.SetPxPyPzE(v_p->Px(),v_p->Py(),v_p->Pz(),E_p);
// m_proton = lv_p.M();
// m_protontest = m_p;
m_proton = lv_p -> TLorentzVector::M();
E_proton = lv_p -> TLorentzVector::E();
// p_proton = p_p;
p_proton = lv_p -> TLorentzVector::P();
px_proton = lv_p -> TLorentzVector::Px();
py_proton = lv_p -> TLorentzVector::Py();
pz_proton = lv_p -> TLorentzVector::Pz();
pt_proton = sqrt(pow(px_proton,2)+pow(py_proton,2));
// piminus in LamRestFRame below //////////////////////////////////
// (checked in April 2022)
if (protonPhi <= 180) {
piminusPhi = protonPhi + 180; // Phi in degree
}
else {
piminusPhi = protonPhi - 180; // Phi in degree
}
piminusTheta = 180 - protonTheta; // Theta in degree
RadTheta = TMath::DegToRad()*piminusTheta; // Theta in radian
RadPhi = TMath::DegToRad()*piminusPhi; // Phi in radian
piminusCosTheta = TMath::Cos(RadTheta); // Cos(Theta)
v_pi -> TVector3::SetMagThetaPhi(p_pi,RadTheta,RadPhi); // set momentum component by mag,theta,phi
lv_pi -> TLorentzVector::SetPxPyPzE(v_pi->Px(),v_pi->Py(),v_pi->Pz(),E_pi);
// lv_pi.SetPxPyPzE(v_p->Px(),v_p->Py(),v_p->Pz(),E_pi);
// m_piminustest = m_pi;
m_piminus = lv_pi -> TLorentzVector::M();
// Why it cannot show properly in Tree ?????? When I use double data type...
// But it works when using float data type.
// cout << "check Piminus m:" << m_piminus << endl;
E_piminus = lv_pi -> TLorentzVector::E();
// p_piminus = p_pi;
p_piminus = lv_pi -> TLorentzVector::P();
px_piminus = lv_pi -> TLorentzVector::Px();
py_piminus = lv_pi -> TLorentzVector::Py();
pz_piminus = lv_pi -> TLorentzVector::Pz();
pt_piminus = sqrt(pow(px_piminus,2)+pow(py_piminus,2));
/////////////////////////////////////////
// // Anti-hyperon side of LamRestFrame
// antiproton in LamRestFrame below ///////////////////////////////
// (checked in April 2022)
protonbarPhi = r3->Uniform(0,360); // Phi in degree
protonbarCosTheta = r3->Uniform(-1,1);
protonbarTheta = TMath::RadToDeg()*TMath::ACos(protonbarCosTheta); // Theta in degree
RadTheta = TMath::DegToRad()*protonTheta; // Theta in radian
RadPhi = TMath::DegToRad()*protonPhi; // Phi in radian
v_pbar -> TVector3::SetMagThetaPhi(p_p,RadTheta,RadPhi); // set momentum component by mag,theta,phi
lv_pbar -> TLorentzVector::SetPxPyPzE(v_pbar->Px(),v_pbar->Py(),v_pbar->Pz(),E_p);
m_protonbar = lv_pbar -> TLorentzVector::M();
E_protonbar = lv_pbar -> TLorentzVector::E();
p_protonbar = lv_pbar -> TLorentzVector::P();
px_protonbar = lv_pbar -> TLorentzVector::Px();
py_protonbar = lv_pbar -> TLorentzVector::Py();
pz_protonbar = lv_pbar -> TLorentzVector::Pz();
pt_protonbar = sqrt(pow(px_protonbar,2)+pow(py_protonbar,2));
// piplus in LamRestFRame below //////////////////////////////////
// (checked in April 2022)
if (protonbarPhi <= 180) {
piplusPhi = protonbarPhi + 180; // Phi in degree
}
else {
piplusPhi = protonbarPhi - 180; // Phi in degree
}
piplusTheta = 180 - protonbarTheta; // Theta in degree
RadTheta = TMath::DegToRad()*piplusTheta; // Theta in radian
RadPhi = TMath::DegToRad()*piplusPhi; // Phi in radian
piplusCosTheta = TMath::Cos(RadTheta); // Cos(Theta)
v_piplus -> TVector3::SetMagThetaPhi(p_pi,RadTheta,RadPhi); // set momentum component by mag,theta,phi
lv_piplus -> TLorentzVector::SetPxPyPzE(v_piplus->Px(),v_piplus->Py(),v_piplus->Pz(),E_pi);
// lv_pi.SetPxPyPzE(v_p->Px(),v_p->Py(),v_p->Pz(),E_pi);
// m_piminustest = m_pi;
m_piplus = lv_piplus -> TLorentzVector::M();
// Why it cannot show properly in Tree ?????? When I use double data type...
// But it works when using float data type.
// cout << "check Piminus m:" << m_piminus << endl;
E_piplus = lv_piplus -> TLorentzVector::E();
p_piplus = lv_piplus -> TLorentzVector::P();
px_piplus = lv_piplus -> TLorentzVector::Px();
py_piplus = lv_piplus -> TLorentzVector::Py();
pz_piplus = lv_piplus -> TLorentzVector::Pz();
pt_piplus = sqrt(pow(px_piplus,2)+pow(py_piplus,2));
//////////////////////////////////////////
/////////////////////////////////////////
// pbarp CM frame
// Float_t pbarPhiCM, pPhiCM, pbarCosThetaCM, pCosThetaCM,pbarThetaCM, pThetaCM;
// (checked in April 2022)
pPhiCM = r3->Uniform(0,360);
pCosThetaCM = r3->Uniform(-1,1);
pThetaCM = TMath::RadToDeg()*TMath::ACos(pCosThetaCM);
if (pPhiCM <= 180) {
pbarPhiCM = pPhiCM + 180; // Phi in degree
}
else {
pbarPhiCM = pPhiCM - 180; // Phi in degree
}
pbarThetaCM = 180 - pThetaCM;
pbarCosThetaCM = TMath::Cos(TMath::DegToRad()*pbarThetaCM);
/////////////////////////////////////////
// // Hyperon side of pbarp CMframe
// Lambda in CMframe below //////////////////////////////////
// lambdaPhiCM = r3->Uniform(0,360); // Phi in degree
lambdaPhiCM = pPhiCM;
// lambdaCosThetaCM = r3->Uniform(-1,1);
// lambdaThetaCM = TMath::RadToDeg()*TMath::ACos(lambdaCosThetaCM); // Theta in degree
lambdaThetaCM = 0;
lambdaCosThetaCM = TMath::Cos(lambdaThetaCM);
RadTheta = TMath::DegToRad()*lambdaThetaCM; // Theta in radian
RadPhi = TMath::DegToRad()*lambdaPhiCM; // Phi in radian
v_l -> TVector3::SetMagThetaPhi(p_lam,RadTheta,RadPhi); // set momentum component by mag,theta,phi
lv_l -> TLorentzVector::SetPxPyPzE(v_l->Px(),v_l->Py(),v_l->Pz(),E_lam);
// m_lambda = lv_p.M();
// m_lambdatest = m_p;
// m_lambdaCM = m_lam;
m_lambdaCM = lv_l -> TLorentzVector::M();
E_lambdaCM = lv_l -> TLorentzVector::E();
// E_lambdaCM = E_lam;
p_lambdaCM = lv_l->P();
px_lambdaCM = lv_l -> TLorentzVector::Px();
py_lambdaCM = lv_l -> TLorentzVector::Py();
pz_lambdaCM = lv_l -> TLorentzVector::Pz();
pt_lambdaCM = sqrt(pow(px_lambdaCM,2)+pow(py_lambdaCM,2));
////////////////////////////////////////////////////////////////////i///
// Lorentz Boost below
//(same plane (or phi) ideal situation, only theta considered, e.g. x-z plane but not necessary)
// 2 May 2022 update: 3D spherical coordinate r theta phi
// Float_t p_protonX = p_p*TMath::Cos(TMath::DegToRad()*protonPhi)*TMath::Sin(TMath::DegToRad()*protonTheta);
// Float_t p_protonY = p_p*TMath::Sin(TMath::DegToRad()*protonPhi)*TMath::Sin(TMath::DegToRad()*protonTheta);
// Float_t p_protonZ = p_p*TMath::Cos(TMath::DegToRad()*protonTheta);
// MP: Re-calculating the momentum components that have already been generated is error prone
// MP: Let's reuse the previous ones
Float_t p_protonX = px_proton;
Float_t p_protonY = py_proton;
Float_t p_protonZ = pz_proton;
Float_t p_piminusX = -p_protonX;
Float_t p_piminusY = -p_protonY;
Float_t p_piminusZ = -p_protonZ;
// Lorentz Boost relation
Float_t pb_protonX, pb_protonZ, pb_piminusX, pb_piminusZ;
pb_protonX = p_protonX;
pb_piminusX = p_piminusX;
pb_protonZ = gamma_lam * (p_protonZ + v_lam * E_p);
pb_piminusZ = gamma_lam * (p_piminusZ + v_lam * E_pi);
// MP: One could have used the boost vector from ROOT here,
// MP: but it should not make a difference
// MP: Nevertheless, let's try out below
TLorentzVector tmp_pCM, tmp_pimCM;
tmp_pCM = *lv_p;
tmp_pimCM = *lv_pi;
tmp_pCM.Boost(-lv_l->BoostVector());
tmp_pimCM.Boost(-lv_l->BoostVector());
// Proton in CMframe below //////////////////////////////////
// Float_t proTheta = TMath::ATan(pb_protonX / pb_protonZ);
// protonThetaCM = TMath::RadToDeg()*TMath::ATan(pb_protonX / pb_protonZ);
// protonPhiCM = protonPhi;
// protonCosThetaCM = TMath::Cos(proTheta);
//protonThetaCM = tmp_pCM.Theta() ;
protonThetaCM = tmp_pCM.Theta() * TMath::RadToDeg();
protonPhiCM = tmp_pCM.Phi() * TMath::RadToDeg();
protonCosThetaCM = tmp_pCM.CosTheta();
// MP: Use the updated CM vectors to calculate angles
RadTheta = TMath::DegToRad()*protonThetaCM; // Theta in radian
RadPhi = TMath::DegToRad()*protonPhiCM; // Phi in radian
// 2 May 2022 update
// keep the 4-vector conservation
// lorentz vector (lv) and p_p (3-vector magnitute)
// lv_p^2 = E^2 - p_p^2 = m^2
// since p_p the magnitute changes after boost, E_p also varies.
// Float_t p_pCM = sqrt(pow(pb_protonX,2)+pow(p_protonY,2)+pow(pb_protonZ,2));
Float_t p_pCM = tmp_pCM.P(); // MP: updated CM momentum
// MP: Why are v_p and lv_p overwritten here?
// MP: The resulting values for px, py are wrong (they should not change)
// MP: Something must be going wrong here
v_p -> TVector3::SetMagThetaPhi(p_pCM,RadTheta,RadPhi); // set momentum component by mag,theta,phi
// lv_p -> TLorentzVector::SetPxPyPzE(v_p->Px(),v_p->Py(),pb_protonZ,E_p);
Float_t E_pCM = sqrt(pow(m_p,2)+pow(p_pCM,2));
lv_p -> TLorentzVector::SetPxPyPzE(v_p->Px(),v_p->Py(),v_p->Pz(),E_pCM);
// m_protonCM = lv_p -> TLorentzVector::M();
// E_protonCM = lv_p -> TLorentzVector::E();
// p_protonCM = lv_p -> TLorentzVector::P();
// px_protonCM = lv_p -> TLorentzVector::Px();
// py_protonCM = lv_p -> TLorentzVector::Py();
// pz_protonCM = lv_p -> TLorentzVector::Pz();
// pt_protonCM = sqrt(pow(px_protonCM,2)+pow(py_protonCM,2));
// MP: Let's take the values from the new tmp_pCM
m_protonCM = tmp_pCM.M();
E_protonCM = tmp_pCM.E();
p_protonCM = tmp_pCM.P();
px_protonCM = tmp_pCM.Px();
py_protonCM = tmp_pCM.Py();
pz_protonCM = tmp_pCM.Pz();
pt_protonCM = tmp_pCM.Pt();
// Piminus in CMframe below //////////////////////////////////
Float_t pimTheta = TMath::ATan(pb_piminusX / pb_piminusZ);
piminusThetaCM = TMath::RadToDeg()*TMath::ATan(pb_piminusX / pb_piminusZ);
// 2 May 2022 update
// minus value of theta degree can also be possible
// if (piminusThetaCM < 0){
// piminusThetaCM = -piminusThetaCM;
// }
// piminusPhiCM = piminusPhi;
// piminusCosThetaCM = TMath::Cos(pimTheta);
// RadTheta = TMath::DegToRad()*piminusThetaCM; // Theta in radian
// RadPhi = TMath::DegToRad()*piminusPhi; // Phi in radian
// revised June
piminusThetaCM = tmp_pimCM.Theta() * TMath::RadToDeg();
piminusPhiCM = tmp_pimCM.Phi() * TMath::RadToDeg();
piminusCosThetaCM = tmp_pimCM.CosTheta();
// 2 May 2022 update
// keep the 4-vector conservation
// Float_t p_piCM = sqrt(pow(pb_piminusX,2)+pow(p_piminusY,2)+pow(pb_piminusZ,2));
// v_pi -> TVector3::SetMagThetaPhi(p_piCM,RadTheta,RadPhi); // set momentum component by mag,theta,phi
// Float_t E_piCM = sqrt(pow(m_pi,2)+pow(p_piCM,2));
// lv_pi -> TLorentzVector::SetPxPyPzE(v_pi->Px(),v_pi->Py(),v_pi->Pz(),E_piCM);
//revised June
RadTheta = TMath::DegToRad()*piminusThetaCM; // Theta in radian
RadPhi = TMath::DegToRad()*piminusPhiCM; // Phi in radian
Float_t p_pimCM = tmp_pimCM.P();
v_pi -> TVector3::SetMagThetaPhi(p_pimCM,RadTheta,RadPhi); // set momentum component by mag,theta,phi
Float_t E_pimCM = sqrt(pow(m_pi,2)+pow(p_pimCM,2));
lv_pi -> TLorentzVector::SetPxPyPzE(v_pi->Px(),v_pi->Py(),v_pi->Pz(),E_pimCM);
m_piminusCM = lv_pi -> TLorentzVector::M();
E_piminusCM = lv_pi -> TLorentzVector::E();
p_piminusCM = lv_pi -> TLorentzVector::P();
px_piminusCM = lv_pi -> TLorentzVector::Px();
py_piminusCM = lv_pi -> TLorentzVector::Py();
pz_piminusCM = lv_pi -> TLorentzVector::Pz();
pt_piminusCM = sqrt(pow(px_piminusCM,2)+pow(py_piminusCM,2));
/////////////////////////////////////////
//////////////////////////////
// // Anti-hyperon side of pbarp CMframe
// Lambdabar in CMframe below //////////////////////////////////
if (lambdaPhiCM <= 180) {
lambdabarPhiCM = lambdaPhiCM + 180; // Phi in degree
}
else {
lambdabarPhiCM = lambdaPhiCM - 180; // Phi in degree
}
// lambdabarThetaCM = 180 - lambdaThetaCM; // Theta in degree
lambdabarThetaCM = 180;
RadTheta = TMath::DegToRad()*lambdabarThetaCM; // Theta in radian
RadPhi = TMath::DegToRad()*lambdabarPhiCM; // Phi in radian
lambdabarCosThetaCM = TMath::Cos(RadTheta);
v_lbar -> TVector3::SetMagThetaPhi(p_lam,RadTheta,RadPhi); // set momentum component by mag,theta,phi
lv_lbar -> TLorentzVector::SetPxPyPzE(v_lbar->Px(),v_lbar->Py(),v_lbar->Pz(),E_lam);
// m_lambdabarCM = m_lam;
m_lambdabarCM = lv_lbar -> TLorentzVector::M();
E_lambdabarCM = lv_lbar -> TLorentzVector::E();
// E_lambdabarCM = E_lam;
p_lambdabarCM = lv_lbar->P();
px_lambdabarCM = lv_lbar -> TLorentzVector::Px();
py_lambdabarCM = lv_lbar -> TLorentzVector::Py();
pz_lambdabarCM = lv_lbar -> TLorentzVector::Pz();
pt_lambdabarCM = sqrt(pow(px_lambdabarCM,2)+pow(py_lambdabarCM,2));
////////////////////////////////////////////////////////////////////i///
// 2 May 2022 update
// Lorentz Boost below (same phi's plane ideal situation only theta changed considering)
// Float_t p_protonbarX = p_p*TMath::Cos(TMath::DegToRad()*protonbarPhi)*TMath::Sin(TMath::DegToRad()*protonbarTheta);
// Float_t p_protonbarY = p_p*TMath::Sin(TMath::DegToRad()*protonbarPhi)*TMath::Sin(TMath::DegToRad()*protonbarTheta);
// Float_t p_protonbarZ = p_p*TMath::Cos(TMath::DegToRad()*protonbarTheta);
//revised June
Float_t p_protonbarX = px_protonbar;
Float_t p_protonbarY = py_protonbar;
Float_t p_protonbarZ = pz_protonbar;
Float_t p_piplusX = -p_protonbarX;
Float_t p_piplusY = -p_protonbarY;
Float_t p_piplusZ = -p_protonbarZ;
// Lorentz Boost relation
Float_t pb_protonbarX, pb_protonbarZ, pb_piplusX, pb_piplusZ;
pb_protonbarX = p_protonbarX;
pb_piplusX = p_piplusX;
pb_protonbarZ = gamma_lam * (p_protonbarZ + v_lam * E_p);
pb_piplusZ = gamma_lam * (p_piplusZ + v_lam * E_pi);
//revised June
TLorentzVector tmp_pbarCM, tmp_pipCM;
tmp_pbarCM = *lv_pbar;
tmp_pipCM = *lv_piplus;
tmp_pbarCM.Boost(-lv_lbar->BoostVector());
tmp_pipCM.Boost(-lv_lbar->BoostVector());
// Protonbar in CMframe below //////////////////////////////////
Float_t probarTheta = TMath::ATan(pb_protonbarX / pb_protonbarZ);
// 26 Feb updated
// the angles represent the other direction compare to hyperon side
// protonbarThetaCM = 180 - TMath::RadToDeg()*TMath::ATan(pb_protonbarX / pb_protonbarZ);
// protonbarPhiCM = protonbarPhi;
// protonbarCosThetaCM = TMath::Cos(protonbarThetaCM*TMath::DegToRad());
//revised June
protonbarThetaCM = tmp_pbarCM.Theta() * TMath::RadToDeg();
protonbarPhiCM = tmp_pbarCM.Phi() * TMath::RadToDeg();
protonbarCosThetaCM = tmp_pbarCM.CosTheta();
RadTheta = TMath::DegToRad()*protonbarThetaCM; // Theta in radian
RadPhi = TMath::DegToRad()*protonbarPhiCM; // Phi in radian
Float_t p_pbarCM = tmp_pbarCM.P();
Float_t E_pbarCM = sqrt(pow(m_p,2)+pow(p_pbarCM,2));
// 2 May 2022 update
// Float_t p_pCM = sqrt(pow(pb_protonX,2)+pow(p_protonY,2)+pow(pb_protonZ,2));
v_pbar -> TVector3::SetMagThetaPhi(p_pbarCM,RadTheta,RadPhi); // set momentum component by mag,theta,phi
// Float_t E_pCM = sqrt(pow(m_p,2)+pow(p_pCM,2));
lv_pbar -> TLorentzVector::SetPxPyPzE(v_p->Px(),v_p->Py(),v_p->Pz(),E_pbarCM);
// m_protonbarCM = lv_p -> TLorentzVector::M();
// E_protonbarCM = lv_p -> TLorentzVector::E();
// p_protonbarCM = lv_p -> TLorentzVector::P();
// px_protonbarCM = lv_p -> TLorentzVector::Px();
// py_protonbarCM = lv_p -> TLorentzVector::Py();
// pz_protonbarCM = lv_p -> TLorentzVector::Pz();
//revised June
m_protonbarCM = tmp_pbarCM.M();
E_protonbarCM = tmp_pbarCM.E();
p_protonbarCM = tmp_pbarCM.P();
px_protonbarCM = tmp_pbarCM.Px();
py_protonbarCM = tmp_pbarCM.Py();
pz_protonbarCM = tmp_pbarCM.Pz();
pt_protonbarCM = tmp_pbarCM.Pt();
pt_protonbarCM = sqrt(pow(px_protonbarCM,2)+pow(py_protonbarCM,2));
// Piplus in CMframe below //////////////////////////////////
Float_t pipTheta = TMath::ATan(pb_piplusX / pb_piplusZ);
piplusThetaCM = TMath::RadToDeg()*TMath::ATan(pb_piplusX / pb_piplusZ);
// 2 May 2022 update
// minus value of theta degree can also be possible
// if (piplusThetaCM < 0){
// piplusThetaCM = -piplusThetaCM;
// }
// 26 Feb updated
// the angles represent the other direction compare to hyperon side
// piplusThetaCM = 180 - piplusThetaCM;
// piplusPhiCM = piplusPhi;
// piplusCosThetaCM = TMath::Cos( piplusThetaCM*TMath::DegToRad());
//
// revised June
piplusThetaCM = tmp_pipCM.Theta() * TMath::RadToDeg();
piplusPhiCM = tmp_pipCM.Phi() * TMath::RadToDeg();
piplusCosThetaCM = tmp_pipCM.CosTheta();
RadTheta = TMath::DegToRad()*piplusThetaCM; // Theta in radian
RadPhi = TMath::DegToRad()*piplusPhiCM; // Phi in radian
// 2 May 2022 update
// Float_t p_piCM = sqrt(pow(pb_piminusX,2)+pow(p_piminusY,2)+pow(pb_piminusZ,2));
// v_piplus -> TVector3::SetMagThetaPhi(p_piCM,RadTheta,RadPhi); // set momentum component by mag,theta,phi
// Float_t E_piCM = sqrt(pow(m_pi,2)+pow(p_piCM,2));
// lv_piplus -> TLorentzVector::SetPxPyPzE(v_piplus->Px(),v_piplus->Py(),v_piplus->Pz(),E_piCM);
// revised June
Float_t p_pipCM = tmp_pipCM.P();
v_piplus -> TVector3::SetMagThetaPhi(p_pipCM,RadTheta,RadPhi); // set momentum component by mag,theta,phi
Float_t E_pipCM = sqrt(pow(m_pi,2)+pow(p_pipCM,2));
lv_piplus -> TLorentzVector::SetPxPyPzE(v_piplus->Px(),v_piplus->Py(),v_piplus->Pz(),E_pipCM);
m_piplusCM = lv_piplus -> TLorentzVector::M();
E_piplusCM = lv_piplus -> TLorentzVector::E();
p_piplusCM = lv_piplus -> TLorentzVector::P();
px_piplusCM = lv_piplus -> TLorentzVector::Px();
py_piplusCM = lv_piplus -> TLorentzVector::Py();
pz_piplusCM = lv_piplus -> TLorentzVector::Pz();
pt_piplusCM = sqrt(pow(px_piplusCM,2)+pow(py_piplusCM,2));
// // //
//////////////////////////////////////////////////////////
// // Rotation !!
// // lambdaCMrot // verify?
// Float_t rotAxisPhi, rotAxisTheta;
// if (pThetaCM < 90){
// rotAxisTheta = TMath::DegToRad()*pThetaCM + TMath::Pi()/2;
// }
// else {
// rotAxisTheta = TMath::DegToRad()*pThetaCM - TMath::Pi()/2;
// }
// rotAxisPhi = lambdaPhiCM;
// TVector3 rotAxis;
// rotAxis.SetMagThetaPhi(p_lam,rotAxisTheta,rotAxisPhi);
// TLorentzRotation lR;
// if (pTheta <= 90) {
// lR.Rotate(-*TMath::DegToRad()*pThetaCM,rotAxis);
// }
// else {
// lR.Rotate(*TMath::DegToRad()*pThetaCM,rotAxis);
// }
// can be reused below
// lR.Rotate(TMath::DegToRad()*pThetaCM,rotAxis); // rot +theta
// TLorentzVector lv_lamRotCM;
// lv_lamRotCM.SetPxPyPzE(px_lambdaCM,py_lambdaCM,pz_lambdaCM,E_lambdaCM);
// lv_lamRotCM = lR * lv_lamRotCM;
// lambdaPhiCMrot = lambdaPhiCM //= r3->Uniform(0,360); // Phi in degree
// // lambdaCosThetaCM = r3->Uniform(-1,1);
// lambdaThetaCMrot = 0 - lambdaThetaCM //= TMath::RadToDeg()*TMath::ACos(lambdaCosThetaCM); // Theta in degree
// RadTheta = TMath::DegToRad()*lambdaThetaCM; // Theta in radian
// RadPhi = TMath::DegToRad()*lambdaPhiCM; // Phi in radian
// v_l -> TVector3::SetMagThetaPhi(p_lam,RadTheta,RadPhi); // set momentum component by mag,theta,phi
// lv_l -> TLorentzVector::SetPxPyPzE(v_l->Px(),v_l->Py(),v_l->Pz(),E_p);
// lambdaPhiCMrot = TMath::RadToDeg()*lv_lamRotCM.Phi();
// lambdaThetaCMrot = TMath::RadToDeg()*lv_lamRotCM.Theta();
// lambdaCosThetaCMrot = TMath::Cos(TMath::DegToRad()*lambdaThetaCMrot);
//**************************************
// 29 Jan 2021 added
// rotation of lambda CM update below
// by finding new pxpypz from new angles
px_lambdaCMrot = p_lam * TMath::Cos(TMath::DegToRad()*lambdaPhiCM) * TMath::Sin(TMath::DegToRad()*lambdaThetaCM+TMath::DegToRad()*pThetaCM);
py_lambdaCMrot = p_lam * TMath::Sin(TMath::DegToRad()*lambdaPhiCM) * TMath::Sin(TMath::DegToRad()*lambdaThetaCM+TMath::DegToRad()*pThetaCM);
pz_lambdaCMrot = p_lam * TMath::Cos(TMath::DegToRad()*lambdaThetaCM+TMath::DegToRad()*pThetaCM);
lv_l -> TLorentzVector::SetPxPyPzE(px_lambdaCMrot,py_lambdaCMrot,pz_lambdaCMrot,E_lam);
lambdaPhiCMrot = lv_l -> TLorentzVector::Phi()*TMath::RadToDeg();
lambdaThetaCMrot = lv_l -> TLorentzVector::Theta()*TMath::RadToDeg();
lambdaCosThetaCMrot = lv_l -> TLorentzVector::CosTheta();
m_lambdaCMrot = lv_l -> TLorentzVector::M();
E_lambdaCMrot = lv_l -> TLorentzVector::E();
p_lambdaCMrot = lv_l->P();
pt_lambdaCMrot = sqrt(pow(px_lambdaCMrot,2)+pow(py_lambdaCMrot,2));
// lv_l -> TLorentzVector::SetPxPyPzE(lv_lamRotCM.Px(),lv_lamRotCM.Py(),lv_lamRotCM.Pz(),lv_lamRotCM.E());
// m_lambdaCMrot = lv_l -> TLorentzVector::M();
// E_lambdaCMrot = lv_l -> TLorentzVector::E();
// // E_lambdaCM = E_lam;
// p_lambdaCMrot = lv_l->P();
// px_lambdaCMrot = lv_l -> TLorentzVector::Px();
// py_lambdaCMrot = lv_l -> TLorentzVector::Py();
// pz_lambdaCMrot = lv_l -> TLorentzVector::Pz();
// pt_lambdaCMrot = sqrt(pow(px_lambdaCMrot,2)+pow(py_lambdaCMrot,2));
//
// // Rotation !!
// // lambdabarCMrot //verify?
// lR.Rotate(-TMath::DegToRad()*pbarThetaCM,rotAxis); // rot -theta
// TLorentzVector lv_lambarRotCM;
// lv_lambarRotCM.SetPxPyPzE(px_lambdabarCM,py_lambdabarCM,pz_lambdabarCM,E_lambdabarCM);
// lv_lambarRotCM = lR * lv_lambarRotCM;
// lambdabarPhiCMrot = TMath::RadToDeg()*lv_lambarRotCM.Phi();
// lambdabarThetaCMrot = TMath::RadToDeg()*lv_lambarRotCM.Theta();
// lambdabarCosThetaCMrot = TMath::Cos(TMath::DegToRad()*lambdabarThetaCMrot);
//**************************************
// 29 Jan 2021 added
// Rotation of lambdabar CM update below
// by finding new pxpypz from new angles
px_lambdabarCMrot = p_lam * TMath::Cos(TMath::DegToRad()*lambdabarPhiCM) * TMath::Sin(TMath::DegToRad()*lambdabarThetaCM-TMath::DegToRad()*pThetaCM);
py_lambdabarCMrot = p_lam * TMath::Sin(TMath::DegToRad()*lambdabarPhiCM) * TMath::Sin(TMath::DegToRad()*lambdabarThetaCM-TMath::DegToRad()*pThetaCM);
pz_lambdabarCMrot = p_lam * TMath::Cos(TMath::DegToRad()*lambdabarThetaCM-TMath::DegToRad()*pThetaCM);
lv_lbar -> TLorentzVector::SetPxPyPzE(px_lambdabarCMrot,py_lambdabarCMrot,pz_lambdabarCMrot,E_lam);
lambdabarPhiCMrot = lv_lbar -> TLorentzVector::Phi()*TMath::RadToDeg();
lambdabarThetaCMrot = lv_lbar -> TLorentzVector::Theta()*TMath::RadToDeg();
lambdabarCosThetaCMrot = lv_lbar -> TLorentzVector::CosTheta();
m_lambdabarCMrot = lv_lbar -> TLorentzVector::M();
E_lambdabarCMrot = lv_lbar -> TLorentzVector::E();
p_lambdabarCMrot = lv_lbar->P();
pt_lambdabarCMrot = sqrt(pow(px_lambdabarCMrot,2)+pow(py_lambdabarCMrot,2));
// lv_l -> TLorentzVector::SetPxPyPzE(lv_lambarRotCM.Px(),lv_lambarRotCM.Py(),lv_lambarRotCM.Pz(),lv_lambarRotCM.E());
// m_lambdabarCMrot = lv_l -> TLorentzVector::M();
// E_lambdabarCMrot = lv_l -> TLorentzVector::E();
// p_lambdabarCMrot = lv_l->P();
// px_lambdabarCMrot = lv_l -> TLorentzVector::Px();
// py_lambdabarCMrot = lv_l -> TLorentzVector::Py();
// pz_lambdabarCMrot = lv_l -> TLorentzVector::Pz();
// pt_lambdabarCMrot = sqrt(pow(px_lambdabarCMrot,2)+pow(py_lambdabarCMrot,2));
/////////////////////////////////////////////////////////////////////////////
// // Rotation !!
// // protonCMrot
// Float_t rotAxisPhiHyperon, rotAxisThetaHyperon;
// rotAxisPhiHyperon = TMath::DegToRad()*protonPhi;
// if (protonThetaCM < 90){
// rotAxisThetaHyperon = TMath::DegToRad()*protonThetaCM + TMath::Pi()/2;
// }
// else {
// rotAxisThetaHyperon = TMath::DegToRad()*protonThetaCM - TMath::Pi()/2;
// }
// TVector3 rotAxisHyperon;
// rotAxisHyperon.SetMagThetaPhi(p_p,rotAxisThetaHyperon,rotAxisPhiHyperon);
// // can be reused below
// TLorentzRotation lR_hyperon;
// lR_hyperon.Rotate(TMath::DegToRad()*protonThetaCM,rotAxisHyperon);