forked from AliceO2Group/O2Physics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkstarInOO.cxx
More file actions
1652 lines (1470 loc) · 62.8 KB
/
kstarInOO.cxx
File metadata and controls
1652 lines (1470 loc) · 62.8 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 kstarInOO.cxx
/// \brief the pT spectra of k*0(892) resonance analysis in OO collisions
/// \author Jimun Lee <jimun.lee@cern.ch>
#include "Common/DataModel/Centrality.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/Multiplicity.h"
#include "Common/DataModel/PIDResponseTOF.h"
#include "Common/DataModel/PIDResponseTPC.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include "CommonConstants/PhysicsConstants.h"
#include "DataFormatsParameters/GRPObject.h"
#include "Framework/ASoA.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "ReconstructionDataFormats/Track.h"
#include <Framework/ASoAHelpers.h>
#include <Framework/Configurable.h>
#include <Framework/HistogramSpec.h>
#include <Framework/InitContext.h>
#include <Framework/OutputObjHeader.h>
#include <Framework/runDataProcessing.h>
// jet
#include "PWGJE/Core/JetDerivedDataUtilities.h"
#include "PWGJE/DataModel/EMCALClusters.h"
#include "PWGJE/DataModel/Jet.h"
#include "PWGJE/DataModel/JetReducedData.h"
#include "PWGJE/DataModel/TrackJetQa.h"
#include <CCDB/BasicCCDBManager.h>
#include <TLorentzVector.h>
#include <TMath.h>
#include <TMathBase.h>
#include <TVector2.h>
#include <RtypesCore.h>
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <iostream>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <stdlib.h>
using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
struct kstarInOO {
SliceCache cache;
Preslice<aod::Tracks> perCollision = aod::track::collisionId;
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
//==================================
//||
//|| Selection
//||
//==================================
// Event Selection
Configurable<std::string> cfgEventSelections{"cfgEventSelections", "sel8", "Set event selection"};
Configurable<float> cfgEventVtxCut{"cfgEventVtxCut", 10.0, "V_z cut selection"};
ConfigurableAxis cfgCentAxis{"cfgCentAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the centrality axis"};
Configurable<bool> cfgOccupancySel{"cfgOccupancySel", false, "Occupancy selection"};
Configurable<float> cfgOccupancyMax{"cfgOccupancyMax", 999999., "maximum occupancy of tracks in neighbouring collisions in a given time range"};
Configurable<float> cfgOccupancyMin{"cfgOccupancyMin", -100., "minimum occupancy of tracks in neighbouring collisions in a given time range"};
// Track Selection
// General
Configurable<double> cfgTrackMinPt{"cfgTrackMinPt", 0.15, "set track min pT"};
Configurable<double> cfgTrackMaxEta{"cfgTrackMaxEta", 0.8, "set track max Eta"};
Configurable<double> cfgTrackMaxDCArToPVcut{"cfgTrackMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"};
Configurable<double> cfgTrackMaxDCAzToPVcut{"cfgTrackMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"};
Configurable<bool> cfgTrackGlobalSel{"cfgTrackGlobalSel", true, "Global track selection"};
Configurable<bool> cfgTrackPrimaryTrack{"cfgTrackPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz
Configurable<bool> cfgTrackConnectedToPV{"cfgTrackConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor
Configurable<bool> cfgTrackGlobalWoDCATrack{"cfgTrackGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange)
// TPC
Configurable<double> cfgTrackFindableTPCClusters{"cfgTrackFindableTPCClusters", 50, "nFindable TPC Clusters"};
Configurable<double> cfgTrackTPCCrossedRows{"cfgTrackTPCCrossedRows", 70, "nCrossed TPC Rows"};
Configurable<double> cfgTrackRowsOverFindable{"cfgTrackRowsOverFindable", 1.2, "nRowsOverFindable TPC CLusters"};
Configurable<double> cfgTrackTPCChi2{"cfgTrackTPCChi2", 4.0, "nTPC Chi2 per Cluster"};
// ITS
Configurable<double> cfgTrackITSChi2{"cfgTrackITSChi2", 36.0, "nITS Chi2 per Cluster"};
// PID
Configurable<bool> cfgTrackTPCPID{"cfgTrackTPCPID", true, "Enables TPC PID"};
Configurable<bool> cfgTrackTOFPID{"cfgTrackTOFPID", true, "Enables TOF PID"};
Configurable<bool> cfgTrackSquarePIDCut{"cfgTrackSqurePIDCut", true, "Enables PID cut shape square switch"};
Configurable<bool> cfgTrackCirclePIDCut{"cfgTrackCirclePIDCut", true, "Enables PID cut shape circle switch"};
Configurable<int> cfgTrackCircleValue{"cfgTrackCircleValue", 2, "Enables TOF TPC PID circle cut value"};
Configurable<bool> cfgTrackTOFHard{"cfgTrackTOFHard", false, "Enables TOF Hard"};
Configurable<float> cfgTrackTPCPIDnSig{"cfgTrackTPCPIDnSig", 4.0, "nTPC PID sigma"};
Configurable<float> cfgTrackTOFPIDnSig{"cfgTrackTOFPIDnSig", 4.0, "nTOF PID sigma"};
Configurable<int> cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"};
// Mixing
ConfigurableAxis cfgBinsMixMult{"cfgBinsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"};
ConfigurableAxis cfgBinsMixVtx{"cfgBinsMixVtx", {VARIABLE_WIDTH, -10.0f, -5.f, 0.f, 5.f, 10.f}, "Mixing bins - z-vertex"};
Configurable<int> cfgMixNMixedEvents{"cfgMixNMixedEvents", 10, "Number of mixed events per event"};
Configurable<int> cfgVtxMixCut{"cfgVtxMixCut", 10, "Vertex Mix Cut"};
// MCGen
Configurable<bool> cfgForceGenReco{"cfgForceGenReco", false, "Only consider events which are reconstructed (neglect event-loss)"};
Configurable<bool> cfgReqMcEffPID{"cfgReqMcEffPID", false, "Request McEfficiency PID"};
// Pair
Configurable<int> cfgMinvNBins{"cfgMinvNBins", 300, "Number of bins for Minv axis"};
Configurable<float> cfgMinvMin{"cfgMinvMin", 0.60, "Minimum Minv value"};
Configurable<float> cfgMinvMax{"cfgMinvMax", 1.20, "Maximum Minv value"};
// Histogram
ConfigurableAxis binsDCAz{"binsDCAz", {40, -0.2, 0.2}, ""};
ConfigurableAxis binsDCAxy{"binsDCAxy", {40, -0.2, 0.2}, ""};
Configurable<bool> cfgEventCutQA{"cfgEventCutsQA", false, "Enable Event QA Hists"};
Configurable<bool> cfgTrackCutQA{"cfgTrackCutQA", false, "Enable Track QA Hists"};
Configurable<bool> cfgJetQAHistos{"cfgJetQAHistos", false, "Enable Jet QA Histos"};
Configurable<bool> cfgMCHistos{"cfgMCHistos", false, "Enable MC Hists"};
Configurable<bool> cfgMixedHistos{"cfgMixedHistos", false, "Enable Mixed Histos"};
Configurable<bool> cfgJetHistos{"cfgJetHistos", false, "Enable Jet Histos"};
Configurable<bool> cfgJetMCHistos{"cfgJetMCHistos", false, "Enable Jet MC Histos"};
Configurable<bool> cfgCutonTrig{"cfgCutonTrig", false, "Enable Jet Cut on Trig"};
Configurable<bool> cfgManualEvSel{"cfgManualEvSel", false, "Enable Manual EvSel"};
Configurable<bool> cfgJetEvSel{"cfgJetEvSel", false, "Enable Manual JetEvSel"};
//======================
//||
//|| JET
//||
//======================
Configurable<float> cfgJetpT{"cfgJetpT", 8.0, "Set Jet pT minimum"};
Configurable<float> cfgJetR{"cfgJetR", 0.4, "Set Jet radius parameter"};
Configurable<bool> cfgSingleJet{"cfgSingleJet", false, "Enforces strict phi-jet correspondance"};
Configurable<bool> cfgReqJets{"cfgReqJets", false, "False: MB, True: Inside Jets"};
Configurable<std::string> cfgRealTriggerMasks{"cfgRealTriggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"};
Configurable<std::string> cfgTriggerMasksTest1{"cfgTriggerMasksTest1", "", "possible JE Trigger masks Test1"};
Configurable<std::string> cfgTriggerMasksTest2{"cfgTriggerMasksTest2", "", "possible JE Trigger masks Test2"};
Configurable<std::string> cfgTriggerMasksTest3{"cfgTriggerMasksTest3", "", "possible JE Trigger masks Test3"};
std::vector<int> eventSelectionBits;
std::vector<int> RealTriggerMaskBits;
std::vector<int> triggerMaskBitsTest1;
std::vector<int> triggerMaskBitsTest2;
std::vector<int> triggerMaskBitsTest3;
// Main
void init(o2::framework::InitContext&)
{
// HISTOGRAMS
const AxisSpec axisEta{30, -1.5, +1.5, "#eta"};
const AxisSpec axisPhi{200, -1, +7, "#phi"};
const AxisSpec ptAxis = {200, 0, 20.0};
const AxisSpec pidAxis = {120, -6, 6};
const AxisSpec minvAxis = {cfgMinvNBins, cfgMinvMin, cfgMinvMax};
const AxisSpec axisDCAz{binsDCAz, "DCA_{z}"};
const AxisSpec axisDCAxy{binsDCAxy, "DCA_{XY}"};
const AxisSpec dRAxis = {100, 0, 100};
if (cfgEventCutQA) {
histos.add("hEvent_Cut", "Number of event after cuts", kTH1D, {{13, -0.5, 12.5}});
histos.add("hPosZ_BC", "hPosZ_BC", kTH1F, {{300, -15.0, 15.0}});
histos.add("hPosZ_AC", "hPosZ_AC", kTH1F, {{300, -15.0, 15.0}});
histos.add("hcentFT0C_BC", "centFT0C_BC", kTH1F, {{110, 0.0, 110.0}});
histos.add("hcentFT0C_AC", "centFT0C_AC", kTH1F, {{110, 0.0, 110.0}});
}
if (cfgTrackCutQA) {
histos.add("hDCArToPv_BC", "DCArToPv_BC", kTH1F, {axisDCAxy});
histos.add("hDCAzToPv_BC", "DCAzToPv_BC", kTH1F, {axisDCAz});
histos.add("hIsPrim_BC", "hIsPrim_BC", kTH1F, {{2, -0.5, 1.5}});
histos.add("hIsGood_BC", "hIsGood_BC", kTH1F, {{2, -0.5, 1.5}});
histos.add("hIsPrimCont_BC", "hIsPrimCont_BC", kTH1F, {{2, -0.5, 1.5}});
histos.add("hFindableTPCClusters_BC", "hFindableTPCClusters_BC", kTH1F, {{200, 0, 200}});
histos.add("hFindableTPCRows_BC", "hFindableTPCRows_BC", kTH1F, {{200, 0, 200}});
histos.add("hClustersVsRows_BC", "hClustersVsRows_BC", kTH1F, {{200, 0, 2}});
histos.add("hTPCChi2_BC", "hTPCChi2_BC", kTH1F, {{200, 0, 100}});
histos.add("hITSChi2_BC", "hITSChi2_BC", kTH1F, {{200, 0, 100}});
histos.add("QA_nSigma_pion_TPC_BC", "QA_nSigma_pion_TPC_BC", {HistType::kTH2F, {ptAxis, pidAxis}});
histos.add("QA_nSigma_pion_TOF_BC", "QA_nSigma_pion_TOF_BC", {HistType::kTH2F, {ptAxis, pidAxis}});
histos.add("QA_pion_TPC_TOF_BC", "QA_pion_TPC_TOF_BC", {HistType::kTH2F, {pidAxis, pidAxis}});
histos.add("QA_nSigma_kaon_TPC_BC", "QA_nSigma_kaon_TPC_BC", {HistType::kTH2F, {ptAxis, pidAxis}});
histos.add("QA_nSigma_kaon_TOF_BC", "QA_nSigma_kaon_TOF_BC", {HistType::kTH2F, {ptAxis, pidAxis}});
histos.add("QA_kaon_TPC_TOF_BC", "QA_kaon_TPC_TOF_BC", {HistType::kTH2F, {pidAxis, pidAxis}});
histos.add("QA_track_pT_BC", "QA_track_pT_BC", kTH1F, {{13, 0.0, 13.0}});
histos.add("hDCArToPv_AC", "DCArToPv_AC", kTH1F, {axisDCAxy});
histos.add("hDCAzToPv_AC", "DCAzToPv_AC", kTH1F, {axisDCAz});
histos.add("hIsPrim_AC", "hIsPrim_AC", kTH1F, {{2, -0.5, 1.5}});
histos.add("hIsGood_AC", "hIsGood_AC", kTH1F, {{2, -0.5, 1.5}});
histos.add("hIsPrimCont_AC", "hIsPrimCont_AC", kTH1F, {{2, -0.5, 1.5}});
histos.add("hFindableTPCClusters_AC", "hFindableTPCClusters_AC", kTH1F, {{200, 0, 200}});
histos.add("hFindableTPCRows_AC", "hFindableTPCRows_AC", kTH1F, {{200, 0, 200}});
histos.add("hClustersVsRows_AC", "hClustersVsRows_AC", kTH1F, {{200, 0, 2}});
histos.add("hTPCChi2_AC", "hTPCChi2_AC", kTH1F, {{200, 0, 100}});
histos.add("hITSChi2_AC", "hITSChi2_AC", kTH1F, {{200, 0, 100}});
histos.add("QA_nSigma_pion_TPC_AC", "QA_nSigma_pion_TPC_AC", {HistType::kTH2F, {ptAxis, pidAxis}});
histos.add("QA_nSigma_pion_TOF_AC", "QA_nSigma_pion_TOF_AC", {HistType::kTH2F, {ptAxis, pidAxis}});
histos.add("QA_pion_TPC_TOF_AC", "QA_pion_TPC_TOF_AC", {HistType::kTH2F, {pidAxis, pidAxis}});
histos.add("QA_nSigma_kaon_TPC_AC", "QA_nSigma_kaon_TPC_AC", {HistType::kTH2F, {ptAxis, pidAxis}});
histos.add("QA_nSigma_kaon_TOF_AC", "QA_nSigma_kaon_TOF_AC", {HistType::kTH2F, {ptAxis, pidAxis}});
histos.add("QA_kaon_TPC_TOF_AC", "QA_kaon_TPC_TOF_AC", {HistType::kTH2F, {pidAxis, pidAxis}});
histos.add("QA_track_pT_AC", "QA_track_pT_AC", kTH1F, {{13, 0.0, 13.0}});
}
if (cfgJetQAHistos) {
histos.add("nTriggerQA", "nTriggerQA", kTH1F, {{7, 0.0, 7.0}});
histos.add("JetpT", "Jet pT (GeV/c)", kTH1F, {{4000, 0., 200.}});
histos.add("JetEta", "Jet Eta", kTH1F, {{100, -1.0, 1.0}});
histos.add("JetPhi", "Jet Phi", kTH1F, {{80, -1.0, 7.0}});
histos.add("rawDimpT", "rawDimpT", kTH2F, {{1000, 0.0, 10.0}, {100, -0.5, 0.5}});
histos.add("jetTrackEta", "Jet Track Eta", kTH1F, {{100, -1.0, 1.0}});
histos.add("jetTrackPhi", "Jet Track Phi", kTH1F, {{80, -1.0, 7.0}});
histos.add("nJetsPerEvent", "nJetsPerEvent", kTH1I, {{4, -0.5, 3.5}});
histos.add("nGoodJets", "nGoodJets", kTH1I, {{4, -0.5, 3.5}});
}
////////////////////////////////////
histos.add("nEvents", "nEvents", kTH1F, {{7, 0.0, 7.0}});
histos.add("hUSS_KPi", "hUSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
histos.add("hUSS_PiK", "hUSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
histos.add("hLSS_KPi", "hLSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
histos.add("hLSS_PiK", "hLSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
if (cfgMixedHistos) {
histos.add("hUSS_KPi_Mix", "hUSS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
histos.add("hUSS_PiK_Mix", "hUSS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
}
if (cfgMCHistos) {
histos.add("nEvents_Gen", "nEvents_Gen", kTH1F, {{4, 0.0, 4.0}});
histos.add("hUSS_TrueRec", "hUSS_TrueRec", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
histos.add("hGen_pT_Raw", "Gen_pT_Raw (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hGen_pT_GoodEv", "hGen_pT_GoodEv", kTHnSparseF, {cfgCentAxis, ptAxis});
}
if (cfgJetHistos) {
histos.add("hUSS_KPi_INSIDE", "hUSS_KPi_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis});
histos.add("hUSS_PiK_INSIDE", "hUSS_PiK_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis});
histos.add("hLSS_KPi_INSIDE", "hLSS_KPi_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis});
histos.add("hLSS_PiK_INSIDE", "hLSS_PiK_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis});
}
if (cfgJetMCHistos) {
histos.add("nEvents_Gen", "nEvents_Gen", kTH1F, {{7, -.0, 7.0}});
histos.add("hUSS_TrueRec", "hUSS_TrueRec", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
histos.add("hUSS_TrueRec_INSIDE", "hUSS_TrueRec_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis});
histos.add("hGen_pT_Raw", "Gen_pT_Raw (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hGen_pT_GoodEv", "Gen_pT_GoodTrig (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hGen_pT_GoodTrig", "Gen_pT_GoodTrig (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hGen_pT_GoodEvTrig", "Gen_pT_GoodEvTrig (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hEffRec_pT", "EffRec_pT (GeV/c)", kTH1F, {{1600, 0., 80.}});
histos.add("hEffRecTest1_pT", "EffRecTest1_pT (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hEffRecTest2_pT", "EffRecTest2_pT (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hEffRecTest3_pT", "EffRecTest3_pT (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hEffRecTest4_pT", "EffRecTest4_pT (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hEffRecTest5_pT", "EffRecTest5_pT (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hEffRecTest6_pT", "EffRecTest6_pT (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hEffRecTest7_pT", "EffRecTest7_pT (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hEffRecTest8_pT", "EffRecTest8_pT (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hEffGen_pT", "EffGen_pT (GeV/c)", kTH1F, {{800, 0., 40.}});
histos.add("hMotherPdg1", "hMotherPdg1", kTH1F, {{5000, 0., 5000.}});
histos.add("hMotherPdg2", "hMotherPdg2", kTH1F, {{5000, 0., 5000.}});
}
std::shared_ptr<TH1> hCutFlow = histos.get<TH1>(HIST("hEvent_Cut"));
std::vector<std::string> eventCutLabels = {
"All Events",
"sel8",
Form("|Vz| < %.1f", cfgEventVtxCut.value),
"kIsGoodZvtxFT0vsPV",
"kNoSameBunchPileup",
"kNoTimeFrameBorder",
"kNoITSROFrameBorder",
"kNoCollInTimeRangeStandard",
"kIsGoodITSLayersAll",
Form("Occupancy < %.0f", cfgOccupancyMax.value),
"All passed events"};
for (size_t i = 0; i < eventCutLabels.size(); ++i) {
hCutFlow->GetXaxis()->SetBinLabel(i + 1, eventCutLabels[i].c_str());
}
// Jet
eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast<std::string>(cfgEventSelections));
RealTriggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(cfgRealTriggerMasks);
triggerMaskBitsTest1 = jetderiveddatautilities::initialiseTriggerMaskBits(cfgTriggerMasksTest1);
triggerMaskBitsTest2 = jetderiveddatautilities::initialiseTriggerMaskBits(cfgTriggerMasksTest2);
triggerMaskBitsTest3 = jetderiveddatautilities::initialiseTriggerMaskBits(cfgTriggerMasksTest3);
} // end of init
//======================
//|| For LF Analysis
//======================
using EventCandidates = soa::Join<aod::Collisions, aod::EvSels, aod::FT0Mults, aod::MultZeqs, aod::CentFT0Cs>; //, aod::CentFT0Ms, aod::CentFT0As
using EventCandidatesTrue = aod::McCollisions;
using TrackCandidates = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection,
aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi>;
using TrackCandidatesMC = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::McTrackLabels, aod::TrackSelection,
aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi>;
//==============
//|| For jets
//==============
Filter JEPosZFilter = nabs(aod::jcollision::posZ) < cfgEventVtxCut;
Filter JEMCPosZFilter = nabs(aod::jmccollision::posZ) < cfgEventVtxCut;
Filter jetCuts = aod::jet::pt > cfgJetpT&& aod::jet::r == nround(cfgJetR.node() * 100.0f);
using JetTrackCandidates = soa::Join<aod::JTracks, aod::JTrackPIs>;
using JetTrackCandidatesMC = soa::Join<aod::JTracks, aod::JTrackPIs, aod::JMcTrackLbs>;
using JetFilteredJets = soa::Filtered<soa::Join<aod::ChargedJets, aod::ChargedJetConstituents>>;
// For Mixed Event
using BinningType = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C>;
Partition<TrackCandidates> kaon = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfgTrackTPCPIDnSig);
Partition<TrackCandidates> pion = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaPi) <= cfgTrackTPCPIDnSig);
Partition<TrackCandidatesMC> kaonMC = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfgTrackTPCPIDnSig);
Partition<TrackCandidatesMC> pionMC = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaPi) <= cfgTrackTPCPIDnSig);
double massKa = o2::constants::physics::MassKPlus;
double massPi = o2::constants::physics::MassPiMinus;
//==================================
//||
//|| Helper Templates
//||
//==================================
template <typename objType>
void fillQA(const bool pass, const objType& obj, const int objecttype = 0)
{
if (objecttype == 1) {
if constexpr (requires { obj.posZ(); }) {
if (!pass) {
histos.fill(HIST("hPosZ_BC"), obj.posZ());
histos.fill(HIST("hcentFT0C_BC"), obj.centFT0C());
} else {
histos.fill(HIST("hPosZ_AC"), obj.posZ());
histos.fill(HIST("hcentFT0C_AC"), obj.centFT0C());
}
}
} // eventSelection histogram
if (objecttype == 2) {
if constexpr (requires { obj.posZ(); }) {
if (!pass) {
histos.fill(HIST("hPosZ_BC"), obj.posZ());
histos.fill(HIST("hcentFT0C_BC"), obj.centFT0C());
} else {
histos.fill(HIST("hPosZ_AC"), obj.posZ());
histos.fill(HIST("hcentFT0C_AC"), obj.centFT0C());
}
}
} // Jet eventSelection histogram
if constexpr (requires { obj.tpcCrossedRowsOverFindableCls(); }) {
if (objecttype == 3) {
if (!pass) {
histos.fill(HIST("hDCArToPv_BC"), obj.dcaXY());
histos.fill(HIST("hDCAzToPv_BC"), obj.dcaZ());
histos.fill(HIST("hIsPrim_BC"), obj.isPrimaryTrack());
histos.fill(HIST("hIsGood_BC"), obj.isGlobalTrackWoDCA());
histos.fill(HIST("hIsPrimCont_BC"), obj.isPVContributor());
histos.fill(HIST("hFindableTPCClusters_BC"), obj.tpcNClsFindable());
histos.fill(HIST("hFindableTPCRows_BC"), obj.tpcNClsCrossedRows());
histos.fill(HIST("hClustersVsRows_BC"), obj.tpcCrossedRowsOverFindableCls());
histos.fill(HIST("hTPCChi2_BC"), obj.tpcChi2NCl());
histos.fill(HIST("hITSChi2_BC"), obj.itsChi2NCl());
histos.fill(HIST("QA_track_pT_BC"), obj.pt());
} else {
histos.fill(HIST("hDCArToPv_AC"), obj.dcaXY());
histos.fill(HIST("hDCAzToPv_AC"), obj.dcaZ());
histos.fill(HIST("hIsPrim_AC"), obj.isPrimaryTrack());
histos.fill(HIST("hIsGood_AC"), obj.isGlobalTrackWoDCA());
histos.fill(HIST("hIsPrimCont_AC"), obj.isPVContributor());
histos.fill(HIST("hFindableTPCClusters_AC"), obj.tpcNClsFindable());
histos.fill(HIST("hFindableTPCRows_AC"), obj.tpcNClsCrossedRows());
histos.fill(HIST("hClustersVsRows_AC"), obj.tpcCrossedRowsOverFindableCls());
histos.fill(HIST("hTPCChi2_AC"), obj.tpcChi2NCl());
histos.fill(HIST("hITSChi2_AC"), obj.itsChi2NCl());
histos.fill(HIST("QA_track_pT_AC"), obj.pt());
}
}
} // trackSelection
if (objecttype == 4) {
if constexpr (requires { obj.pt(); }) {
if (!pass) {
histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), obj.pt(), obj.tpcNSigmaKa());
histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), obj.pt(), obj.tofNSigmaKa());
histos.fill(HIST("QA_kaon_TPC_TOF_BC"), obj.tpcNSigmaKa(), obj.tofNSigmaKa());
} else {
histos.fill(HIST("QA_nSigma_kaon_TPC_AC"), obj.pt(), obj.tpcNSigmaKa());
histos.fill(HIST("QA_nSigma_kaon_TOF_AC"), obj.pt(), obj.tofNSigmaKa());
histos.fill(HIST("QA_kaon_TPC_TOF_AC"), obj.tpcNSigmaKa(), obj.tofNSigmaKa());
}
}
} // kaon pid Selection
if (objecttype == 5) {
if constexpr (requires { obj.pt(); }) {
if (!pass) {
histos.fill(HIST("QA_nSigma_pion_TPC_BC"), obj.pt(), obj.tpcNSigmaPi());
histos.fill(HIST("QA_nSigma_pion_TOF_BC"), obj.pt(), obj.tofNSigmaPi());
histos.fill(HIST("QA_pion_TPC_TOF_BC"), obj.tpcNSigmaPi(), obj.tofNSigmaPi());
} else {
histos.fill(HIST("QA_nSigma_pion_TPC_AC"), obj.pt(), obj.tpcNSigmaPi());
histos.fill(HIST("QA_nSigma_pion_TOF_AC"), obj.pt(), obj.tofNSigmaPi());
histos.fill(HIST("QA_pion_TPC_TOF_AC"), obj.tpcNSigmaPi(), obj.tofNSigmaPi());
}
}
} // pion pid Selection
} // fill QA
enum class objectType { MB,
Jets,
MBRecParticle,
JetsRecParticle };
template <typename TrackType>
void fillMinv(objectType type, const TrackType& trk1, const TrackType& trk2, const ROOT::Math::PxPyPzMVector& lReso, double centrality, double jetpt, bool IsMix, bool flip)
{
double conjugate = trk1.sign() * trk2.sign();
switch (type) {
case objectType::MB:
if (IsMix && cfgMixedHistos) {
if (conjugate < 0) {
if (!flip)
histos.fill(HIST("hUSS_KPi_Mix"), centrality, lReso.Pt(), lReso.M());
else
histos.fill(HIST("hUSS_PiK_Mix"), centrality, lReso.Pt(), lReso.M());
}
} else {
if (conjugate < 0) {
if (!flip)
histos.fill(HIST("hUSS_KPi"), centrality, lReso.Pt(), lReso.M());
else
histos.fill(HIST("hUSS_PiK"), centrality, lReso.Pt(), lReso.M());
} else if (conjugate > 0) {
if (!flip)
histos.fill(HIST("hLSS_KPi"), centrality, lReso.Pt(), lReso.M());
else
histos.fill(HIST("hLSS_PiK"), centrality, lReso.Pt(), lReso.M());
}
}
break;
case objectType::Jets:
if (!IsMix && cfgJetHistos) {
if (conjugate < 0) {
if (!flip)
histos.fill(HIST("hUSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M());
else
histos.fill(HIST("hUSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M());
} else {
if (conjugate > 0) {
if (!flip)
histos.fill(HIST("hLSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M());
else
histos.fill(HIST("hLSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M());
}
}
}
break;
case objectType::MBRecParticle:
if (cfgMCHistos) {
if (conjugate < 0) {
histos.fill(HIST("hUSS_TrueRec"), centrality, lReso.Pt(), lReso.M());
}
}
break;
case objectType::JetsRecParticle:
if (cfgJetMCHistos) {
if (conjugate < 0) {
histos.fill(HIST("hUSS_TrueRec_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M());
}
}
break;
} // switch
} // fillMinv
//======================================================================
template <typename EventType>
std::pair<bool, int> eventSelection(const EventType event, const bool QA)
{
if (cfgEventCutQA && QA) {
fillQA(false, event, 1);
histos.fill(HIST("hEvent_Cut"), 0);
}
if (!event.sel8())
return {false, 1};
if (cfgEventCutQA && QA) {
histos.fill(HIST("hEvent_Cut"), 1);
}
if (std::abs(event.posZ()) > cfgEventVtxCut)
return {false, 2};
if (cfgEventCutQA && QA) {
histos.fill(HIST("hEvent_Cut"), 2);
}
if (!event.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))
return {false, 3};
if (cfgEventCutQA && QA) {
histos.fill(HIST("hEvent_Cut"), 3);
}
if (!event.selection_bit(aod::evsel::kNoSameBunchPileup))
return {false, 4};
if (cfgEventCutQA && QA) {
histos.fill(HIST("hEvent_Cut"), 4);
}
if (!event.selection_bit(aod::evsel::kNoTimeFrameBorder))
return {false, 5};
if (cfgEventCutQA && QA) {
histos.fill(HIST("hEvent_Cut"), 5);
}
if (!event.selection_bit(aod::evsel::kNoITSROFrameBorder))
return {false, 6};
if (cfgEventCutQA && QA) {
histos.fill(HIST("hEvent_Cut"), 6);
}
if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))
return {false, 7};
if (cfgEventCutQA && QA) {
histos.fill(HIST("hEvent_Cut"), 7);
}
if (!event.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll))
return {false, 8};
if (cfgEventCutQA && QA) {
histos.fill(HIST("hEvent_Cut"), 8);
}
if (cfgOccupancySel && (event.trackOccupancyInTimeRange() > cfgOccupancyMax || event.trackOccupancyInTimeRange() < cfgOccupancyMin))
return {false, 9};
if (cfgEventCutQA && QA) {
histos.fill(HIST("hEvent_Cut"), 9);
}
if (cfgEventCutQA && QA) {
fillQA(true, event, 1);
histos.fill(HIST("hEvent_Cut"), 10);
}
return {true, 11};
};
template <typename EventType>
std::pair<bool, int> JeteventSelection(const EventType event, const bool QA)
{
if (cfgEventCutQA && QA) {
fillQA(false, event, 2);
}
if (!jetderiveddatautilities::selectCollision(event, eventSelectionBits)) { // sel8
return {false, 1};
}
if (std::abs(event.posZ()) > cfgEventVtxCut)
return {false, 2};
if (cfgEventCutQA && QA) {
fillQA(true, event, 2);
}
return {true, 8};
};
template <typename TracksType>
bool trackSelection(const TracksType track, const bool QA)
{
if (cfgTrackCutQA && QA) {
fillQA(false, track, 3);
}
if (cfgTrackGlobalSel && !track.isGlobalTrack())
return false;
if (track.pt() < cfgTrackMinPt)
return false;
if (std::abs(track.eta()) > cfgTrackMaxEta)
return false;
if (std::abs(track.dcaXY()) > cfgTrackMaxDCArToPVcut)
return false;
if (std::abs(track.dcaZ()) > cfgTrackMaxDCAzToPVcut)
return false;
if (cfgTrackPrimaryTrack && !track.isPrimaryTrack())
return false;
if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA())
return false;
if (cfgTrackFindableTPCClusters > 0 && track.tpcNClsFindable() < cfgTrackFindableTPCClusters)
return false;
if (track.tpcNClsCrossedRows() < cfgTrackTPCCrossedRows)
return false;
if (cfgTrackRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls() > cfgTrackRowsOverFindable)
return false;
if (track.tpcChi2NCl() > cfgTrackTPCChi2)
return false;
if (track.itsChi2NCl() > cfgTrackITSChi2)
return false;
if (cfgTrackConnectedToPV && !track.isPVContributor())
return false;
if (cfgTrackCutQA && QA) {
fillQA(true, track, 3);
}
return true;
};
template <typename TrackPID>
bool trackPIDKaon(const TrackPID& candidate, const bool QA)
{
double tpcpid = 0;
double tofpid = 0;
bool tpcPIDPassed{false}, tofPIDPassed{false};
if (cfgTrackCutQA && QA) {
fillQA(false, candidate, 4);
}
// TPC
if (cfgTrackSquarePIDCut) {
if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig)
tpcPIDPassed = true;
if (candidate.hasTOF()) {
if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) {
tofPIDPassed = true;
}
} else {
if (!cfgTrackTOFHard) {
tofPIDPassed = true;
} else {
tofPIDPassed = false;
}
}
} // end of square cut
if (cfgTrackCirclePIDCut) {
if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig)
tpcpid = std::abs(candidate.tpcNSigmaKa());
tofpid = 0;
if (candidate.hasTOF()) {
tofpid = std::abs(candidate.tofNSigmaKa());
} else {
if (cfgTrackTOFHard) {
tofpid = 999;
}
}
if (tpcpid * tpcpid + tofpid * tofpid < cfgTrackCircleValue) {
tpcPIDPassed = true;
tofPIDPassed = true;
}
} // circular cut
// TPC & TOF
if (tpcPIDPassed && tofPIDPassed) {
if (cfgTrackCutQA && QA) {
fillQA(true, candidate, 4);
}
return true;
}
return false;
}
template <typename TrackPID>
bool trackPIDPion(const TrackPID& candidate, const bool QA)
{
double tpcpid = 0;
double tofpid = 0;
bool tpcPIDPassed{false}, tofPIDPassed{false};
if (cfgTrackCutQA && QA) {
fillQA(false, candidate, 5);
}
// TPC
if (cfgTrackSquarePIDCut) {
if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig)
tpcPIDPassed = true;
if (candidate.hasTOF()) {
if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) {
tofPIDPassed = true;
}
} else {
if (!cfgTrackTOFHard) {
tofPIDPassed = true;
} else {
tofPIDPassed = false;
}
}
} // end of square cut
if (cfgTrackCirclePIDCut) {
if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig)
tpcpid = std::abs(candidate.tpcNSigmaPi());
tofpid = 0;
if (candidate.hasTOF()) {
tofpid = std::abs(candidate.tofNSigmaPi());
} else {
if (cfgTrackTOFHard) {
tofpid = 999;
}
}
if (tpcpid * tpcpid + tofpid * tofpid < cfgTrackCircleValue) {
tpcPIDPassed = true;
tofPIDPassed = true;
}
} // circular cut
// TPC & TOF
if (tpcPIDPassed && tofPIDPassed) {
if (cfgTrackCutQA && QA) {
fillQA(true, candidate, 5);
}
return true;
}
return false;
}
template <typename TracksType>
ROOT::Math::PxPyPzMVector minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA, const bool flip)
{
if (!trackSelection(trk1, false) || !trackSelection(trk2, false))
return {};
if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA))
return {};
if (trk1.globalIndex() >= trk2.globalIndex())
return {};
ROOT::Math::PxPyPzMVector lDecayDaughter1, lDecayDaughter2, lResonance;
if (!flip) {
lDecayDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massKa);
lDecayDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPi);
} else {
lDecayDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massPi);
lDecayDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massKa);
}
lResonance = lDecayDaughter1 + lDecayDaughter2;
if (std::abs(lResonance.Eta()) > cfgTrackMaxEta)
return {};
return {lResonance};
}
template <typename TracksType>
ROOT::Math::PxPyPzMVector TrueReconstruction(const TracksType& trk1, const TracksType& trk2)
{
double conjugate = trk1.sign() * trk2.sign();
if (conjugate > 0)
return {};
auto particle1 = trk1.mcParticle();
auto particle2 = trk2.mcParticle();
if (!particle1.has_mothers() || !particle2.has_mothers()) {
return {};
}
std::vector<int> mothers1{};
std::vector<int> mothers1PDG{};
for (auto& particle1_mom : particle1.template mothers_as<aod::McParticles>()) {
mothers1.push_back(particle1_mom.globalIndex());
mothers1PDG.push_back(particle1_mom.pdgCode());
}
std::vector<int> mothers2{};
std::vector<int> mothers2PDG{};
for (auto& particle2_mom : particle2.template mothers_as<aod::McParticles>()) {
mothers2.push_back(particle2_mom.globalIndex());
mothers2PDG.push_back(particle2_mom.pdgCode());
}
if (mothers1PDG[0] != 313)
return {}; // mother not K*0
if (mothers2PDG[0] != 313)
return {}; // mothers not K*0
if (mothers1[0] != mothers2[0])
return {}; // Kaon and pion not from the same K*0
if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321)
return {};
if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321)
return {};
double track1_mass, track2_mass;
if (std::fabs(particle1.pdgCode()) == 211) {
track1_mass = massPi;
} else {
track1_mass = massKa;
}
if (std::fabs(particle2.pdgCode()) == 211) {
track2_mass = massPi;
} else {
track2_mass = massKa;
}
if (track1_mass == track2_mass) {
return {};
}
ROOT::Math::PxPyPzMVector lTrueDaughter1, lTrueDaughter2, lTrueReso;
lTrueDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), track1_mass);
lTrueDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), track2_mass);
lTrueReso = lTrueDaughter1 + lTrueDaughter2;
if (lTrueReso.M() < 0)
return {};
return {lTrueReso};
}
template <typename CollisionType, typename TracksType>
void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix, const bool QA)
{
auto tracks1 = kaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache);
auto tracks2 = pion->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache);
auto centrality = collision1.centFT0C();
for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) {
for (bool flip : {false, true}) {
auto lReso = minvReconstruction(trk1, trk2, QA, flip);
if (lReso.M() < 0)
continue;
fillMinv(objectType::MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip);
} // flip
} // for
} // TrackSlicing
template <typename CollisionType, typename TracksType>
void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix, const bool QA)
{
auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache);
auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache);
auto centrality = collision1.centFT0C();
for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) {
if (!trk1.has_mcParticle() || !trk2.has_mcParticle())
continue;
for (bool flip : {false, true}) {
auto lReso = minvReconstruction(trk1, trk2, QA, flip);
if (lReso.M() < 0)
continue;
fillMinv(objectType::MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip);
} // flip
//============================
//| True Reconstruction
//============================
auto lTrueReso = TrueReconstruction(trk1, trk2);
fillMinv(objectType::MBRecParticle, trk1, trk2, lTrueReso, centrality, -1.0, IsMix, false);
} // tracks
} // TrackSlicingMC
template <typename JetType>
double DistinguishJets(const JetType& jets, ROOT::Math::PxPyPzMVector lResonance)
{
if (cDebugLevel > 0)
std::cout << "Finded multiple jets to the same phi." << std::endl;
double bestR = 0;
double bestJetpT = 0;
for (auto const& jet : jets) {
double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi());
double etadiff = jet.eta() - lResonance.Eta();
double R = TMath::Sqrt((phidiff * phidiff) + (etadiff * etadiff));
if (R < cfgJetR && bestR == 0) {
bestR = R;
bestJetpT = jet.pt();
} else if (R < bestR) {
bestR = R;
bestJetpT = jet.pt();
}
} // jet
return bestJetpT;
}
template <typename TracksType, typename JetType>
void JetTrackSlicing(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& chargedjets, const bool IsMix, const bool QA)
{
//============================
//| MB: Track Reconstruction
//============================
auto centrality = collision.centFT0C();
for (const auto& [track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(jetTracks, jetTracks))) {
auto trk1 = track1.template track_as<TrackCandidates>();
auto trk2 = track2.template track_as<TrackCandidates>();
for (bool flip : {false, true}) {
auto lResonance = minvReconstruction(trk1, trk2, QA, flip);
if (lResonance.M() < 0)
continue;
fillMinv(objectType::MB, trk1, trk2, lResonance, centrality, -1.0, IsMix, flip);
//==============================
//| Jets: Track Reconstruction
//==============================
bool jetFlag = false;
int goodjets = 0;
double jetpt = 0;
for (auto const& jet : chargedjets) {
double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi());
double etadiff = jet.eta() - lResonance.Eta();
double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff));
if (R < cfgJetR) {
jetFlag = true;
jetpt = jet.pt();
goodjets++;
}
}
if (cfgJetQAHistos) {
histos.fill(HIST("nGoodJets"), goodjets);
}
if (!cfgSingleJet) {
if (goodjets > 1) {
jetpt = DistinguishJets<JetType>(chargedjets, lResonance);
}
}
if (jetFlag) {
fillMinv(objectType::Jets, trk1, trk2, lResonance, centrality, jetpt, IsMix, flip);
} // jetFlag
} // flip
} // jetTracks
} // JetTrackSlicing
template <typename TracksType, typename JetType>
void JetTrackSlicingMC(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& chargedjets, const bool IsMix, const bool QA)
{
//============================
//| MB: Track Reconstruction
//============================
auto centrality = collision.centFT0C();
for (const auto& [track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(jetTracks, jetTracks))) {
auto trk1 = track1.template track_as<TrackCandidatesMC>();
auto trk2 = track2.template track_as<TrackCandidatesMC>();
if (!trk1.has_mcParticle() || !trk2.has_mcParticle())
continue;
for (bool flip : {false, true}) {
auto lResonance = minvReconstruction(trk1, trk2, QA, flip);
if (lResonance.M() < 0)
continue;
fillMinv(objectType::MB, trk1, trk2, lResonance, centrality, -1.0, IsMix, flip);
//==============================
//| Jets: Track Reconstruction
//==============================
bool jetFlag = false;
int goodjets = 0;
double jetpt = 0;
for (auto const& jet : chargedjets) {
double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi());
double etadiff = jet.eta() - lResonance.Eta();
double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff));
if (R < cfgJetR) {
jetFlag = true;
jetpt = jet.pt();
goodjets++;
}
}
if (cfgJetQAHistos) {
histos.fill(HIST("nGoodJets"), goodjets);
}
if (!cfgSingleJet) {
if (goodjets > 1) {
jetpt = DistinguishJets<JetType>(chargedjets, lResonance);
}
}
if (jetFlag) {
fillMinv(objectType::Jets, trk1, trk2, lResonance, centrality, jetpt, IsMix, flip);
} // jetFlag
//===============================
//| MB: Particle Reconstruction
//===============================
auto lTrueReso = TrueReconstruction(trk1, trk2);
fillMinv(objectType::MBRecParticle, trk1, trk2, lTrueReso, centrality, -1.0, IsMix, false);
//==================================