forked from alisw/AliPhysics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAliAnalysisTaskSEB0toDminuspi.cxx
More file actions
1698 lines (1363 loc) · 58 KB
/
Copy pathAliAnalysisTaskSEB0toDminuspi.cxx
File metadata and controls
1698 lines (1363 loc) · 58 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) 1998-2009, 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 *
* appeuear 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. *
**************************************************************************/
//
//
// Base class for B0 analysis
//
//
// Cuts arew centralized in AliRDHFCutsDplustoKpipi
//
#include <TSystem.h>
#include <TParticle.h>
#include <TH1I.h>
#include <TObjArray.h>
#include "TROOT.h"
#include <TDatabasePDG.h>
#include <AliAnalysisDataSlot.h>
#include <AliAnalysisDataContainer.h>
//#include "AliRDHFCutsDStartoKpipi.h"
#include "AliRDHFCutsDplustoKpipi.h"
#include "AliVertex.h"
#include "AliVVertex.h"
#include "AliESDVertex.h"
#include "AliVertexerTracks.h"
#include "AliMCEvent.h"
#include "AliAnalysisManager.h"
#include "AliAODMCHeader.h"
#include "AliAODHandler.h"
#include "AliLog.h"
#include "AliExternalTrackParam.h"
#include "AliNeutralTrackParam.h"
#include "AliAODVertex.h"
#include "AliAODRecoDecay.h"
#include "AliAODRecoDecayHF.h"
#include "AliAODRecoCascadeHF.h"
#include "AliAODRecoDecayHF2Prong.h"
#include "AliAODRecoDecayHF3Prong.h"
#include "AliAnalysisVertexingHF.h"
#include "AliESDtrack.h"
#include "AliAODMCParticle.h"
#include "AliNormalizationCounter.h"
#include "AliAODEvent.h"
#include "AliAnalysisTaskSEB0toDminuspi.h"
#include "AliVertexingHFUtils.h"
ClassImp(AliAnalysisTaskSEB0toDminuspi)
//__________________________________________________________________________
AliAnalysisTaskSEB0toDminuspi::AliAnalysisTaskSEB0toDminuspi():
AliAnalysisTaskSE(),
fEvents(0),
fOutput(0),
fOutputBins(0),
//fOutputPID(0),
fArrayB0(0),
//HISTO
fCEvents(0),
fB0InvMass(0),
fDplusInvMass(0),
fB0InvMass_PassCut1(0),
fB0InvMassMinusD_PassCut1(0),
fDplusInvMass_PassCut1(0),
fDplusInvMass_DplusMCmatch(0),
fDplusInvMass_MCmatch(0),
fBInvMass_MCmatch(0),
fBInvMass_MCmatch_PassCut1(0),
fB0InvMassMinusD_MCmatch_PassCut1(0),
fpiPt(0),
fpiEta(0),
fpiPhi(0),
fDplusPt(0),
fDplusEta(0),
fDplusPhi(0),
fDplusPointing(0),
fDplusDecayLength(0),
fDplusNormalizedDecayLength(0),
fDplusSigmaVert(0),
fBPt(0),
fBEta(0),
fBPhi(0),
fBPointing(0),
fBPointingXY(0),
fBDecayLength(0),
fBNormalizedDecayLength(0),
fDplusd0(0),
fpid0(0),
fproductd0(0),
fpiPt_MCmatch(0),
fpiEta_MCmatch(0),
fpiPhi_MCmatch(0),
fDplusPt_MCmatch(0),
fDplusEta_MCmatch(0),
fDplusPhi_MCmatch(0),
fDplusPointing_MCmatch(0),
fDplusDecayLength_MCmatch(0),
fDplusNormalizedDecayLength_MCmatch(0),
fDplusSigmaVert_MCmatch(0),
fBPt_MCmatch(0),
fBEta_MCmatch(0),
fBPhi_MCmatch(0),
fBPointing_MCmatch(0),
fBPointingXY_MCmatch(0),
fBDecayLength_MCmatch(0),
fBNormalizedDecayLength_MCmatch(0),
fDplusd0_MCmatch(0),
fpid0_MCmatch(0),
fproductd0_MCmatch(0),
fd0MMExpD(0),
fd0MMExpDMCmatch(0),
fd0MMExppi(0),
fd0MMExppiMCmatch(0),
fd0MMExpDDaughters(0),
fd0MMExpDDaughters_MCmatch(0),
fcosoa(0),
fcosoa_MCmatch(0),
fBDplusPt(0),
fBDplusPt_MCmatch(0),
fBpiPt(0),
fBpiPt_MCmatch(0),
fCounter(0),
fCutsDistr(kFALSE),
fListCuts(0),
fEtaSelection(0),
fReadMC(kFALSE),
fUseBit(kTRUE),
fUseQuarkTagInKine(kTRUE),
fRDCutsAnalysis(0),
kbins(kTRUE),
fInvertedTopomaticCutOnDDaughters(0),
fpTD(0),
fpTpi(0),
fprodd0(999),
fcosB(0),
fcosBXY(0),
fdlB(0),
fNdlBXY(0),
fTopomaticD(999),
fTopomaticpi(999),
fcosoaDpi(-999),
fDplusMassLowLimit(1.845),
fDplusMassUpLimit(1.895),
fBMassLowLimit(4.),
fBMassUpLimit(7),
fBinWidth(0.002)
//
// Default ctor
//
{
for(Int_t i=0; i<kMaxPtBins; i++){
fB0InvMassBin[i]=0;
fDplusInvMassBin[i]=0;
fB0InvMassBin_MCmatch[i]=0;
fB0InvMassBin_MCmatch_PassCut1[i]=0;
fDplusInvMassBin_PassCut1[i]=0;
fB0InvMassBin_MCmatch_PassCut1[i]=0;
fDplusInvMassBin_MCmatch[i]=0;
fB0InvMassBin_PassCut1[i]=0;
fDplusInvMassBin_PassCut1[i]=0;
fB0InvMassBinMinusD_PassCut1[i]=0;
fB0InvMassBinMinusD_MCmatch_PassCut1[i]=0;
fBDecayLengthBin[i]=0;
fBNormalizedDecayLengthBin[i]=0;
fBPointingBin[i]=0;
fBPointingXYBin[i]=0;
fDplusd0Bin[i]=0;
fBpTBin[i]=0;
fDpluspTBin[i]=0;
fproductd0Bin[i]=0;
fDplusPointingBin[i]=0;
fDplusDecayLengthBin[i]=0;
fDplusNormalizedDecayLengthBin[i]=0;
fDplusSigmaVertBin[i]=0;
fBDecayLengthBin_MCmatch[i]=0;
fBNormalizedDecayLengthBin_MCmatch[i]=0;
fBPointingBin_MCmatch[i]=0;
fBPointingXYBin_MCmatch[i]=0;
fDplusd0Bin_MCmatch[i]=0;
fBpTBin_MCmatch[i]=0;
fDpluspTBin_MCmatch[i]=0;
fproductd0Bin_MCmatch[i]=0;
fDplusPointingBin_MCmatch[i]=0;
fDplusDecayLengthBin_MCmatch[i]=0;
fDplusNormalizedDecayLengthBin_MCmatch[i]=0;
fDplusSigmaVertBin_MCmatch[i]=0;
fd0MMExpDBin[i]=0;
fd0MMExpDBin_MCmatch[i]=0;
fd0MMExppiBin[i]=0;
fd0MMExppiBin_MCmatch[i]=0;
fd0MMExpDDaughtersBin[i]=0;
fd0MMExpDDaughtersBin_MCmatch[i]=0;
fBDplusPtBin[i]=0;
fBDplusPtBin_MCmatch[i]=0;
fBpiPtBin[i]=0;
fBpiPtBin_MCmatch[i]=0;
}
}
//___________________________________________________________________________
AliAnalysisTaskSEB0toDminuspi::AliAnalysisTaskSEB0toDminuspi(const Char_t* name, AliRDHFCutsDplustoKpipi* dpluscutsana) :
AliAnalysisTaskSE(name),
fEvents(0),
fOutput(0),
fOutputBins(0),
//fOutputPID(0),
//fCuts(0),
fArrayB0(0),
//HISTO
fCEvents(0),
fB0InvMass(0),
fDplusInvMass(0),
fB0InvMass_PassCut1(0),
fB0InvMassMinusD_PassCut1(0),
fDplusInvMass_PassCut1(0),
fDplusInvMass_DplusMCmatch(0),
fBInvMass_MCmatch(0),
fBInvMass_MCmatch_PassCut1(0),
fB0InvMassMinusD_MCmatch_PassCut1(0),
fpiPt(0),
fpiEta(0),
fpiPhi(0),
fDplusPt(0),
fDplusEta(0),
fDplusPhi(0),
fDplusPointing(0),
fDplusDecayLength(0),
fDplusNormalizedDecayLength(0),
fDplusSigmaVert(0),
fBPt(0),
fBEta(0),
fBPhi(0),
fBPointing(0),
fBPointingXY(0),
fBDecayLength(0),
fBNormalizedDecayLength(0),
fDplusd0(0),
fpid0(0),
fproductd0(0),
fpiPt_MCmatch(0),
fpiEta_MCmatch(0),
fpiPhi_MCmatch(0),
fDplusPt_MCmatch(0),
fDplusEta_MCmatch(0),
fDplusPhi_MCmatch(0),
fDplusPointing_MCmatch(0),
fDplusDecayLength_MCmatch(0),
fDplusNormalizedDecayLength_MCmatch(0),
fDplusSigmaVert_MCmatch(0),
fBPt_MCmatch(0),
fBEta_MCmatch(0),
fBPhi_MCmatch(0),
fBPointing_MCmatch(0),
fBPointingXY_MCmatch(0),
fBDecayLength_MCmatch(0),
fBNormalizedDecayLength_MCmatch(0),
fDplusd0_MCmatch(0),
fpid0_MCmatch(0),
fproductd0_MCmatch(0),
fDplusInvMass_MCmatch(0),
fd0MMExpD(0),
fd0MMExpDMCmatch(0),
fd0MMExppi(0),
fd0MMExppiMCmatch(0),
fd0MMExpDDaughters(0),
fd0MMExpDDaughters_MCmatch(0),
fcosoa(0),
fcosoa_MCmatch(0),
fBDplusPt(0),
fBDplusPt_MCmatch(0),
fBpiPt(0),
fBpiPt_MCmatch(0),
fCounter(0),
fCutsDistr(kFALSE),
fListCuts(0),
fEtaSelection(0),
fReadMC(kFALSE),
fUseBit(kTRUE),
fUseQuarkTagInKine(kTRUE),
fRDCutsAnalysis(dpluscutsana),
kbins(kTRUE),
fInvertedTopomaticCutOnDDaughters(0),
fpTD(0),
fpTpi(0),
fprodd0(999),
fcosB(0),
fcosBXY(0),
fdlB(0),
fNdlBXY(0),
fTopomaticD(999),
fTopomaticpi(999),
fcosoaDpi(-999),
fDplusMassLowLimit(1.845),
fDplusMassUpLimit(1.895),
fBMassLowLimit(4),
fBMassUpLimit(7),
fBinWidth(0.002)
{
//standard contructor
for(Int_t i=0; i<kMaxPtBins; i++){
fB0InvMassBin[i]=0;
fDplusInvMassBin[i]=0;
fB0InvMassBin_MCmatch[i]=0;
fB0InvMassBin_MCmatch_PassCut1[i]=0;
fDplusInvMassBin_MCmatch[i]=0;
fB0InvMassBin_PassCut1[i]=0;
fDplusInvMassBin_PassCut1[i]=0;
fB0InvMassBinMinusD_PassCut1[i]=0;
fB0InvMassBinMinusD_MCmatch_PassCut1[i]=0;
fBDecayLengthBin[i]=0;
fBNormalizedDecayLengthBin[i]=0;
fBPointingBin[i]=0;
fBPointingXYBin[i]=0;
fDplusd0Bin[i]=0;
fBpTBin[i]=0;
fDpluspTBin[i]=0;
fproductd0Bin[i]=0;
fDplusPointingBin[i]=0;
fDplusDecayLengthBin[i]=0;
fDplusNormalizedDecayLengthBin[i]=0;
fDplusSigmaVertBin[i]=0;
fBDecayLengthBin_MCmatch[i]=0;
fBNormalizedDecayLengthBin_MCmatch[i]=0;
fBPointingBin_MCmatch[i]=0;
fBPointingXYBin_MCmatch[i]=0;
fDplusd0Bin_MCmatch[i]=0;
fBpTBin_MCmatch[i]=0;
fDpluspTBin_MCmatch[i]=0;
fproductd0Bin_MCmatch[i]=0;
fDplusPointingBin_MCmatch[i]=0;
fDplusDecayLengthBin_MCmatch[i]=0;
fDplusNormalizedDecayLengthBin_MCmatch[i]=0;
fDplusSigmaVertBin_MCmatch[i]=0;
fd0MMExpDBin[i]=0;
fd0MMExpDBin_MCmatch[i]=0;
fd0MMExppiBin[i]=0;
fd0MMExppiBin_MCmatch[i]=0;
fd0MMExpDDaughtersBin[i]=0;
fd0MMExpDDaughtersBin_MCmatch[i]=0;
fBDplusPtBin[i]=0;
fBDplusPtBin_MCmatch[i]=0;
fBpiPtBin[i]=0;
fBpiPtBin_MCmatch[i]=0;
}
//
// Constructor. Initialization of Inputs and Outputs
//
Info("AliAnalysisTaskSEB0toDminuspi","Calling Constructor");
fRDCutsAnalysis=dpluscutsana;
DefineOutput(1,TList::Class()); //conters
DefineOutput(2,TList::Class()); //All Entries output
DefineOutput(3,AliNormalizationCounter::Class()); // normalization
DefineOutput(4,AliRDHFCutsDplustoKpipi::Class()); //My private output
}
//_________________________________________________________________
void AliAnalysisTaskSEB0toDminuspi::SetBMassLimits(Float_t lowlimit, Float_t uplimit){
/// set invariant mass limits
if(uplimit>lowlimit)
{
Float_t bw=GetBinWidth();
fBMassUpLimit=uplimit;
fBMassLowLimit= lowlimit;
SetBinWidth(bw);
}
}
//________________________________________________________________
void AliAnalysisTaskSEB0toDminuspi::SetBinWidth(Float_t w){
Float_t width=w;
Int_t nbins=(Int_t)((fBMassUpLimit-fBMassLowLimit)/width+0.5);
Int_t missingbins=4-nbins%4;
nbins=nbins+missingbins;
width=(fBMassUpLimit-fBMassLowLimit)/nbins;
if(missingbins!=0){
printf("AliAnalysisTaskSEDplus::SetBinWidth: W-bin width of %f will produce histograms not rebinnable by 4. New width set to %f\n",w,width);
}
else{
if(fDebug>1) printf("AliAnalysisTaskSEDplus::SetBinWidth: width set to %f\n",width);
}
fBinWidth=width;
}
//_________________________________________________________________
Int_t AliAnalysisTaskSEB0toDminuspi::GetNBinsHistos(){
return (Int_t)((fBMassUpLimit-fBMassLowLimit)/fBinWidth+0.5);
}
//___________________________________________________________________________
AliAnalysisTaskSEB0toDminuspi::~AliAnalysisTaskSEB0toDminuspi() {
//
// destructor
//
Info("~AliAnalysisTaskSEB0toDminuspi","Calling Destructor");
delete fOutput;
delete fOutputBins;
//delete fOutputPID;
//delete fCuts;
delete fListCuts;
delete fRDCutsAnalysis;
//~fArrayB0();
//HISTOs
delete fCEvents;
delete fB0InvMass;
delete fDplusInvMass;
delete fB0InvMass_PassCut1;
delete fB0InvMassMinusD_PassCut1;
delete fDplusInvMass_PassCut1;
delete fDplusInvMass_DplusMCmatch;
delete fDplusInvMass_MCmatch;
delete fBInvMass_MCmatch;
delete fBInvMass_MCmatch_PassCut1;
delete fB0InvMassMinusD_MCmatch_PassCut1;
delete fpiPt;
delete fpiEta;
delete fpiPhi;
delete fDplusPt;
delete fDplusEta;
delete fDplusPhi;
delete fDplusPointing;
delete fDplusDecayLength;
delete fDplusNormalizedDecayLength;
delete fDplusSigmaVert;
delete fBPt;
delete fBEta;
delete fBPhi;
delete fBPointing;
delete fBPointingXY;
delete fBDecayLength;
delete fBNormalizedDecayLength;
delete fDplusd0;
delete fpid0;
delete fproductd0;
delete fpiPt_MCmatch;
delete fpiEta_MCmatch;
delete fpiPhi_MCmatch;
delete fDplusPt_MCmatch;
delete fDplusEta_MCmatch;
delete fDplusPhi_MCmatch;
delete fDplusPointing_MCmatch;
delete fDplusDecayLength_MCmatch;
delete fDplusNormalizedDecayLength_MCmatch;
delete fDplusSigmaVert_MCmatch;
delete fBPt_MCmatch;
delete fBEta_MCmatch;
delete fBPhi_MCmatch;
delete fBPointing_MCmatch;
delete fBPointingXY_MCmatch;
delete fBDecayLength_MCmatch;
delete fBNormalizedDecayLength_MCmatch;
delete fDplusd0_MCmatch;
delete fpid0_MCmatch;
delete fproductd0_MCmatch;
delete fd0MMExpD;
delete fd0MMExpDMCmatch;
delete fd0MMExppi;
delete fd0MMExppiMCmatch;
delete fd0MMExpDDaughters;
delete fd0MMExpDDaughters_MCmatch;
delete fcosoa;
delete fcosoa_MCmatch;
delete fBDplusPt;
delete fBDplusPt_MCmatch;
delete fBpiPt;
delete fBpiPt_MCmatch;
for(Int_t i=0; i<kMaxPtBins; i++){
delete fB0InvMassBin[i];
delete fDplusInvMassBin[i];
delete fB0InvMassBin_MCmatch[i];
delete fDplusInvMassBin_MCmatch[i];
delete fB0InvMassBin_PassCut1[i];
delete fB0InvMassBin_MCmatch_PassCut1[i];
delete fDplusInvMassBin_PassCut1[i];
delete fB0InvMassBinMinusD_PassCut1[i];
delete fB0InvMassBinMinusD_MCmatch_PassCut1[i];
delete fBDecayLengthBin[i];
delete fBNormalizedDecayLengthBin[i];
delete fBPointingBin[i];
delete fBPointingXYBin[i];
delete fDplusd0Bin[i];
delete fBpTBin[i];
delete fDpluspTBin[i];
delete fproductd0Bin[i];
delete fDplusPointingBin[i];
delete fDplusDecayLengthBin[i];
delete fDplusNormalizedDecayLengthBin[i];
delete fDplusSigmaVertBin[i];
delete fBDecayLengthBin_MCmatch[i];
delete fBNormalizedDecayLengthBin_MCmatch[i];
delete fBPointingBin_MCmatch[i];
delete fBPointingXYBin_MCmatch[i];
delete fDplusd0Bin_MCmatch[i];
delete fBpTBin_MCmatch[i];
delete fDpluspTBin_MCmatch[i];
delete fproductd0Bin_MCmatch[i];
delete fDplusPointingBin_MCmatch[i];
delete fDplusDecayLengthBin_MCmatch[i];
delete fDplusNormalizedDecayLengthBin_MCmatch[i];
delete fDplusSigmaVertBin_MCmatch[i];
delete fd0MMExpDBin[i];
delete fd0MMExpDBin_MCmatch[i];
delete fd0MMExppiBin[i];
delete fd0MMExppiBin_MCmatch[i];
delete fd0MMExpDDaughtersBin[i];
delete fd0MMExpDDaughtersBin_MCmatch[i];
delete fBDplusPtBin[i];
delete fBDplusPtBin_MCmatch[i];
delete fBpiPtBin[i];
delete fBpiPtBin_MCmatch[i];
}
}
//_________________________________________________
void AliAnalysisTaskSEB0toDminuspi::Init(){
//
// Initialization
//
if(fDebug > 1) printf("AnalysisTaskSEB0toDminuspi::Init() \n");
fListCuts=new TList();
fListCuts->SetOwner();
AliRDHFCutsDplustoKpipi *analysis = new AliRDHFCutsDplustoKpipi(*fRDCutsAnalysis);
analysis->SetName("AnalysisCuts");
fListCuts->Add(analysis);
PostData(4,fListCuts);
return;
}
//_________________________________________________
void AliAnalysisTaskSEB0toDminuspi::UserExec(Option_t *)
{
// user exec
if (!fInputEvent) {
Error("UserExec","NO EVENT FOUND!");
return;
}
fEvents++;
TClonesArray *array3Prong = 0;
AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(InputEvent());
Double_t bz= (Double_t)aodEvent->GetMagneticField();
fCEvents->Fill(1);
//Extract the Charm3Prong object from the AOD
if(!aodEvent && 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.
aodEvent = 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 {
array3Prong=(TClonesArray*)aodEvent->GetList()->FindObject("Charm3Prong");
}
// fix for temporary bug in ESDfilter
// the AODs with null vertex pointer didn't pass the PhysSel
if(!aodEvent->GetPrimaryVertex() || TMath::Abs(aodEvent->GetMagneticField())<0.001) return;
fCEvents->Fill(2);
if (array3Prong->GetEntriesFast()==0) return;
Bool_t isEvSel=fRDCutsAnalysis->IsEventSelected(aodEvent);
TClonesArray *mcArray = 0;
AliAODMCHeader *mcHeader=0;
if(fReadMC){
mcArray = (TClonesArray*)aodEvent->GetList()->FindObject(AliAODMCParticle::StdBranchName());
if(!mcArray) {
printf("AliAnalysisTaskSEDplus::UserExec: MC particles branch not found!\n");
return;
}
// load MC header
mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
if(!mcHeader) {
printf("AliAnalysisTaskSEDplus::UserExec: MC header branch not found!\n");
return;
}
}
// if(fReadMC && fStepMCAcc)FillMCAcceptanceHistos(arrayMC, mcHeader);
if(!isEvSel) return;
fCounter->StoreEvent(aodEvent,fRDCutsAnalysis,fReadMC);
fCEvents->Fill(3);
// counters for efficiencies
//Int_t icountReco = 0;
Int_t nOS=0;
//B0 and D+ prongs needed to MatchToMC and MatchToMCB method
Int_t pdgDgDplustoKpipi[3]={321,211,211};
Int_t pdgDgB0toDminuspi[2]={411,211};
// AOD primary vertex
AliAODVertex *primaryVertex = (AliAODVertex*)aodEvent->GetPrimaryVertex();
if(!primaryVertex) return;
if(primaryVertex->GetNContributors()<1) return;
if (!array3Prong){
AliInfo("Could not find array of Charm3Prong, skipping the event");
return;
}
else AliDebug(2, Form("Found %d vertices",array3Prong->GetEntriesFast()));
Int_t nSelectedAna =0;
Int_t nSelectedProd =0;
// loop over the D+ candidates and reconstruct the secondary vertex //
// //
//------------------------------------------------------------------//
Double_t xdummy=0.,ydummy=0.,dca,dcaB, e[2];
Double_t d0z0B[2],covd0z0B[3],d0B[2],d0errB[2],d0z0[2],covd0z0[3],d0[2],d0err[2];
AliAODRecoDecayHF2Prong *B0Dminuspi =0x0;
Int_t n3Prong = array3Prong->GetEntriesFast();
AliAODRecoDecayHF3Prong *theDminusparticle =0x0;
Int_t labDp=-1; //if Dminus is matched with MC
Int_t B0evtcount =0;
//Loop over the Dplus candidates
for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
// D+ candidate
theDminusparticle = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
fCEvents->Fill(4);
if(fUseBit && !theDminusparticle->HasSelectionBit(AliRDHFCuts::kDplusCuts)){
fCEvents->Fill(5);
continue;
}
Int_t passTopolAndPIDCuts=fRDCutsAnalysis->IsSelected(theDminusparticle,AliRDHFCuts::kAll,aodEvent);
if(!fRDCutsAnalysis->GetIsSelectedCuts()) {
fCEvents->Fill(6);
continue;
}
if(!fRDCutsAnalysis->GetIsSelectedPID()) {
fCEvents->Fill(6);
continue;
}
Double_t etaD=theDminusparticle->Eta();
Double_t phiD=theDminusparticle->Phi();
if(fEtaSelection!=0){
if(fEtaSelection==1 && etaD<0) continue;
if(fEtaSelection==-1 && etaD>0) continue;
}
Bool_t unsetvtx=kFALSE;
if(!theDminusparticle->GetOwnPrimaryVtx()){
theDminusparticle->SetOwnPrimaryVtx(primaryVertex);
unsetvtx=kTRUE;
}
Double_t ptCand = theDminusparticle->Pt();
Bool_t recVtx=kFALSE;
AliAODVertex *origownvtx=0x0;
if(fRDCutsAnalysis->GetIsPrimaryWithoutDaughters()){
if(theDminusparticle->GetOwnPrimaryVtx()) origownvtx = new AliAODVertex(*theDminusparticle->GetOwnPrimaryVtx());
if(fRDCutsAnalysis->RecalcOwnPrimaryVtx(theDminusparticle,aodEvent)) recVtx=kTRUE;
else fRDCutsAnalysis->CleanOwnPrimaryVtx(theDminusparticle,aodEvent,origownvtx);
}
Bool_t isPrimary=kFALSE;
Bool_t isFeeddown=kFALSE;
Float_t pdgCode=-2;
Float_t trueImpParXY=0.;
Double_t ptB=-1.5;
Int_t orig=0;
if(TMath::Abs(theDminusparticle->Charge())!=1){
fCEvents->Fill(7);
continue;
}
if(fReadMC){
labDp = theDminusparticle->MatchToMC(411,mcArray,3,pdgDgDplustoKpipi);
if(labDp>=0){
AliAODMCParticle *partDp = (AliAODMCParticle*)mcArray->At(labDp);
if(!partDp)continue;
orig=AliVertexingHFUtils::CheckOrigin(mcArray,partDp,fUseQuarkTagInKine);//Prompt = 4, FeedDown = 5
pdgCode=TMath::Abs(partDp->GetPdgCode());
if(orig==4){
isPrimary=kTRUE;
isFeeddown=kFALSE;
fCEvents->Fill(8);
AliAODMCParticle *partMomDp = (AliAODMCParticle*)mcArray->At(partDp->GetMother());
}else if(orig==5){
isPrimary=kFALSE;
isFeeddown=kTRUE;
AliAODMCParticle *partMomDp = (AliAODMCParticle*)mcArray->At(partDp->GetMother());
if(!partMomDp)continue;
fCEvents->Fill(9);
// AliAODMCParticle *partGranMomDp = (AliAODMCParticle*)mcArray->At(partMomDp->GetMother());
if(TMath::Abs(partMomDp->GetPdgCode())==511 && ((partMomDp->GetDaughterLast()-partMomDp->GetDaughterFirst())==1)){
AliAODMCParticle* B0Dau2=0;
if(labDp== (partMomDp->GetDaughterFirst()-1)) B0Dau2 = (AliAODMCParticle*)mcArray->At(partMomDp->GetDaughterLast()-1);
else if(labDp== (partMomDp->GetDaughterLast()-1)) B0Dau2 = (AliAODMCParticle*)mcArray->At(partMomDp->GetDaughterFirst()-1);
if (B0Dau2) {if(TMath::Abs(B0Dau2->GetPdgCode())==211) fCEvents->Fill(10);}
}
ptB=AliVertexingHFUtils::GetBeautyMotherPt(mcArray,partDp);
}else{
pdgCode=-3;
}
}
else{
pdgCode=-1;
}
}
Double_t invMass=theDminusparticle->InvMassDplus();
Double_t rapid=theDminusparticle->YDplus();
Bool_t isFidAcc=fRDCutsAnalysis->IsInFiducialAcceptance(ptCand,rapid);
if(!isFidAcc){fCEvents->Fill(19);}//continue;}
fCEvents->Fill(11);
if(recVtx)fRDCutsAnalysis->CleanOwnPrimaryVtx(theDminusparticle,aodEvent,origownvtx);
if(unsetvtx) theDminusparticle->UnsetOwnPrimaryVtx();
//D particle treated as an external track to create the pairs D-pion
AliExternalTrackParam *trackDminus = new AliExternalTrackParam();
trackDminus->CopyFromVTrack(theDminusparticle);
fDplusInvMass->Fill(theDminusparticle->InvMassDplus());
if(labDp>=0)fDplusInvMass_DplusMCmatch->Fill(theDminusparticle->InvMassDplus());
// get the ID of the D+ daughters
Double_t Id_prong0 = theDminusparticle->GetProngID(0);
Double_t Id_prong1 = theDminusparticle->GetProngID(1);
Double_t Id_prong2 = theDminusparticle->GetProngID(2);
//TObjArray b012;
// ----------------------------------------------- ------------------------------------------- //
// B0 reconstruction //
//---------------------------------------------------------------------------------------------//
Int_t iB0count=0;
fArrayB0.clear();
Int_t arrayMCB0label[50];
// select a region around Dplus mass (1.869), ~ 3 sigma of the integrated D invariant mass distribution
// if(theDminusparticle->InvMassDplus()<(1.895) && theDminusparticle->InvMassDplus()>(1.845)){
if( theDminusparticle->InvMassDplus()>(fDplusMassLowLimit) && theDminusparticle->InvMassDplus()<(fDplusMassUpLimit)){
// loop on all the track of the events to be paired with the D
for (Int_t i=0; i<aodEvent->GetNumberOfTracks(); i++){
AliAODTrack* aodTrack = (AliAODTrack*)aodEvent->GetTrack(i);
// remove the Dminus prongs
if(aodTrack->GetID() == Id_prong0 ||aodTrack->GetID() == Id_prong1 || aodTrack->GetID() == Id_prong2) continue;
fCEvents->Fill(21);
if(!(aodTrack->TestFilterMask(BIT(4)))){fCEvents->Fill(20); continue;}
// remove very low pt tracks
if(aodTrack->Pt()<0.5) continue;
//salections on pion tracks
if (TMath::Abs(aodTrack->Eta())>0.8)continue; // cut in eta pi
//check of the track PID, 3 sigma on TPC and TOF
Double_t nSigmaTPCpi=fRDCutsAnalysis->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(aodTrack,AliPID::kPion);
Double_t nSigmaTOFpi=fRDCutsAnalysis->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(aodTrack,AliPID::kPion);
if(nSigmaTPCpi<-3 || nSigmaTPCpi>3 ){fCEvents->Fill(12);
continue;}
if(nSigmaTOFpi<-3 || nSigmaTOFpi>3){
fCEvents->Fill(12);
continue;}
//remove pair with D and pi with the same charge
if(aodTrack->Charge()==theDminusparticle->Charge()){
fCEvents->Fill(13);
continue;
}
fCEvents->Fill(14);
// reconstruct the new vertex of the 2 prongs
AliExternalTrackParam et4;
et4.CopyFromVTrack(static_cast<AliAODTrack*>(aodEvent->GetTrack(i)));
// here dca, d0 and d0rr
trackDminus->PropagateToDCA(primaryVertex,bz,100.,d0z0B,covd0z0B);
d0B[0]=d0z0B[0];
d0errB[0] = TMath::Sqrt(covd0z0B[0]);
et4.PropagateToDCA(primaryVertex,bz,100.,d0z0B,covd0z0B);
d0B[1]=d0z0B[0];
d0errB[1] = TMath::Sqrt(covd0z0B[0]);
dcaB=et4.GetDCA(trackDminus,bz,xdummy,ydummy);
TObjArray b012_B;
b012_B.Add(trackDminus); b012_B.Add(&et4);
// B0 vertex
AliAODVertex *vtxNewB0 = RecalculateVertex(primaryVertex,&b012_B,bz);
if(!vtxNewB0) {
continue;}
// fill the momenta of the prongs
Double_t pxB[2],pyB[2],pzB[2];
pxB[0] = trackDminus-> Px();
pyB[0] = trackDminus-> Py();
pzB[0] = trackDminus-> Pz();
pxB[1] = aodTrack-> Px();
pyB[1] = aodTrack-> Py();
pzB[1] = aodTrack-> Pz();
UShort_t idB[2];
//Int_t prongs_ID[2];
// make the vertex of the B0
idB[0]= 0;
idB[1]= aodTrack->GetID();
// thid is the D* vertex
B0Dminuspi = new AliAODRecoDecayHF2Prong(vtxNewB0,pxB,pyB,pzB,d0B,d0errB,dcaB);
if(!B0Dminuspi) continue;
//add the daughter tracks to the B vertex
B0Dminuspi->GetSecondaryVtx()->AddDaughter(theDminusparticle);
B0Dminuspi->GetSecondaryVtx()->AddDaughter(aodTrack);
B0Dminuspi->SetPrimaryVtxRef((AliAODVertex*)aodEvent->GetPrimaryVertex());
B0Dminuspi->SetProngIDs(2,idB);
fCEvents->Fill(15);
fArrayB0.resize(iB0count+1);
fArrayB0[iB0count]=B0Dminuspi;
Int_t isB0 = 0;
arrayMCB0label[iB0count]=-1;
if(fReadMC){
// find associated MC particle for B0 -> pi DminustoKpipi
arrayMCB0label[iB0count] = B0Dminuspi->MatchToMCB3Prong(511,411, pdgDgB0toDminuspi, pdgDgDplustoKpipi, mcArray);
if(arrayMCB0label[iB0count]>(-1)){
isB0 = 1;
fCEvents->Fill(16);
// fd0MMExpDDaughters_MCmatch->Fill(dd0min);
}
}
nSelectedProd++;
nSelectedAna++;
iB0count++;
}
}
if(iB0count>0) FillSpectrum(iB0count, arrayMCB0label,bz);
fArrayB0.clear();
B0evtcount+=iB0count;
}