-
Notifications
You must be signed in to change notification settings - Fork 797
Expand file tree
/
Copy pathAliAnalysisTaskSEDs.cxx
More file actions
2149 lines (1953 loc) · 83.9 KB
/
Copy pathAliAnalysisTaskSEDs.cxx
File metadata and controls
2149 lines (1953 loc) · 83.9 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(c) 2007-2019, ALICE Experiment at CERN, All rights reserved. *
* *
* Author: The ALICE Off-line Project. *
* Contributors are mentioned in the code where appropriate. *
* *
* Permission to use, copy, modify and distribute this software and its *
* documentation strictly for non-commercial purposes is hereby granted *
* without fee, provided that the above copyright notice appears in all *
* copies and that both the copyright notice and this permission notice *
* appear in the supporting documentation. The authors make no claims *
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
///////////////////////////////////////////////////////////////////
// //
// Analysis task to produce Ds candidates mass spectra //
// Origin: F.Prino, Torino, prino@to.infn.it //
// Mantainers: F. Catalano, fabio.catalano@cern.ch //
// F. Grosa, fabrizio.grosa@cern.ch //
// //
///////////////////////////////////////////////////////////////////
#include <TH1F.h>
#include <TH2F.h>
#include <TH3F.h>
#include <TTree.h>
#include <TClonesArray.h>
#include <TList.h>
#include <TString.h>
#include <TMath.h>
#include <TDatabasePDG.h>
#include <TRandom.h>
#include "AliAnalysisUtils.h"
#include "AliAnalysisManager.h"
#include "AliAODHandler.h"
#include "AliAODEvent.h"
#include "AliAODVertex.h"
#include "AliAODTrack.h"
#include "AliAODMCHeader.h"
#include "AliAODMCParticle.h"
#include "AliAODRecoDecay.h"
#include "AliAODRecoDecayHF3Prong.h"
#include "AliNormalizationCounter.h"
#include "AliAnalysisVertexingHF.h"
#include "AliVertexingHFUtils.h"
#include "AliRDHFCutsDstoKKpi.h"
#include "AliHFMLResponseDstoKKpi.h"
#include "AliAnalysisTaskSEDs.h"
/// \cond CLASSIMP
ClassImp(AliAnalysisTaskSEDs);
/// \endcond
//________________________________________________________________________
AliAnalysisTaskSEDs::AliAnalysisTaskSEDs() : AliAnalysisTaskSE()
{
/// Default constructor
}
//________________________________________________________________________
AliAnalysisTaskSEDs::AliAnalysisTaskSEDs(const char *name, AliRDHFCutsDstoKKpi *analysiscuts, Bool_t createMLtree) : AliAnalysisTaskSE(name),
fCreateMLtree(createMLtree)
{
/// Standard constructor
SetAnalysisCuts(analysiscuts);
Int_t nptbins = fAnalysisCuts->GetNPtBins();
Float_t *ptlim = fAnalysisCuts->GetPtBinLimits();
SetPtBins(nptbins, ptlim);
DefineOutput(1, TList::Class());
DefineOutput(2, TList::Class());
DefineOutput(3, AliNormalizationCounter::Class());
if(fCreateMLtree)
DefineOutput(4, TTree::Class());
}
//________________________________________________________________________
AliAnalysisTaskSEDs::~AliAnalysisTaskSEDs()
{
// Destructor
if (fOutput && !fOutput->IsOwner())
{
delete fHistNEvents;
delete fHistAllV0multNTPCout;
delete fHistSelV0multNTPCout;
delete fCosPHist3D;
delete fCosPxyHist3D;
delete fDLenHist3D;
delete fDLenxyHist3D;
delete fNDLenxyHist3D;
delete fSigVertHist3D;
delete fDCAHist3D;
delete fNormIPHist3D;
delete fCosPiDsHist3D;
delete fCosPiKPhiHist3D;
delete fPtProng0Hist3D;
delete fPtProng1Hist3D;
delete fPtProng2Hist3D;
for (Int_t iHist = 0; iHist < 4; iHist++)
{
delete fChanHist[iHist];
}
for (Int_t iHist = 0; iHist < 4 * fNPtBins; iHist++)
{
delete fMassHist[iHist];
delete fMassHistPhi[iHist];
delete fMassHistK0st[iHist];
delete fCosPHist[iHist];
delete fDLenHist[iHist];
delete fSumd02Hist[iHist];
delete fSigVertHist[iHist];
delete fPtMaxHist[iHist];
delete fPtCandHist[iHist];
delete fDCAHist[iHist];
delete fPtProng0Hist[iHist];
delete fPtProng1Hist[iHist];
delete fPtProng2Hist[iHist];
delete fDalitz[iHist];
delete fDalitzPhi[iHist];
delete fDalitzK0st[iHist];
}
for (Int_t iPt = 0; iPt < fNPtBins; iPt++)
{
delete fMassHistKK[iPt];
delete fMassHistKpi[iPt];
delete fMassHistKKVsKKpi[iPt];
delete fMassHistKpiVsKKpi[iPt];
delete fMassRotBkgHistPhi[iPt];
delete fMassLSBkgHistPhi[iPt];
delete fMassRSBkgHistPhi[iPt];
}
delete fPtVsMass;
delete fPtVsMassPhi;
delete fPtVsMassK0st;
delete fYVsPt;
delete fYVsPtSig;
for (Int_t iHist = 0; iHist < 3; iHist++)
{
delete fHistCentrality[iHist];
delete fHistCentralityMult[iHist];
}
delete fnSparse;
if (fFillImpParSparse)
{
delete fImpParSparse;
for (Int_t iHist = 0; iHist < 4; iHist++)
delete fImpParSparseMC[iHist];
}
for (Int_t iHist = 0; iHist < 7; iHist++)
{
delete fnSparseMC[iHist];
}
if (fFillSparseDplus)
{
for (Int_t iHist = 0; iHist < 4; iHist++)
delete fnSparseMCDplus[iHist];
}
if(fApplyML && fEnablePIDMLSparses)
{
for (Int_t iHist=0; iHist<2; iHist++)
{
delete fnSparseNsigmaPIDVsML[iHist];
}
}
}
delete fOutput;
delete fListCuts;
delete fCounter;
delete fAnalysisCuts;
if(fApplyML && fMLResponse)
delete fMLResponse;
if(fCreateMLtree && fMLhandler)
delete fMLhandler;
}
//________________________________________________________________________
void AliAnalysisTaskSEDs::Init()
{
/// Initialization
if (fDebug > 1)
printf("AnalysisTaskSEDs::Init() \n");
fListCuts = new TList();
fListCuts->SetOwner();
fListCuts->SetName("CutObjects");
AliRDHFCutsDstoKKpi *analysis = new AliRDHFCutsDstoKKpi(*fAnalysisCuts);
analysis->SetName("AnalysisCuts");
fListCuts->Add(analysis);
PostData(2, fListCuts);
return;
}
//________________________________________________________________________
void AliAnalysisTaskSEDs::UserCreateOutputObjects()
{
/// Create the output container
//
if (fDebug > 1)
printf("AnalysisTaskSEDs::UserCreateOutputObjects() \n");
// Several histograms are more conveniently managed in a TList
fOutput = new TList();
fOutput->SetOwner();
fOutput->SetName("OutputHistos");
fHistNEvents = new TH1F("hNEvents", "number of events ", 16, -0.5, 15.5);
fHistNEvents->GetXaxis()->SetBinLabel(1, "nEventsRead");
fHistNEvents->GetXaxis()->SetBinLabel(2, "nEvents Matched dAOD");
fHistNEvents->GetXaxis()->SetBinLabel(3, "nEvents Mismatched dAOD");
fHistNEvents->GetXaxis()->SetBinLabel(4, "nEventsAnal");
fHistNEvents->GetXaxis()->SetBinLabel(5, "n. passing IsEvSelected");
fHistNEvents->GetXaxis()->SetBinLabel(6, "n. rejected due to trigger");
fHistNEvents->GetXaxis()->SetBinLabel(7, "n. rejected due to not reco vertex");
fHistNEvents->GetXaxis()->SetBinLabel(8, "n. rejected for contr vertex");
fHistNEvents->GetXaxis()->SetBinLabel(9, "n. rejected for vertex out of accept");
fHistNEvents->GetXaxis()->SetBinLabel(10, "n. rejected for pileup events");
fHistNEvents->GetXaxis()->SetBinLabel(11, "no. of out centrality events");
fHistNEvents->GetXaxis()->SetBinLabel(12, "no. of 3 prong candidates");
fHistNEvents->GetXaxis()->SetBinLabel(13, "no. of Ds after filtering cuts");
fHistNEvents->GetXaxis()->SetBinLabel(14, "no. of Ds after selection cuts");
fHistNEvents->GetXaxis()->SetBinLabel(15, "no. of not on-the-fly rec Ds");
fHistNEvents->GetXaxis()->SetBinLabel(16, "no. of Ds rejected by preselect");
fHistNEvents->GetXaxis()->SetNdivisions(1, kFALSE);
fHistNEvents->SetMinimum(0);
fOutput->Add(fHistNEvents);
fHistCentrality[0] = new TH1F("hCentr", "centrality", 10000, 0., 100.);
fHistCentrality[1] = new TH1F("hCentr(selectedCent)", "centrality(selectedCent)", 10000, 0., 100.);
fHistCentrality[2] = new TH1F("hCentr(OutofCent)", "centrality(OutofCent)", 10000, 0., 100.);
fHistCentralityMult[0] = new TH2F("hCentrMult", "centrality vs mult", 100, 0.5, 30000.5, 40, 0., 100.);
fHistCentralityMult[1] = new TH2F("hCentrMult(selectedCent)", "centrality vs mult(selectedCent)", 100, 0.5, 30000.5, 40, 0., 100.);
fHistCentralityMult[2] = new TH2F("hCentrMult(OutofCent)", "centrality vs mult(OutofCent)", 100, 0.5, 30000.5, 40, 0., 100.);
for (Int_t iHist = 0; iHist < 3; iHist++)
{
fOutput->Add(fHistCentrality[iHist]);
fOutput->Add(fHistCentralityMult[iHist]);
}
if (fDoCutV0multTPCout)
{
fHistAllV0multNTPCout = new TH2F("HistAllV0multNTPCout", "V0mult vs # TPCout (all) ;V0mult ;# TPCout", 1000, 0., 40000, 1000, 0, 30000);
fHistSelV0multNTPCout = new TH2F("HistSelV0multNTPCout", "V0mult vs # TPCout (sel) ;V0mult ;# TPCout", 1000, 0., 40000, 1000, 0, 30000);
fOutput->Add(fHistAllV0multNTPCout);
fOutput->Add(fHistSelV0multNTPCout);
}
Double_t massDs = TDatabasePDG::Instance()->GetParticle(431)->Mass();
Int_t nInvMassBins = (Int_t)(fMassRange / fMassBinSize + 0.5);
if (nInvMassBins % 2 == 1)
nInvMassBins++;
Double_t minMass = massDs - 0.5 * nInvMassBins * fMassBinSize;
Double_t maxMass = massDs + 0.5 * nInvMassBins * fMassBinSize;
fminMass = minMass;
fmaxMass = maxMass;
TString hisname;
TString htype;
Int_t index;
for (Int_t iType = 0; iType < 4; iType++)
{
for (Int_t iPt = 0; iPt < fNPtBins; iPt++)
{
if (iType == 0)
{
htype = "All";
index = GetHistoIndex(iPt);
}
else if (iType == 1)
{
htype = "Sig";
index = GetSignalHistoIndex(iPt);
}
else if (iType == 2)
{
htype = "Bkg";
index = GetBackgroundHistoIndex(iPt);
}
else
{
htype = "ReflSig";
index = GetReflSignalHistoIndex(iPt);
}
hisname.Form("hMass%sPt%d", htype.Data(), iPt);
fMassHist[index] = new TH1F(hisname.Data(), hisname.Data(), nInvMassBins, minMass, maxMass);
fMassHist[index]->Sumw2();
hisname.Form("hMass%sPt%dphi", htype.Data(), iPt);
fMassHistPhi[index] = new TH1F(hisname.Data(), hisname.Data(), nInvMassBins, minMass, maxMass);
fMassHistPhi[index]->Sumw2();
hisname.Form("hMass%sPt%dk0st", htype.Data(), iPt);
fMassHistK0st[index] = new TH1F(hisname.Data(), hisname.Data(), nInvMassBins, minMass, maxMass);
fMassHistK0st[index]->Sumw2();
hisname.Form("hCosP%sPt%d", htype.Data(), iPt);
fCosPHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0.5, 1.);
hisname.Form("hCosPxy%sPt%d", htype.Data(), iPt);
fCosPxyHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0.5, 1.);
hisname.Form("hDLen%sPt%d", htype.Data(), iPt);
fDLenHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0., 0.5);
hisname.Form("hDLenxy%sPt%d", htype.Data(), iPt);
fDLenxyHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0., 0.5);
hisname.Form("hNDLenxy%sPt%d", htype.Data(), iPt);
fNDLenxyHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0., 11.);
hisname.Form("hSumd02%sPt%d", htype.Data(), iPt);
fSumd02Hist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0., 1.);
hisname.Form("hSigVert%sPt%d", htype.Data(), iPt);
fSigVertHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0., 0.1);
hisname.Form("hPtMax%sPt%d", htype.Data(), iPt);
fPtMaxHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0.5, 20.);
hisname.Form("hPtCand%sPt%d", htype.Data(), iPt);
fPtCandHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0.5, 20.);
hisname.Form("hDCA%sPt%d", htype.Data(), iPt);
fDCAHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0., 0.1);
hisname.Form("hNormIP%sPt%d", htype.Data(), iPt);
fNormIPHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0., 6.);
hisname.Form("hCosPiDs%sPt%d", htype.Data(), iPt);
fCosPiDsHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0.5, 1.);
hisname.Form("hCosPiKPhi%sPt%d", htype.Data(), iPt);
fCosPiKPhiHist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0., 0.5);
hisname.Form("hPtProng0%sPt%d", htype.Data(), iPt);
fPtProng0Hist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0.0, 20.);
hisname.Form("hPtProng1%sPt%d", htype.Data(), iPt);
fPtProng1Hist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0.0, 20.);
hisname.Form("hPtProng2%sPt%d", htype.Data(), iPt);
fPtProng2Hist[index] = new TH1F(hisname.Data(), hisname.Data(), 100, 0.0, 20.);
hisname.Form("hDalitz%sPt%d", htype.Data(), iPt);
fDalitz[index] = new TH2F(hisname.Data(), hisname.Data(), 100, 0., 2., 100, 0., 2.);
hisname.Form("hDalitz%sPt%dphi", htype.Data(), iPt);
fDalitzPhi[index] = new TH2F(hisname.Data(), hisname.Data(), 100, 0., 2., 100, 0., 2.);
hisname.Form("hDalitz%sPt%dk0st", htype.Data(), iPt);
fDalitzK0st[index] = new TH2F(hisname.Data(), hisname.Data(), 100, 0., 2., 100, 0., 2.);
}
}
for (Int_t iHist = 0; iHist < 4 * fNPtBins; iHist++)
{
fOutput->Add(fMassHist[iHist]);
fOutput->Add(fMassHistPhi[iHist]);
fOutput->Add(fMassHistK0st[iHist]);
fOutput->Add(fPtCandHist[iHist]);
if (fDoCutVarHistos)
{
fOutput->Add(fCosPHist[iHist]);
fOutput->Add(fCosPxyHist[iHist]);
fOutput->Add(fDLenHist[iHist]);
fOutput->Add(fDLenxyHist[iHist]);
fOutput->Add(fNDLenxyHist[iHist]);
fOutput->Add(fSumd02Hist[iHist]);
fOutput->Add(fSigVertHist[iHist]);
fOutput->Add(fPtMaxHist[iHist]);
fOutput->Add(fDCAHist[iHist]);
fOutput->Add(fNormIPHist[iHist]);
fOutput->Add(fCosPiDsHist[iHist]);
fOutput->Add(fCosPiKPhiHist[iHist]);
fOutput->Add(fPtProng0Hist[iHist]);
fOutput->Add(fPtProng1Hist[iHist]);
fOutput->Add(fPtProng2Hist[iHist]);
fOutput->Add(fDalitz[iHist]);
fOutput->Add(fDalitzPhi[iHist]);
fOutput->Add(fDalitzK0st[iHist]);
}
}
fChanHist[0] = new TH1F("hChanAll", "KKpi and piKK candidates", 64, -0.5, 63.5);
fChanHist[1] = new TH1F("hChanSig", "KKpi and piKK candidates", 64, -0.5, 63.5);
fChanHist[2] = new TH1F("hChanBkg", "KKpi and piKK candidates", 64, -0.5, 63.5);
fChanHist[3] = new TH1F("hChanReflSig", "KKpi and piKK candidates", 64, -0.5, 63.5);
for (Int_t iHist = 0; iHist < 4; iHist++)
{
fChanHist[iHist]->SetMinimum(0);
fOutput->Add(fChanHist[iHist]);
}
Int_t nPtBins3D=(Int_t)fPtLimits[fNPtBins];
fCosPHist3D = new TH3F("fCosPHist3D", "CosP vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0.5, 1.);
fCosPxyHist3D = new TH3F("fCosPxyHist3D", "CosPxy vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0.5, 1.);
fDLenHist3D = new TH3F("fDLenHist3D", "DLen vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0., 0.5);
fDLenxyHist3D = new TH3F("fDLenxyHist3D", "DLenxy vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0., 0.5);
fNDLenxyHist3D = new TH3F("fNDLenxyHist3D", "NDLenxy vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0., 11.);
fSigVertHist3D = new TH3F("fSigVertHist3D", "SigVert vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0., 0.1);
fDCAHist3D = new TH3F("fDCAHist3D", "DCA vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0., 0.1);
fNormIPHist3D = new TH3F("fNormIPHist3D", "nIP vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0., 6.);
fCosPiDsHist3D = new TH3F("fCosPiDsHist3D", "CosPiDs vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0.5, 1.);
fCosPiKPhiHist3D = new TH3F("fCosPiKPhiHist3D", "CosPiKPhi vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0., 0.5);
fPtProng0Hist3D = new TH3F("fPtProng0Hist3D", "Pt prong0 vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0.0, 20.);
fPtProng1Hist3D = new TH3F("fPtProng1Hist3D", "Pt prong1 vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0.0, 20.);
fPtProng2Hist3D = new TH3F("fPtProng2Hist3D", "Pt prong2 vs Ds mass", nInvMassBins, minMass, maxMass, nPtBins3D, 0., fPtLimits[fNPtBins], 100, 0.0, 20.);
if (!fReadMC && fDoCutVarHistos)
{
fOutput->Add(fCosPHist3D);
fOutput->Add(fCosPxyHist3D);
fOutput->Add(fDLenHist3D);
fOutput->Add(fDLenxyHist3D);
fOutput->Add(fNDLenxyHist3D);
fOutput->Add(fSigVertHist3D);
fOutput->Add(fDCAHist3D);
fOutput->Add(fNormIPHist3D);
fOutput->Add(fCosPiDsHist3D);
fOutput->Add(fCosPiKPhiHist3D);
fOutput->Add(fPtProng0Hist3D);
fOutput->Add(fPtProng1Hist3D);
fOutput->Add(fPtProng2Hist3D);
}
Int_t scalptb=10;
if(fCustomPtBinWidth && fPtBinWidth>0.) scalptb=TMath::Nint(1./fPtBinWidth);
Int_t nPtBins2D=(Int_t)fPtLimits[fNPtBins]*scalptb;
fPtVsMass = new TH2F("hPtVsMass", "PtVsMass (prod. cuts)", nInvMassBins, minMass, maxMass, nPtBins2D, 0., fPtLimits[fNPtBins]);
fPtVsMassPhi = new TH2F("hPtVsMassPhi", "PtVsMass (phi selection)", nInvMassBins, minMass, maxMass, nPtBins2D, 0., fPtLimits[fNPtBins]);
fPtVsMassK0st = new TH2F("hPtVsMassK0st", "PtVsMass (K0* selection)", nInvMassBins, minMass, maxMass, nPtBins2D, 0., fPtLimits[fNPtBins]);
fYVsPt = new TH2F("hYVsPt", "YvsPt (prod. cuts)", nPtBins2D, 0., fPtLimits[fNPtBins], 80, -2., 2.);
fYVsPtSig = new TH2F("hYVsPtSig", "YvsPt (MC, only sig., prod. cuts)", nPtBins2D, 0., fPtLimits[fNPtBins], 80, -2., 2.);
for (Int_t iPt = 0; iPt < fNPtBins; iPt++)
{
hisname.Form("hMassKKPt%d", iPt);
fMassHistKK[iPt] = new TH1F(hisname.Data(), hisname.Data(), 200, 0.95, 1.35);
fMassHistKK[iPt]->Sumw2();
fOutput->Add(fMassHistKK[iPt]);
hisname.Form("hMassKpiPt%d", iPt);
fMassHistKpi[iPt] = new TH1F(hisname.Data(), hisname.Data(), 200, 0.7, 1.1);
fMassHistKpi[iPt]->Sumw2();
fOutput->Add(fMassHistKpi[iPt]);
hisname.Form("hMassKKVsKKpiPt%d", iPt);
fMassHistKKVsKKpi[iPt] = new TH2F(hisname.Data(), hisname.Data(), nInvMassBins, minMass, maxMass, 200, 0.95, 1.15);
fOutput->Add(fMassHistKKVsKKpi[iPt]);
hisname.Form("hMassKpiVsKKpiPt%d", iPt);
fMassHistKpiVsKKpi[iPt] = new TH2F(hisname.Data(), hisname.Data(), nInvMassBins, minMass, maxMass, 200, 0.7, 1.1);
fOutput->Add(fMassHistKpiVsKKpi[iPt]);
if (fDoRotBkg)
{
hisname.Form("hMassAllPt%dphi_RotBkg", iPt);
fMassRotBkgHistPhi[iPt] = new TH1F(hisname.Data(), hisname.Data(), nInvMassBins, minMass, maxMass);
fMassRotBkgHistPhi[iPt]->Sumw2();
fOutput->Add(fMassRotBkgHistPhi[iPt]);
}
if (fDoBkgPhiSB)
{
hisname.Form("fMassLSBkgHistPhiPt%d", iPt);
fMassLSBkgHistPhi[iPt] = new TH1F(hisname.Data(), hisname.Data(), nInvMassBins, minMass, maxMass);
fMassLSBkgHistPhi[iPt]->Sumw2();
fOutput->Add(fMassLSBkgHistPhi[iPt]);
hisname.Form("fMassRSBkgHistPhiPt%d", iPt);
fMassRSBkgHistPhi[iPt] = new TH1F(hisname.Data(), hisname.Data(), nInvMassBins, minMass, maxMass);
fMassRSBkgHistPhi[iPt]->Sumw2();
fOutput->Add(fMassRSBkgHistPhi[iPt]);
}
}
fOutput->Add(fPtVsMass);
fOutput->Add(fPtVsMassPhi);
fOutput->Add(fPtVsMassK0st);
fOutput->Add(fYVsPt);
fOutput->Add(fYVsPtSig);
//Sparses for Cut variation
if (fFillSparse)
CreateCutVarsAndEffSparses();
//Sparses for Impact parameter fits
if (fFillImpParSparse)
CreateImpactParameterSparses();
//Counter for Normalization
fCounter = new AliNormalizationCounter("NormalizationCounter");
fCounter->Init();
PostData(3, fCounter);
//Loading of ML models
if(fApplyML) {
fMLResponse = new AliHFMLResponseDstoKKpi("DstoKKpiMLResponse", "DstoKKpiMLResponse", fConfigPath.Data());
fMLResponse->MLResponseInit();
if(fEnablePIDMLSparses)
CreatePIDMLSparses();
}
//Create ML tree
if(fCreateMLtree) {
OpenFile(4);
fMLhandler = new AliHFMLVarHandlerDstoKKpi(fPIDopt, AliHFMLVarHandlerDstoKKpi::kDeltaMassKKPhi);
fMLhandler->SetAddSingleTrackVars(fAddSingleTrackVar);
if(fReadMC) {
if(fFillOnlySignal)
fMLhandler->SetFillOnlySignal();
fMLhandler->SetFillBeautyMotherPt();
fMLhandler->SetFillBeautyMotherPDG();
}
fMLtree = fMLhandler->BuildTree("treeMLDs", "treeMLDs");
fMLtree->SetMaxVirtualSize(1.e+8);
PostData(4, fMLtree);
}
//Set seed of gRandom
if(fCreateMLtree && fEnableEvtSampling)
gRandom->SetSeed(fSeedSampling);
PostData(1, fOutput);
return;
}
//________________________________________________________________________
void AliAnalysisTaskSEDs::UserExec(Option_t * /*option*/)
{
/// Ds selection for current event, fill mass histos and selection variable histo
/// separate signal and backgound if fReadMC is activated
if(fCreateMLtree && fEnableEvtSampling && gRandom->Rndm() > fFracEvtToKeep)
return;
AliAODEvent *aod = dynamic_cast<AliAODEvent *>(InputEvent());
fHistNEvents->Fill(0); // all events
if (fAODProtection >= 0)
{
// Protection against different number of events in the AOD and deltaAOD
// In case of discrepancy the event is rejected.
Int_t matchingAODdeltaAODlevel = AliRDHFCuts::CheckMatchingAODdeltaAODevents();
if (matchingAODdeltaAODlevel < 0 || (matchingAODdeltaAODlevel == 0 && fAODProtection == 1))
{
// AOD/deltaAOD trees have different number of entries || TProcessID do not match while it was required
fHistNEvents->Fill(2);
return;
}
fHistNEvents->Fill(1);
}
TClonesArray *array3Prong = 0;
if (!aod && AODEvent() && IsStandardAOD())
{
// In case there is an AOD handler writing a standard AOD, use the AOD
// event in memory rather than the input (ESD) event.
aod = dynamic_cast<AliAODEvent *>(AODEvent());
// in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
// have to taken from the AOD event hold by the AliAODExtension
AliAODHandler *aodHandler = (AliAODHandler *)((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
if (aodHandler->GetExtensions())
{
AliAODExtension *ext = (AliAODExtension *)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
AliAODEvent *aodFromExt = ext->GetAOD();
array3Prong = (TClonesArray *)aodFromExt->GetList()->FindObject("Charm3Prong");
}
}
else if (aod)
{
array3Prong = (TClonesArray *)aod->GetList()->FindObject("Charm3Prong");
}
if (!aod || !array3Prong)
{
printf("AliAnalysisTaskSEDs::UserExec: Charm3Prong branch not found!\n");
return;
}
// fix for temporary bug in ESDfilter
// the AODs with null vertex pointer didn't pass the PhysSel
if (!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField()) < 0.001) return;
fHistNEvents->Fill(3); // count event
// Post the data already here
PostData(1, fOutput);
fCounter->StoreEvent(aod, fAnalysisCuts, fReadMC);
Bool_t isEvSel = fAnalysisCuts->IsEventSelected(aod);
Float_t ntracks = aod->GetNumberOfTracks();
Float_t evCentr = fAnalysisCuts->GetCentrality(aod);
fHistCentrality[0]->Fill(evCentr);
fHistCentralityMult[0]->Fill(ntracks, evCentr);
if (fAnalysisCuts->IsEventRejectedDueToTrigger())
fHistNEvents->Fill(5);
if (fAnalysisCuts->IsEventRejectedDueToNotRecoVertex())
fHistNEvents->Fill(6);
if (fAnalysisCuts->IsEventRejectedDueToVertexContributors())
fHistNEvents->Fill(7);
if (fAnalysisCuts->IsEventRejectedDueToZVertexOutsideFiducialRegion())
fHistNEvents->Fill(8);
if (fAnalysisCuts->IsEventRejectedDueToPileup())
fHistNEvents->Fill(9);
if (fAnalysisCuts->IsEventRejectedDueToCentrality())
{
fHistNEvents->Fill(10);
fHistCentrality[2]->Fill(evCentr);
fHistCentralityMult[2]->Fill(ntracks, evCentr);
}
// no physics selection can be applied for upgrade studies
if(fSystem == kUpgr && fAnalysisCuts->IsEventRejectedDuePhysicsSelection())
isEvSel = kTRUE;
Int_t runNumber = aod->GetRunNumber();
TClonesArray *arrayMC = 0;
AliAODMCHeader *mcHeader = 0;
// AOD primary vertex
AliAODVertex *vtx1 = (AliAODVertex *)aod->GetPrimaryVertex();
// vtx1->Print();
// load MC particles
if (fReadMC)
{
arrayMC = (TClonesArray *)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
if (!arrayMC)
{
printf("AliAnalysisTaskSEDs::UserExec: MC particles branch not found!\n");
return;
}
// load MC header
mcHeader = (AliAODMCHeader *)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
if (!mcHeader)
{
printf("AliAnalysisTaskSEDs::UserExec: MC header branch not found!\n");
return;
}
}
if (fReadMC && fFillSparse)
{
if (aod->GetTriggerMask() == 0 && (runNumber >= 195344 && runNumber <= 195677))
// protection for events with empty trigger mask in p-Pb
return;
if (fAnalysisCuts->GetUseCentrality() > 0 && fAnalysisCuts->IsEventSelectedInCentrality(aod) != 0)
// events not passing the centrality selection can be removed immediately.
return;
FillMCGenAccHistos(arrayMC, mcHeader);
}
if (!isEvSel) return;
fHistNEvents->Fill(4);
fHistCentrality[1]->Fill(evCentr);
fHistCentralityMult[1]->Fill(ntracks, evCentr);
if (fDoCutV0multTPCout)
{
//cut on V0mult. vs #tracks kTPCout
Float_t V0mult = 0.;
AliAODVZERO *aodVZERO = (AliAODVZERO *)aod->GetVZEROData();
if (aodVZERO)
{
for (int ich = 0; ich < 64; ich++)
V0mult += aodVZERO->GetMultiplicity(ich);
}
Int_t nTPCout = 0;
for (Int_t i = 0; i < aod->GetNumberOfTracks(); ++i)
{
AliVTrack *track = aod->GetTrack(i);
if (!track)
continue;
if ((track->GetStatus() & AliVTrack::kTPCout))
nTPCout++;
}
fHistAllV0multNTPCout->Fill(V0mult, nTPCout);
if (nTPCout > (0.32 * V0mult + 750))
return;
else
fHistSelV0multNTPCout->Fill(V0mult, nTPCout);
}
Int_t n3Prong = array3Prong->GetEntriesFast();
if (fDebug > 1)
printf("Number of Ds->KKpi: %d\n", n3Prong);
Int_t pdgDstoKKpi[3] = {321, 321, 211};
Int_t pdgDplustoKpipi[3] = {321, 211, 211};
Int_t nSelected = 0;
Int_t nFiltered = 0;
Double_t massPhi = TDatabasePDG::Instance()->GetParticle(333)->Mass();
// vHF object is needed to call the method that refills the missing info of the candidates
// if they have been deleted in dAOD reconstruction phase
// in order to reduce the size of the file
AliAnalysisVertexingHF vHF = AliAnalysisVertexingHF();
for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++)
{
AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong *)array3Prong->UncheckedAt(i3Prong);
fHistNEvents->Fill(11);
if (fUseSelectionBit && !(d->HasSelectionBit(AliRDHFCuts::kDsCuts))) continue;
nFiltered++;
fHistNEvents->Fill(12);
TObjArray arrTracks(3);
for(Int_t ipr=0;ipr<3;ipr++){
AliAODTrack *tr=vHF.GetProng(aod,d,ipr);
arrTracks.AddAt(tr,ipr);
}
if(!fAnalysisCuts->PreSelect(arrTracks)){
fHistNEvents->Fill(15);
continue;
}
if (!(vHF.FillRecoCand(aod, d)))
{ ////Fill the data members of the candidate only if they are empty.
fHistNEvents->Fill(14); //monitor how often this fails
continue;
}
Bool_t unsetvtx = kFALSE;
if (!d->GetOwnPrimaryVtx())
{
d->SetOwnPrimaryVtx(vtx1);
unsetvtx = kTRUE;
// NOTE: the ow primary vertex should be unset, otherwise there is a memory leak
// Pay attention if you use continue inside this loop!!!
}
Bool_t recVtx = kFALSE;
AliAODVertex *origownvtx = nullptr;
Double_t ptCand = d->Pt();
Int_t iPtBin = TMath::BinarySearch(fNPtBins, fPtLimits, (Float_t)ptCand);
Double_t rapid = d->YDs();
fYVsPt->Fill(ptCand, rapid);
Bool_t isFidAcc = fAnalysisCuts->IsInFiducialAcceptance(ptCand, rapid);
Double_t massKK_KKpi = 0.;
Double_t massKK_piKK = 0.;
Double_t massKp = 0;
Double_t masspK = 0;
Double_t invMass_KKpi = 0.;
Double_t invMass_piKK = 0.;
if (fCreateMLtree && fEnableCandSampling) // apply sampling in pt
{
Double_t pseudoRand = ptCand * 1000. - (long)(ptCand * 1000);
if (pseudoRand > fFracCandToKeep && ptCand < fMaxCandPtSampling)
{
if (unsetvtx)
d->UnsetOwnPrimaryVtx();
continue;
}
}
if (!isFidAcc) // check if candidate is in acceptance
{
if (unsetvtx)
d->UnsetOwnPrimaryVtx();
continue;
}
Int_t retCodeAnalysisCuts = fAnalysisCuts->IsSelected(d, AliRDHFCuts::kAll, aod);
Int_t retCodeNoRes = retCodeAnalysisCuts;
Bool_t origRes = fAnalysisCuts->IsCutOnResonancesApplied();
if (origRes)
{
fAnalysisCuts->ApplyCutOnResonances(kFALSE);
retCodeNoRes = fAnalysisCuts->IsSelected(d, AliRDHFCuts::kAll, aod);
fAnalysisCuts->ApplyCutOnResonances(origRes);
}
if (retCodeNoRes & 1)
{ //KKpi
massKK_KKpi = d->InvMass2Prongs(0, 1, 321, 321);
massKp = d->InvMass2Prongs(1, 2, 321, 211);
invMass_KKpi = d->InvMassDsKKpi();
fMassHistKK[iPtBin]->Fill(massKK_KKpi);
fMassHistKpi[iPtBin]->Fill(massKp);
fMassHistKKVsKKpi[iPtBin]->Fill(invMass_KKpi, massKK_KKpi);
fMassHistKpiVsKKpi[iPtBin]->Fill(invMass_KKpi, massKp);
}
if (retCodeNoRes & 2)
{ //piKK
massKK_piKK = d->InvMass2Prongs(1, 2, 321, 321);
masspK = d->InvMass2Prongs(0, 1, 211, 321);
invMass_piKK = d->InvMassDspiKK();
fMassHistKK[iPtBin]->Fill(massKK_piKK);
fMassHistKpi[iPtBin]->Fill(masspK);
fMassHistKKVsKKpi[iPtBin]->Fill(invMass_piKK, massKK_piKK);
fMassHistKpiVsKKpi[iPtBin]->Fill(invMass_piKK, masspK);
}
Int_t isKKpi = retCodeAnalysisCuts & 1;
Int_t ispiKK = retCodeAnalysisCuts & 2;
Int_t isPhiKKpi = retCodeAnalysisCuts & 4;
Int_t isPhipiKK = retCodeAnalysisCuts & 8;
Int_t isK0starKKpi = retCodeAnalysisCuts & 16;
Int_t isK0starpiKK = retCodeAnalysisCuts & 32;
if (retCodeAnalysisCuts <= 0)
{
if (unsetvtx)
d->UnsetOwnPrimaryVtx();
continue;
}
if (fAnalysisCuts->GetIsPrimaryWithoutDaughters())
{
if (d->GetOwnPrimaryVtx())
origownvtx = new AliAODVertex(*d->GetOwnPrimaryVtx());
if (fAnalysisCuts->RecalcOwnPrimaryVtx(d, aod))
recVtx = kTRUE;
else
fAnalysisCuts->CleanOwnPrimaryVtx(d, aod, origownvtx);
}
fHistNEvents->Fill(13);
nSelected++;
Int_t index = GetHistoIndex(iPtBin);
fPtCandHist[index]->Fill(ptCand);
Double_t weightKKpi = 1.;
Double_t weightpiKK = 1.;
if (fAnalysisCuts->GetPidOption() == AliRDHFCutsDstoKKpi::kBayesianWeights)
{
weightKKpi = fAnalysisCuts->GetWeightForKKpi();
weightpiKK = fAnalysisCuts->GetWeightForpiKK();
if (weightKKpi > 1. || weightKKpi < 0.)
weightKKpi = 0.;
if (weightpiKK > 1. || weightpiKK < 0.)
weightpiKK = 0.;
}
fChanHist[0]->Fill(retCodeAnalysisCuts);
const Int_t nProng = 3;
Int_t indexMCKKpi = -1;
Int_t indexMCpiKK = -1;
Int_t labDs = -1;
Int_t labDplus = -1;
Int_t labDplusToKpipi = -1;
Int_t pdgCode0 = -999;
AliAODMCParticle *partDs = nullptr;
Int_t orig = 0;
Int_t origWoQuark = 0;
Bool_t isCandInjected = kFALSE;
Float_t trueImpParDsFromB = 99999.;
Float_t ptB = -999.;
Int_t pdgBmother = 0, Borigin = -1;
if (fReadMC)
{
labDs = d->MatchToMC(431, arrayMC, nProng, pdgDstoKKpi);
if (labDs >= 0)
{
partDs = (AliAODMCParticle*)arrayMC->At(labDs);
Int_t labDau0 = ((AliAODTrack *)d->GetDaughter(0))->GetLabel();
AliAODMCParticle *p = (AliAODMCParticle *)arrayMC->UncheckedAt(TMath::Abs(labDau0));
pdgCode0 = TMath::Abs(p->GetPdgCode());
if (isKKpi)
{
if (pdgCode0 == 321)
{
indexMCKKpi = GetSignalHistoIndex(iPtBin);
fYVsPtSig->Fill(ptCand, rapid);
fChanHist[1]->Fill(retCodeAnalysisCuts);
}
else
{
indexMCKKpi = GetReflSignalHistoIndex(iPtBin);
fChanHist[3]->Fill(retCodeAnalysisCuts);
}
}
if (ispiKK)
{
if (pdgCode0 == 211)
{
indexMCpiKK = GetSignalHistoIndex(iPtBin);
fYVsPtSig->Fill(ptCand, rapid);
fChanHist[1]->Fill(retCodeAnalysisCuts);
}
else
{
indexMCpiKK = GetReflSignalHistoIndex(iPtBin);
fChanHist[3]->Fill(retCodeAnalysisCuts);
}
}
}
else
{
if(fKeepOnlyBkgFromHIJING) {
isCandInjected = AliVertexingHFUtils::IsCandidateInjected(d, mcHeader, arrayMC);
}
if(!isCandInjected) {
indexMCpiKK = GetBackgroundHistoIndex(iPtBin);
indexMCKKpi = GetBackgroundHistoIndex(iPtBin);
fChanHist[2]->Fill(retCodeAnalysisCuts);
orig=6;
}
labDplus = d->MatchToMC(411, arrayMC, nProng, pdgDstoKKpi);
if (labDplus >= 0)
{
partDs = (AliAODMCParticle*)arrayMC->At(labDplus);
Int_t labDau0 = ((AliAODTrack *)d->GetDaughter(0))->GetLabel();
AliAODMCParticle *p = (AliAODMCParticle *)arrayMC->UncheckedAt(TMath::Abs(labDau0));
pdgCode0 = TMath::Abs(p->GetPdgCode());
}
else
{
labDplusToKpipi = d->MatchToMC(411, arrayMC, nProng, pdgDplustoKpipi);
if (labDplusToKpipi >= 0)
partDs = (AliAODMCParticle*)arrayMC->At(labDplusToKpipi);
}
}
if(partDs){
orig = AliVertexingHFUtils::CheckOrigin(arrayMC,partDs,kTRUE);
origWoQuark = AliVertexingHFUtils::CheckOrigin(arrayMC,partDs,kFALSE);
if(orig == 5 || origWoQuark==5) {
ptB = AliVertexingHFUtils::GetBeautyMotherPtAndPDG(arrayMC,partDs,pdgBmother);
switch(TMath::Abs(pdgBmother))
{
case 511:
Borigin = 1;
break;
case 521:
Borigin = 2;
break;
case 531:
Borigin = 3;
break;
case 5122:
Borigin = 4;
break;
default:
Borigin = 5;
break;
}
}
}
}
if (isKKpi)
{
if (fDoRotBkg && TMath::Abs(massKK_KKpi - massPhi) <= fMaxDeltaPhiMass4Rot)
GenerateRotBkg(d, 1, iPtBin);
fMassHist[index]->Fill(invMass_KKpi, weightKKpi);
fPtVsMass->Fill(invMass_KKpi, ptCand, weightKKpi);
if (fDoBkgPhiSB && (0.010 < TMath::Abs(massKK_KKpi - massPhi)) && (TMath::Abs(massKK_KKpi - massPhi) < 0.030))
{
if (massKK_KKpi < massPhi)
fMassLSBkgHistPhi[iPtBin]->Fill(invMass_KKpi);
else
fMassRSBkgHistPhi[iPtBin]->Fill(invMass_KKpi);
}
if (isPhiKKpi)
{
fMassHistPhi[index]->Fill(invMass_KKpi, weightKKpi);
fPtVsMassPhi->Fill(invMass_KKpi, ptCand, weightKKpi);
}
if (isK0starKKpi)
{
fMassHistK0st[index]->Fill(invMass_KKpi, weightKKpi);
fPtVsMassK0st->Fill(invMass_KKpi, ptCand, weightKKpi);
}
if (fReadMC && indexMCKKpi != -1)
{
fMassHist[indexMCKKpi]->Fill(invMass_KKpi, weightKKpi);
if (isPhiKKpi)
fMassHistPhi[indexMCKKpi]->Fill(invMass_KKpi, weightKKpi);
if (isK0starKKpi)
fMassHistK0st[indexMCKKpi]->Fill(invMass_KKpi, weightKKpi);
}
}
if (ispiKK)
{
if (fDoRotBkg && TMath::Abs(massKK_piKK - massPhi) <= fMaxDeltaPhiMass4Rot)
GenerateRotBkg(d, 2, iPtBin);
fMassHist[index]->Fill(invMass_piKK, weightpiKK);
fPtVsMass->Fill(invMass_piKK, ptCand, weightpiKK);
if (fDoBkgPhiSB && (0.010 < TMath::Abs(massKK_piKK - massPhi)) && (TMath::Abs(massKK_piKK - massPhi) < 0.030))
{
if (massKK_piKK < massPhi)
fMassLSBkgHistPhi[iPtBin]->Fill(invMass_piKK);
else
fMassRSBkgHistPhi[iPtBin]->Fill(invMass_piKK);
}
if (isPhipiKK)
{
fMassHistPhi[index]->Fill(invMass_piKK, weightpiKK);
fPtVsMassPhi->Fill(invMass_piKK, ptCand, weightpiKK);