forked from AliceO2Group/O2Physics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHfHelper.h
More file actions
1517 lines (1263 loc) · 48.1 KB
/
Copy pathHfHelper.h
File metadata and controls
1517 lines (1263 loc) · 48.1 KB
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
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file HfHelper.h
/// \brief Class with helper functions for HF analyses
///
/// \author Vít Kučera <vit.kucera@cern.ch>, Inha University
#ifndef PWGHF_CORE_HFHELPER_H_
#define PWGHF_CORE_HFHELPER_H_
#include "PWGHF/Utils/utilsAnalysis.h"
#include "Common/Core/RecoDecay.h"
#include "Common/Core/TrackSelectorPID.h"
#include <CommonConstants/MathConstants.h>
#include <CommonConstants/PhysicsConstants.h>
#include <Math/GenVector/Boost.h>
#include <Math/Vector4D.h> // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h)
#include <Math/Vector4Dfwd.h>
#include <array>
#include <cmath>
#include <vector>
template <typename T>
concept IsB0ToDstarPiChannel = requires(T candidate) {
candidate.prongD0Id();
};
struct HfHelper {
// 2-prong
// D0(bar) → π± K∓
template <typename T>
static auto ctD0(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassD0);
}
template <typename T>
static auto yD0(const T& candidate)
{
return candidate.y(o2::constants::physics::MassD0);
}
template <typename T>
static auto eD0(const T& candidate)
{
return candidate.e(o2::constants::physics::MassD0);
}
template <typename T>
static auto invMassD0ToPiK(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus});
}
template <typename T>
static auto invMassD0barToKPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto cosThetaStarD0(const T& candidate)
{
return candidate.cosThetaStar(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus}, o2::constants::physics::MassD0, 1);
}
template <typename T>
static auto cosThetaStarD0bar(const T& candidate)
{
return candidate.cosThetaStar(std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}, o2::constants::physics::MassD0, 0);
}
// J/ψ
template <typename T>
static auto ctJpsi(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassJPsi);
}
template <typename T>
static auto yJpsi(const T& candidate)
{
return candidate.y(o2::constants::physics::MassJPsi);
}
template <typename T>
static auto eJpsi(const T& candidate)
{
return candidate.e(o2::constants::physics::MassJPsi);
}
// J/ψ → e+ e−
template <typename T>
static auto invMassJpsiToEE(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron});
}
// J/ψ → μ+ μ−
template <typename T>
static auto invMassJpsiToMuMu(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassMuonPlus, o2::constants::physics::MassMuonMinus});
}
// hf_cand_casc
template <typename T>
static auto invMassLcToK0sP(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassK0Short}); // first daughter is bachelor
}
template <typename T>
static auto invMassGammaToEE(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron});
}
template <typename T>
static auto ctV0K0s(const T& candidate)
{
return candidate.ctV0(o2::constants::physics::MassK0Short);
}
template <typename T>
static auto ctV0Lambda(const T& candidate)
{
return candidate.ctV0(o2::constants::physics::MassLambda0);
}
// B± → D0bar(D0) π±
template <typename T>
static auto ctBplus(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassBPlus);
}
template <typename T>
static auto yBplus(const T& candidate)
{
return candidate.y(o2::constants::physics::MassBPlus);
}
template <typename T>
static auto eBplus(const T& candidate)
{
return candidate.e(o2::constants::physics::MassBPlus);
}
template <typename T>
static auto invMassBplusToD0Pi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassD0, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassBplusToJpsiK(const T& candidate, const bool useJpsiPdgMass)
{
auto const pVecMuPos = candidate.pVectorProng0();
auto const pVecMuNeg = candidate.pVectorProng1();
auto const pVecKa = candidate.pVectorProng2();
if (useJpsiPdgMass) {
return RecoDecay::m(std::array{RecoDecay::pVec(pVecMuPos, pVecMuNeg), pVecKa},
std::array{o2::constants::physics::MassJPsi, o2::constants::physics::MassKPlus});
}
// Do not use PDG mass for J/psi
return RecoDecay::m(std::array{pVecMuPos, pVecMuNeg, pVecKa},
std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus});
}
template <typename T>
static auto cosThetaStarBplus(const T& candidate)
{
return candidate.cosThetaStar(std::array{o2::constants::physics::MassD0, o2::constants::physics::MassPiPlus}, o2::constants::physics::MassBPlus, 1);
}
// 3-prong
// D± → π± K∓ π±
template <typename T>
static auto ctDplus(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassDPlus);
}
template <typename T>
static auto yDplus(const T& candidate)
{
return candidate.y(o2::constants::physics::MassDPlus);
}
template <typename T>
static auto eDplus(const T& candidate)
{
return candidate.e(o2::constants::physics::MassDPlus);
}
template <typename T>
static auto invMassDplusToPiKPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassDplusToPiKPi(const T& pVec0, const T& pVec1, const T& pVec2)
{
return RecoDecay::m(std::array{pVec0, pVec1, pVec2},
std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}
// Ds± → K± K∓ π±
template <typename T>
static auto ctDs(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassDS);
}
template <typename T>
static auto yDs(const T& candidate)
{
return candidate.y(o2::constants::physics::MassDS);
}
template <typename T>
static auto eDs(const T& candidate)
{
return candidate.e(o2::constants::physics::MassDS);
}
template <typename T>
static auto invMassDsToKKPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassDsToPiKK(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus});
}
template <typename T>
static auto massKKPairDsToKKPi(const T& candidate)
{
return RecoDecay::m(std::array{candidate.pVectorProng0(), candidate.pVectorProng1()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus});
}
template <typename T>
static auto massKKPairDsToPiKK(const T& candidate)
{
return RecoDecay::m(std::array{candidate.pVectorProng1(), candidate.pVectorProng2()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus});
}
template <typename T>
static auto deltaMassPhiDsToKKPi(const T& candidate)
{
return std::abs(massKKPairDsToKKPi(candidate) - o2::constants::physics::MassPhi);
}
template <typename T>
static auto deltaMassPhiDsToPiKK(const T& candidate)
{
return std::abs(massKKPairDsToPiKK(candidate) - o2::constants::physics::MassPhi);
}
/// Calculate the cosine of the angle between the pion and the opposite sign kaon in the phi rest frame
/// \param candidate Ds candidate from aod::HfCand3Prong table
/// \param option mass hypothesis considered: 0 = KKPi, 1 = PiKK
/// \return cosine of pion-kaon angle in the phi rest frame
template <typename T>
static auto cosPiKPhiRestFrame(const T& candidate, int option)
{
// Ported from AliAODRecoDecayHF3Prong::CosPiKPhiRFrame
std::array<float, 3> momPi{};
std::array<float, 3> momK1{};
std::array<float, 3> momK2{};
if (option == 0) { // KKPi
momPi = candidate.pVectorProng2();
momK1 = candidate.pVectorProng1();
momK2 = candidate.pVectorProng0();
} else { // PiKK
momPi = candidate.pVectorProng0();
momK1 = candidate.pVectorProng1();
momK2 = candidate.pVectorProng2();
}
ROOT::Math::PxPyPzMVector const vecPi(momPi[0], momPi[1], momPi[2], o2::constants::physics::MassPiPlus);
ROOT::Math::PxPyPzMVector const vecK1(momK1[0], momK1[1], momK1[2], o2::constants::physics::MassKPlus);
ROOT::Math::PxPyPzMVector const vecK2(momK2[0], momK2[1], momK2[2], o2::constants::physics::MassKPlus);
ROOT::Math::PxPyPzMVector const vecPhi = vecK1 + vecK2;
ROOT::Math::Boost const boostToPhiRestFrame(vecPhi.BoostToCM());
auto momPiPhiRestFrame = boostToPhiRestFrame(vecPi).Vect();
auto momK1PhiRestFrame = boostToPhiRestFrame(vecK1).Vect();
return momPiPhiRestFrame.Dot(momK1PhiRestFrame) / std::sqrt(momPiPhiRestFrame.Mag2() * momK1PhiRestFrame.Mag2());
}
template <typename T>
static auto cos3PiKDsToKKPi(const T& candidate)
{
auto cosPiK = cosPiKPhiRestFrame(candidate, 0);
return cosPiK * cosPiK * cosPiK;
}
template <typename T>
static auto absCos3PiKDsToKKPi(const T& candidate)
{
return std::abs(cos3PiKDsToKKPi(candidate));
}
template <typename T>
static auto cos3PiKDsToPiKK(const T& candidate)
{
auto cosPiK = cosPiKPhiRestFrame(candidate, 1);
return cosPiK * cosPiK * cosPiK;
}
template <typename T>
static auto absCos3PiKDsToPiKK(const T& candidate)
{
return std::abs(cos3PiKDsToPiKK(candidate));
}
// Λc± → p± K∓ π±
template <typename T>
static auto ctLc(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassLambdaCPlus);
}
template <typename T>
static auto yLc(const T& candidate)
{
return candidate.y(o2::constants::physics::MassLambdaCPlus);
}
template <typename T>
static auto eLc(const T& candidate)
{
return candidate.e(o2::constants::physics::MassLambdaCPlus);
}
template <typename T>
static auto invMassLcToPKPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassLcToPiKP(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassProton});
}
template <typename T>
static auto invMassKPiPairLcToPKPi(const T& candidate)
{
return RecoDecay::m(std::array{candidate.pVectorProng1(), candidate.pVectorProng2()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassKPiPairLcToPiKP(const T& candidate)
{
return RecoDecay::m(std::array{candidate.pVectorProng1(), candidate.pVectorProng0()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassPKPairLcToPKPi(const T& candidate)
{
return RecoDecay::m(std::array{candidate.pVectorProng0(), candidate.pVectorProng1()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus});
}
template <typename T>
static auto invMassPKPairLcToPiKP(const T& candidate)
{
return RecoDecay::m(std::array{candidate.pVectorProng2(), candidate.pVectorProng1()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus});
}
template <typename T>
static auto invMassPPiPairLcToPKPi(const T& candidate)
{
return RecoDecay::m(std::array{candidate.pVectorProng0(), candidate.pVectorProng2()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassPPiPairLcToPiKP(const T& candidate)
{
return RecoDecay::m(std::array{candidate.pVectorProng2(), candidate.pVectorProng0()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus});
}
// Cd± → De± K∓ π±
template <typename T>
static auto invMassCdToDeKPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassDeuteron, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassCdToPiKDe(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassDeuteron});
}
// Ξc± → p± K∓ π±
template <typename T>
static auto ctXic(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassXiCPlus);
}
template <typename T>
static auto yXic(const T& candidate)
{
return candidate.y(o2::constants::physics::MassXiCPlus);
}
template <typename T>
static auto eXic(const T& candidate)
{
return candidate.e(o2::constants::physics::MassXiCPlus);
}
template <typename T>
static auto invMassXicToPKPi(const T& candidate)
{
return invMassLcToPKPi(candidate);
}
template <typename T>
static auto invMassXicToPiKP(const T& candidate)
{
return invMassLcToPiKP(candidate);
}
// hf_cand_casc_lf_2prong
template <typename T>
static auto invMassXiczeroToXiPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassXiMinus, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassOmegaczeroToOmegaPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassOmegaMinus, o2::constants::physics::MassPiPlus});
}
// hf_cand_casc_lf_3prong
template <typename T>
static auto invMassXicplusToXiPiPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassXiMinus, o2::constants::physics::MassPiPlus, o2::constants::physics::MassPiPlus});
}
// hf_cand_x
// X → Jpsi π+ π-
template <typename T>
static auto ctX(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassX3872);
}
template <typename T>
static auto yX(const T& candidate)
{
return candidate.y(o2::constants::physics::MassX3872);
}
template <typename T>
static auto eX(const T& candidate)
{
return candidate.e(o2::constants::physics::MassX3872);
}
template <typename T>
static auto invMassXToJpsiPiPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassJPsi, o2::constants::physics::MassPiPlus, o2::constants::physics::MassPiPlus});
}
/// Difference between the X mass and the sum of the J/psi and di-pion masses
template <typename T>
static auto qX(const T& candidate)
{
auto piVec1 = std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()};
auto piVec2 = std::array{candidate.pxProng2(), candidate.pyProng2(), candidate.pzProng2()};
auto arrayMomenta = std::array{piVec1, piVec2};
double massPiPi = RecoDecay::m(arrayMomenta, std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassPiPlus});
double massJpsiPiPi = invMassXToJpsiPiPi(candidate);
return std::abs(massJpsiPiPi - o2::constants::physics::MassJPsi - massPiPi);
}
/// Angular difference between the J/psi and the pion
template <typename T>
static auto dRX(const T& candidate, int numPi)
{
double etaJpsi = RecoDecay::eta(std::array{candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()});
double phiJpsi = RecoDecay::phi(candidate.pxProng0(), candidate.pyProng0());
double etaPi{}, phiPi{};
if (numPi <= 1) {
etaPi = RecoDecay::eta(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()});
phiPi = RecoDecay::phi(candidate.pxProng1(), candidate.pyProng1());
} else {
etaPi = RecoDecay::eta(std::array{candidate.pxProng2(), candidate.pyProng2(), candidate.pzProng2()});
phiPi = RecoDecay::phi(candidate.pxProng2(), candidate.pyProng2());
}
double const deltaEta = etaJpsi - etaPi;
double const deltaPhi = RecoDecay::constrainAngle(phiJpsi - phiPi, -o2::constants::math::PI);
return RecoDecay::sqrtSumOfSquares(deltaEta, deltaPhi);
}
/// Difference in pT between the two pions
template <typename T>
static auto balancePtPionsX(const T& candidate)
{
double ptPi1 = RecoDecay::pt(candidate.pxProng1(), candidate.pyProng1());
double ptPi2 = RecoDecay::pt(candidate.pxProng2(), candidate.pyProng2());
return std::abs(ptPi1 - ptPi2) / (ptPi1 + ptPi2);
}
// Ξcc±± → p± K∓ π± π±
template <typename T>
static auto ctXicc(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassXiCCPlusPlus);
}
template <typename T>
static auto yXicc(const T& candidate)
{
return candidate.y(o2::constants::physics::MassXiCCPlusPlus);
}
template <typename T>
static auto eXicc(const T& candidate)
{
return candidate.e(o2::constants::physics::MassXiCCPlusPlus);
}
template <typename T>
static auto invMassXiccToXicPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassXiCPlus, o2::constants::physics::MassPiPlus});
}
// chic → Jpsi gamma
template <typename T>
static auto ctChic(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassChiC1);
}
template <typename T>
static auto yChic(const T& candidate)
{
return candidate.y(o2::constants::physics::MassChiC1);
}
template <typename T>
static auto eChic(const T& candidate)
{
return candidate.e(o2::constants::physics::MassChiC1);
}
template <typename T>
static auto invMassChicToJpsiGamma(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassJPsi, 0.});
}
// Λb → Λc+ π- → p K- π+ π-
template <typename T>
static auto ctLb(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassLambdaB0);
}
template <typename T>
static auto yLb(const T& candidate)
{
return candidate.y(o2::constants::physics::MassLambdaB0);
}
template <typename T>
static auto eLb(const T& candidate)
{
return candidate.e(o2::constants::physics::MassLambdaB0);
}
template <typename T>
static auto invMassLbToLcPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassLambdaCPlus, o2::constants::physics::MassPiPlus});
}
// B0(B0bar) → D∓ π±
template <typename T>
static auto ctB0(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassB0);
}
template <typename T>
static auto yB0(const T& candidate)
{
return candidate.y(o2::constants::physics::MassB0);
}
template <typename T>
static auto eB0(const T& candidate)
{
return candidate.e(o2::constants::physics::MassB0);
}
template <typename T>
static auto invMassB0ToDPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassDMinus, o2::constants::physics::MassPiPlus});
}
template <IsB0ToDstarPiChannel T>
static auto invMassB0ToDPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassD0, o2::constants::physics::MassPiPlus, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassB0ToJpsiK0Star(const T& candidate, const bool useJpsiPdgMass, const bool useK0StarPdgMass, bool k0StarToKPi = true)
{
auto const pVecMuPos = candidate.pVectorProng0();
auto const pVecMuNeg = candidate.pVectorProng1();
auto const pVecLfTrack0 = candidate.pVectorProng2();
auto const pVecLfTrack1 = candidate.pVectorProng3();
if (useJpsiPdgMass && useK0StarPdgMass) {
return RecoDecay::m(std::array{RecoDecay::pVec(pVecMuPos, pVecMuNeg), RecoDecay::pVec(pVecLfTrack0, pVecLfTrack1)},
std::array{o2::constants::physics::MassJPsi, o2::constants::physics::MassK0Star892});
}
if (useJpsiPdgMass && !useK0StarPdgMass) {
if (k0StarToKPi) {
return RecoDecay::m(std::array{RecoDecay::pVec(pVecMuPos, pVecMuNeg), pVecLfTrack0, pVecLfTrack1},
std::array{o2::constants::physics::MassJPsi, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}
return RecoDecay::m(std::array{RecoDecay::pVec(pVecMuPos, pVecMuNeg), pVecLfTrack0, pVecLfTrack1},
std::array{o2::constants::physics::MassJPsi, o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus});
}
if (!useJpsiPdgMass && useK0StarPdgMass) {
return RecoDecay::m(std::array{pVecMuPos, pVecMuNeg, RecoDecay::pVec(pVecLfTrack0, pVecLfTrack1)},
std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassK0Star892});
}
// Do not use PDG mass for either J/psi or K*0
if (k0StarToKPi) {
return RecoDecay::m(std::array{pVecMuPos, pVecMuNeg, pVecLfTrack0, pVecLfTrack1},
std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}
return RecoDecay::m(std::array{pVecMuPos, pVecMuNeg, pVecLfTrack0, pVecLfTrack1},
std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus});
}
template <typename T>
static auto cosThetaStarB0(const T& candidate)
{
return candidate.cosThetaStar(std::array{o2::constants::physics::MassDMinus, o2::constants::physics::MassPiPlus}, o2::constants::physics::MassB0, 1);
}
// Bs(bar) → Ds∓ π±
template <typename T>
static auto ctBs(const T& candidate)
{
return candidate.ct(o2::constants::physics::MassBS);
}
template <typename T>
static auto yBs(const T& candidate)
{
return candidate.y(o2::constants::physics::MassBS);
}
template <typename T>
static auto eBs(const T& candidate)
{
return candidate.e(o2::constants::physics::MassBS);
}
template <typename T>
static auto invMassBsToDsPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassDSBar, o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto invMassBsToJpsiPhi(const T& candidate, const bool useJpsiPdgMass, const bool usePhiPdgMass)
{
auto const pVecMuPos = candidate.pVectorProng0();
auto const pVecMuNeg = candidate.pVectorProng1();
auto const pVecKa0 = candidate.pVectorProng2();
auto const pVecKa1 = candidate.pVectorProng3();
if (useJpsiPdgMass && usePhiPdgMass) {
return RecoDecay::m(std::array{RecoDecay::pVec(pVecMuPos, pVecMuNeg), RecoDecay::pVec(pVecKa0, pVecKa1)},
std::array{o2::constants::physics::MassJPsi, o2::constants::physics::MassPhi});
}
if (useJpsiPdgMass && !usePhiPdgMass) {
return RecoDecay::m(std::array{RecoDecay::pVec(pVecMuPos, pVecMuNeg), pVecKa0, pVecKa1},
std::array{o2::constants::physics::MassJPsi, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus});
}
if (!useJpsiPdgMass && usePhiPdgMass) {
return RecoDecay::m(std::array{pVecMuPos, pVecMuNeg, RecoDecay::pVec(pVecKa0, pVecKa1)},
std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassPhi});
}
// Do not use PDG mass for either J/psi or phi
return RecoDecay::m(std::array{pVecMuPos, pVecMuNeg, pVecKa0, pVecKa1},
std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus});
}
template <typename T>
static auto cosThetaStarBs(const T& candidate)
{
return candidate.cosThetaStar(std::array{o2::constants::physics::MassDSBar, o2::constants::physics::MassPiPlus}, o2::constants::physics::MassBS, 1);
}
/// Σc0,++ → Λc+(→pK-π+) π-,+
/// @brief Sc inv. mass using reco mass for Lc in pKpi and PDG mass for pion
template <typename T, typename U>
static auto invMassScRecoLcToPKPi(const T& candidateSc, const U& candidateLc)
{
return candidateSc.m(std::array{static_cast<double>(invMassLcToPKPi(candidateLc)), o2::constants::physics::MassPiPlus});
}
/// @brief Sc inv. mass using reco mass for Lc in piKp and PDG mass for pion
template <typename T, typename U>
static auto invMassScRecoLcToPiKP(const T& candidateSc, const U& candidateLc)
{
return candidateSc.m(std::array{static_cast<double>(invMassLcToPiKP(candidateLc)), o2::constants::physics::MassPiPlus});
}
template <typename T>
static auto ySc0(const T& candidate)
{
return candidate.y(o2::constants::physics::MassSigmaC0);
}
template <typename T>
static auto yScPlusPlus(const T& candidate)
{
return candidate.y(o2::constants::physics::MassSigmaCPlusPlus);
}
/// Σc0,++ → Λc+(→K0sP) π-,+
/// @brief Sc inv. mass using reco mass for Lc in K0sP and PDG mass for pion
template <typename T, typename U>
static auto invMassScRecoLcToK0sP(const T& candidateSc, const U& candidateLc)
{
return candidateSc.m(std::array{static_cast<double>(invMassLcToK0sP(candidateLc)), o2::constants::physics::MassPiMinus});
}
/// Apply topological cuts as defined in SelectorCuts.h
/// \param candB0 B0 candidate
/// \param cuts B0 candidate selection per pT bin"
/// \param binsPt pT bin limits
/// \return true if candidate passes all selections
template <typename T1, typename T2, typename T3>
static bool selectionB0ToDPiTopol(const T1& candB0, const T2& cuts, const T3& binsPt)
{
auto ptCandB0 = candB0.pt();
auto ptD = RecoDecay::pt(candB0.pxProng0(), candB0.pyProng0());
auto ptPi = RecoDecay::pt(candB0.pxProng1(), candB0.pyProng1());
int pTBin = o2::analysis::findBin(binsPt, ptCandB0);
if (pTBin == -1) {
// LOGF(info, "B0 topol selection failed at getpTBin");
return false;
}
// // check that the candidate pT is within the analysis range
// if (ptCandB0 < ptCandMin || ptCandB0 >= ptCandMax) {
// return false;
// }
// B0 mass cut
if (std::abs(invMassB0ToDPi(candB0) - o2::constants::physics::MassB0) > cuts->get(pTBin, "m")) {
// Printf("B0 topol selection failed at mass diff check");
return false;
}
// pion pt
if (ptPi < cuts->get(pTBin, "pT Pi")) {
return false;
}
// D- pt
if (ptD < cuts->get(pTBin, "pT D")) {
return false;
}
/*
// D mass cut | already applied in candidateSelectorDplusToPiKPi.cxx
if (std::abs(invMassDplusToPiKPi(hfCandD) - o2::constants::physics::MassDMinus) > cuts->get(pTBin, "DeltaMD")) {
return false;
}
*/
// B0 Decay length
if (candB0.decayLength() < cuts->get(pTBin, "B0 decLen")) {
return false;
}
// B0 Decay length XY
if (candB0.decayLengthXY() < cuts->get(pTBin, "B0 decLenXY")) {
return false;
}
// B0 chi2PCA cut
if (candB0.chi2PCA() > cuts->get(pTBin, "Chi2PCA")) {
return false;
}
// B0 CPA cut
if (candB0.cpa() < cuts->get(pTBin, "CPA")) {
return false;
}
// d0 of pi
if (std::abs(candB0.impactParameter1()) < cuts->get(pTBin, "d0 Pi")) {
return false;
}
// d0 of D
if (std::abs(candB0.impactParameter0()) < cuts->get(pTBin, "d0 D")) {
return false;
}
return true;
}
/// Apply PID selection
/// \param pidTrackPi PID status of trackPi (prong1 of B0 candidate)
/// \param acceptPIDNotApplicable switch to accept Status::NotApplicable
/// \return true if prong1 of B0 candidate passes all selections
static bool selectionB0ToDPiPid(const int pidTrackPi, const bool acceptPIDNotApplicable)
{
if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) {
return false;
}
if (acceptPIDNotApplicable && pidTrackPi == TrackSelectorPID::Rejected) {
return false;
}
return true;
}
// Apply topological cuts as defined in SelectorCuts.h
/// \param candBp B+ candidate
/// \param cuts B+ candidate selection per pT bin"
/// \param binsPt pT bin limits
/// \return true if candidate passes all selections
template <typename T1, typename T2, typename T3>
static bool selectionBplusToD0PiTopol(const T1& candBp, const T2& cuts, const T3& binsPt)
{
auto ptCandBp = candBp.pt();
auto ptPi = RecoDecay::pt(candBp.pxProng1(), candBp.pyProng1());
int pTBin = o2::analysis::findBin(binsPt, ptCandBp);
if (pTBin == -1) {
return false;
}
// B+ mass cut
if (std::abs(invMassBplusToD0Pi(candBp) - o2::constants::physics::MassBPlus) > cuts->get(pTBin, "m")) {
return false;
}
// pion pt
if (ptPi < cuts->get(pTBin, "pT Pi")) {
return false;
}
// d0(D0)xd0(pi)
if (candBp.impactParameterProduct() > cuts->get(pTBin, "Imp. Par. Product")) {
return false;
}
// B Decay length
if (candBp.decayLength() < cuts->get(pTBin, "B decLen")) {
return false;
}
// B Decay length XY
if (candBp.decayLengthXY() < cuts->get(pTBin, "B decLenXY")) {
return false;
}
// B+ CPA cut
if (candBp.cpa() < cuts->get(pTBin, "CPA")) {
return false;
}
// d0 of pi
if (std::abs(candBp.impactParameter1()) < cuts->get(pTBin, "d0 Pi")) {
return false;
}
// d0 of D
if (std::abs(candBp.impactParameter0()) < cuts->get(pTBin, "d0 D0")) {
return false;
}
return true;
}
// Apply topological cuts as defined in SelectorCuts.h
/// \param candB0 B0 candidate
/// \param cuts B0 candidate selection per pT bin
/// \param binsPt pT bin limits
/// \param useJpsiPdgMass Use PDG mass for J/psi when calculating B0 candidate mass
/// \param useK0StarPdgMass Use PDG mass for K*0 when calculating B0 candidate mass
/// \return true if candidate passes all selections
template <typename T1, typename T2, typename T3>
static bool selectionB0ToJpsiK0StarTopol(const T1& candB0, const T2& cuts, const T3& binsPt, const bool useJpsiPdgMass, const bool useK0StarPdgMass, const bool k0StarToKPi = true)
{
auto ptCandB0 = candB0.pt();
auto mCandB0 = invMassB0ToJpsiK0Star(candB0, useJpsiPdgMass, useK0StarPdgMass, k0StarToKPi);
auto const pVecMu0 = candB0.pVectorProng0();
auto const pVecMu1 = candB0.pVectorProng1();
auto const pVecLfDau0 = candB0.pVectorProng2();
auto const pVecLfDau1 = candB0.pVectorProng3();
// K*0 invariant mass for the chosen daughter-mass hypothesis: K*0 → K+ π- or K*0bar → π+ K-
auto mCandK0Star = k0StarToKPi
? RecoDecay::m(std::array{pVecLfDau0, pVecLfDau1}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus})
: RecoDecay::m(std::array{pVecLfDau0, pVecLfDau1}, std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus});
auto ptJpsi = RecoDecay::pt(pVecMu0, pVecMu1);
auto ptK0Star = RecoDecay::pt(pVecLfDau0, pVecLfDau1);
auto candJpsi = candB0.jpsi();
float pseudoPropDecLen = candB0.decayLengthXY() * mCandB0 / ptCandB0;
int binPt = o2::analysis::findBin(binsPt, ptCandB0);
if (binPt == -1) {
return false;
}
// B0 mass cut
if (std::abs(mCandB0 - o2::constants::physics::MassB0) > cuts->get(binPt, "m")) {
return false;
}
// K*0 pt
if (ptK0Star < cuts->get(binPt, "pT K*0")) {
return false;
}
// J/Psi pt
if (ptJpsi < cuts->get(binPt, "pT J/Psi")) {
return false;
}
// K*0 mass
if (std::abs(mCandK0Star - o2::constants::physics::MassK0Star892) > cuts->get(binPt, "DeltaM K*0")) {
return false;
}
// J/Psi mass
if (std::abs(candJpsi.m() - o2::constants::physics::MassJPsi) > cuts->get(binPt, "DeltaM J/Psi")) {
return false;
}