-
Notifications
You must be signed in to change notification settings - Fork 0
/
StPicoD0AnaMakerQA.cxx
1990 lines (1456 loc) · 98.7 KB
/
StPicoD0AnaMakerQA.cxx
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
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include "TFile.h"
#include "TClonesArray.h"
#include "TTree.h"
#include "TNtuple.h"
#include "TF1.h"
#include "StPicoDstMaker/StPicoDstMaker.h"
#include "StPicoDstMaker/StPicoDst.h"
#include "StPicoDstMaker/StPicoEvent.h"
#include "StPicoDstMaker/StPicoTrack.h"
#include "StPicoCharmContainers/StPicoD0Event.h"
#include "StPicoCharmContainers/StKaonPion.h"
#include "StMixedEventBuffer/StMixedEventBuffer.h"
#include "StMixedEventBuffer/StMixerEvent.h"
#include "StMixedEventBuffer/StMixerTrack.h"
#include "StPicoD0AnaMaker.h"
#include "StPicoHFMaker/StHFCuts.h"
/***********************************************************************
Author: Alex Jentsch
Most recent update: 4/10/2017
************************************************************************/
ClassImp(StPicoD0AnaMaker)
StPicoD0AnaMaker::StPicoD0AnaMaker(char const * name, char const * inputFilesList,
char const * outName, StPicoDstMaker* picoDstMaker):
StMaker(name),mPicoDstMaker(picoDstMaker),mPicoD0Event(NULL),
mOutFileName(outName), mInputFileList(inputFilesList),
mOutputFile(NULL), mChain(NULL), mEventCounter(0), mHFCuts(NULL)
{}
//---------------------------------------Initialization-----------------------------------------
Int_t StPicoD0AnaMaker::Init()
{
mPicoD0Event = new StPicoD0Event();
mChain = new TChain("T");
std::ifstream listOfFiles(mInputFileList.Data());
if (listOfFiles.is_open())
{
std::string file;
while (getline(listOfFiles, file))
{
LOG_INFO << "StPicoD0AnaMaker - Adding :" << file << endm;
mChain->Add(file.c_str());
}
}
else
{
LOG_ERROR << "StPicoD0AnaMaker - Could not open list of files. ABORT!" << endm;
return kStErr;
}
mChain->GetBranch("dEvent")->SetAutoDelete(kFALSE);
mChain->SetBranchAddress("dEvent", &mPicoD0Event);
mOutputFile = new TFile(mOutFileName.Data(), "RECREATE");
mOutputFile->cd();
if (!mHFCuts)
mHFCuts = new StHFCuts;
mHFCuts->init();
//-----------------------FLAGS--------------------------------//
DEBUG = false;
DEBUG_MIX_BUFFER = false;
USE_CENT_BINS = true;
USE_VZ_BINS = true;
USE_PT_BINS = true;
USE_FINE_PT_BINS = false;
SINGLES_DISTS = true;
D0_HADRON_CORR = true;
EVENT_MIXING = true;
USE_TOF = false; //USE OF TOF CUTS???
USE_PAIR_WISE_PT_CUT = false;
//----------------------------------------------------------//
//---------------------Important constants-----------------//
BUFFER_SIZE = 5;
NUM_PHI_BINS = 12;
NUM_ETA_BINS = 9;
NUM_VZ_BINS = 10;
NUM_CENT_BINS = 16;
NUM_PT_BINS = 5;
NUM_D0_CUT_PT_BINS = 6;
phiBinShift = (TMath::Pi()/12.0); //This number shifts the phi bins to ensure that 0 and pi are at the center of a bin
//----------------------------------------------------------------------------
//--------------------Event Mixer Buffer-------------------------------------
//----------------------------------------------------------------------------
if(USE_VZ_BINS) { nVzBins = NUM_VZ_BINS; } //flag to set binning on Vz
else nVzBins = 1;
if(USE_CENT_BINS) { nCentBins = NUM_CENT_BINS; }
else nCentBins = 1;
if(D0_HADRON_CORR){
for(int i = 0; i < nCentBins; i++){
for( int j = 0; j < nVzBins; j++){
eventBufferPicoEvent[j][i] = new StMixedEventBuffer();
eventBufferPicoEvent[j][i]->setBufferSize(BUFFER_SIZE); //set buffer size here -- the amount of events in each 2d bin
eventBufferPicoEvent[j][i]->setBufferCounter(0);
}
}
}
if(D0_HADRON_CORR){
for(int i = 0; i < nCentBins; i++){
for( int j = 0; j < nVzBins; j++){
eventBufferD0Candidate[j][i] = new StMixedEventBuffer();
eventBufferD0Candidate[j][i]->setBufferSize(BUFFER_SIZE); //set buffer size here -- the amount of events in each 2d bin
eventBufferD0Candidate[j][i]->setBufferCounter(0);
}
}
}
//------------------------------------------------------------------
//--------------------CUTS------------------------------------------
//------------------------------------------------------------------
// D0 Cuts
kaonPtCut = .15; //daughter low pt acceptance cut
pionPtCut = .15; //daughter low pt acceptance cut
D0InvMassLow = 1.82; //signal region US invariant mass
D0InvMassHigh = 1.90; //signal region US invariant mass
USSideBandLeftLow = 1.72; //1.62
USSideBandLeftHigh = 1.78; //1.7
USSideBandRightLow = 1.92; //2.0
USSideBandRightHigh = 2.0; //2.1
d0PtLow = 0.0; //nominal cuts
d0PtHigh = 10.0;
d0DecayLengthMax = 999999.0;
d0DaughterPionPtMin = .15;
d0DaughterKaonPtMin = .15;
//Old Average Cuts -- good
//daughterDCA = .0055;
//d0DecayLengthMin = .0180;
//kaonDCA = .008;
//pionDCA = .008;
//d0DCAtoPV = .0065;
//d0TopologicalCutArray[5][5]; //first index is pt bin, second index is cuts -- decayLength, DCADaughters, d0DCAPV, PiDCAPV, KDCAPV
//CUT SET 4 -- BASE LEVEL FULLY OPENED CUTS
//pt = 0-1 GeV/c
d0TopologicalCutArray[0][0] = 0.0145; //.0180;//minimum decay length
d0TopologicalCutArray[0][1] = .005; //maximum DCA daughters
d0TopologicalCutArray[0][2] = .0065; //.0065; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[0][3] = 0.009; //.008; //minimum DCA between Pi and PV
d0TopologicalCutArray[0][4] = 0.009; //.008; //minimum DCA between K and PV
//pt = 1-2 GeV/c
d0TopologicalCutArray[1][0] = 0.0181;//minimum decay length
d0TopologicalCutArray[1][1] = .005; //maximum DCA daughters
d0TopologicalCutArray[1][2] = .0065; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[1][3] = 0.009; //minimum DCA between Pi and PV
d0TopologicalCutArray[1][4] = 0.009; //minimum DCA between K and PV
//pt = 2-3 GeV/c
d0TopologicalCutArray[2][0] = 0.0212; //minimum decay length
d0TopologicalCutArray[2][1] = .005; //maximum DCA daughters
d0TopologicalCutArray[2][2] = .0065; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[2][3] = 0.009; //minimum DCA between Pi and PV
d0TopologicalCutArray[2][4] = 0.009; //minimum DCA between K and PV
//pt = 3-5 GeV/c
d0TopologicalCutArray[3][0] = 0.0247; //minimum decay length
d0TopologicalCutArray[3][1] = .005; //maximum DCA daughters
d0TopologicalCutArray[3][2] = .0065; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[3][3] = 0.009; //minimum DCA between Pi and PV
d0TopologicalCutArray[3][4] = 0.009; //minimum DCA between K and PV
//pt = 5-10 GeV/c
d0TopologicalCutArray[4][0] = 0.0259; //minimum decay length
d0TopologicalCutArray[4][1] = .005; //maximum DCA daughters
d0TopologicalCutArray[4][2] = .0065; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[4][3] = 0.009; //minimum DCA between Pi and PV
d0TopologicalCutArray[4][4] = 0.009; //minimum DCA between K and PV
//CUT SET 2 -- OPTIMIZED HF GROUP V2 CUTS
/*//pt = 0-1 GeV/c
d0TopologicalCutArray[0][0] = .0145; //.0180;//minimum decay length
d0TopologicalCutArray[0][1] = .0084; //maximum DCA daughters
d0TopologicalCutArray[0][2] = .0061; //.0065; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[0][3] = .0110; //.008; //minimum DCA between Pi and PV
d0TopologicalCutArray[0][4] = .0103; //.008; //minimum DCA between K and PV
//pt = 1-2 GeV/c
d0TopologicalCutArray[1][0] = .0181; //minimum decay length
d0TopologicalCutArray[1][1] = .0066; //maximum DCA daughters
d0TopologicalCutArray[1][2] = .0049; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[1][3] = .0111; //minimum DCA between Pi and PV
d0TopologicalCutArray[1][4] = .0091; //minimum DCA between K and PV
//pt = 2-3 GeV/c
d0TopologicalCutArray[2][0] = .0212; //minimum decay length
d0TopologicalCutArray[2][1] = .0057; //maximum DCA daughters
d0TopologicalCutArray[2][2] = .0038; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[2][3] = .0086; //minimum DCA between Pi and PV
d0TopologicalCutArray[2][4] = .0095; //minimum DCA between K and PV
//pt = 3-5 GeV/c
d0TopologicalCutArray[3][0] = .0247; //minimum decay length
d0TopologicalCutArray[3][1] = .0050; //maximum DCA daughters
d0TopologicalCutArray[3][2] = .0038; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[3][3] = .0081; //minimum DCA between Pi and PV
d0TopologicalCutArray[3][4] = .0079; //minimum DCA between K and PV
//pt = 5-10 GeV/c
d0TopologicalCutArray[4][0] = .0259; //minimum decay length
d0TopologicalCutArray[4][1] = .0060; //maximum DCA daughters
d0TopologicalCutArray[4][2] = .0040; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[4][3] = .0062; //minimum DCA between Pi and PV
d0TopologicalCutArray[4][4] = .0058; //minimum DCA between K and PV*/
//CUT SET 3 -- OPTIMIZED CUTS FOR ALL BUT DAUGHTER DCA -- 80um
//pt = 0-1 GeV/c
/*d0TopologicalCutArray[0][0] = .0141; //.0180;//minimum decay length
d0TopologicalCutArray[0][1] = .0084; //maximum DCA daughters
d0TopologicalCutArray[0][2] = .0061; //.0065; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[0][3] = .008; //.008; //minimum DCA between Pi and PV
d0TopologicalCutArray[0][4] = .008; //.008; //minimum DCA between K and PV
//pt = 1-2 GeV/c
d0TopologicalCutArray[1][0] = .0165; //minimum decay length
d0TopologicalCutArray[1][1] = .0066; //maximum DCA daughters
d0TopologicalCutArray[1][2] = .0049; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[1][3] = .008; //minimum DCA between Pi and PV
d0TopologicalCutArray[1][4] = .008; //minimum DCA between K and PV
//pt = 2-3 GeV/c
d0TopologicalCutArray[2][0] = .0212; //minimum decay length
d0TopologicalCutArray[2][1] = .0057; //maximum DCA daughters
d0TopologicalCutArray[2][2] = .0038; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[2][3] = .008; //minimum DCA between Pi and PV
d0TopologicalCutArray[2][4] = .008; //minimum DCA between K and PV
//pt = 3-5 GeV/c
d0TopologicalCutArray[3][0] = .0220; //minimum decay length
d0TopologicalCutArray[3][1] = .0052; //maximum DCA daughters
d0TopologicalCutArray[3][2] = .0038; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[3][3] = .008; //minimum DCA between Pi and PV
d0TopologicalCutArray[3][4] = .008; //minimum DCA between K and PV
//pt = 5-10 GeV/c
d0TopologicalCutArray[4][0] = .0240; //minimum decay length
d0TopologicalCutArray[4][1] = .0060; //maximum DCA daughters
d0TopologicalCutArray[4][2] = .0040; //maximum DCA between d0 vector and PV
d0TopologicalCutArray[4][3] = .008; //minimum DCA between Pi and PV
d0TopologicalCutArray[4][4] = .008; //minimum DCA between K and PV*/
//Associated Hadron Cuts
hadronPtMin = .15;
hadronPtMax = 15.45;
trackChi2max = 3.0;
trackDCAtoPvtx = 3.0;
nHitsFitMin = 20;
nHitsFitMinOverMax = .52;
//Run 14 MinBias triggers
trigger[0] = 450050;
trigger[1] = 450060;
trigger[2] = 450005;
trigger[3] = 450015;
trigger[4] = 450025;
//-----------------------------------------------------------------
eventNumber = 1;
TString VzBinLabel = "_VzBin_";
TString CentBinLabel = "_CentBin_";
TString PtBinLabel = "_PtBin_";
//Labels for D0-hadron US and LS corr histograms
TString SibCorrLabels[4] = {"Sibling_SideBandLeft_correlation", "Sibling_US_correlation", "Sibling_SideBandRight_correlation", "Sibling_LS_correlation"};
TString MixCorrLabels[4] = {"Mixed_SideBandLeft_correlation", "Mixed_US_correlation", "Mixed_SideBandRight_correlation", "Mixed_LS_correlation"};
//other labels
TString eventCounterLabel = "Event Count Vz ";
TString etaLabel = "Inclusive Hadron Eta";
TString phiLabel = "Inclusive Hadron Phi";
TString etaPhiLabel = "Inclusive 2D Hadron Eta/Phi";
TString phiD0vsPhiHLabel = "phiD0_vs_phiH";
TString etaD0vsEtaHLabel = "etaD0_vs_etaH";
TString phiD0vsEtaD0Label = "phiD0_vs_etaD0";
TString phiHvsEtaHLabel = "phiH_vs_etaH";
TString D0ptLabel[3] = {"SBL_Candidate_Pt_Dist", "D0_Candidate_Pt_Dist", "SBR_Candidate_Pt_Dist"};
TString D0EtaLabel[3] = {"SBL_Eta_Dist", "D0_Eta_Dist", "SBR_Eta_Dist"};
TString D0PhiLabel[3] = {"SBL_Phi_Dist", "D0_Phi_Dist", "SBR_Phi_Dist"};
TString D0KaonPtLabel[3] = {"SBL_Kaon_Candidate_Pt_Dist", "D0_Kaon_Candidate_Pt_Dist", "SBR_Kaon_Candidate_Pt_Dist"};
TString D0KaonEtaLabel[3] = {"SBL_Kaon_Eta_Dist", "D0_Kaon_Eta_Dist", "SBR_Kaon_Eta_Dist"};
TString D0KaonPhiLabel[3] = {"SBL_Kaon_Phi_Dist", "D0_Kaon_Phi_Dist", "SBR_Kaon_Phi_Dist"};
TString D0PionPtLabel[3] = {"SBL_Candidate_Pion_Pt_Dist", "D0_Candidate_Pion_Pt_Dist", "SBR_Candidate_Pion_Pt_Dist"};
TString D0PionEtaLabel[3] = {"SBL_Pion_Eta_Dist", "D0_Pion_Eta_Dist", "SBR_Pion_Eta_Dist"};
TString D0PionPhiLabel[3] = {"SBL_Pion_Phi_Dist", "D0_Pion_Phi_Dist", "SBR_Pion_Phi_Dist"};
TString D0DecayLengthLabel[3] = {"SBL_Decay_Length", "D0_Decay_Length", "SBR_Decay_Length"};
TString D0DCAToPVLabel[3] = {"SBL_DCA_to_PV", "D0_DCA_to_PV", "SBR_DCA_to_PV"};
TString D0KaonPVLabel[3] = {"SBL_Daughter_Kaon_DCA_to_PV", "D0_Daughter_Kaon_DCA_to_PV", "SBR_Daughter_Kaon_DCA_to_PV"};
TString D0PionPVLabel[3] = {"SBL_Daughter_Pion_DCA_to_PV", "D0_Daughter_Pion_DCA_to_PV", "SBR_Daughter_Pion_DCA_to_PV"};
TString D0DaughterDCALabel[3] = {"SBL_Daughter_Pair_DCA", "D0_Daughter_Pair_DCA", "SBR_Daughter_Pair_DCA"};
TString D0PtKaonVsPtPionLabel[3] = {"SBL_Daughter_Kaon_Pt_vs_Pion_Pt","D0_Daughter_Kaon_Pt_vs_Pion_Pt","SBR_Daughter_Kaon_Pt_vs_Pion_Pt"} ;
TString D0PKaonVsPPionLabel[3] = {"SBL_Daughter_Kaon_P_vs_Pion_P", "D0_Daughter_Kaon_P_vs_Pion_P", "SBR_Daughter_Kaon_P_vs_Pion_P"};
TString D0RawEtaVsRawPhiLabel[3] = {"SBL_Raw_delEta_Vs_delPhi", "D0_Raw_delEta_Vs_delPhi", "SBR_Raw_delEta_Vs_delPhi"};
TString D0RawEtaVsRawPhiLeftPtBlobLabel[3] = {"SBL_Raw_delEta_Vs_delPhi_LeftPtBlob", "D0_Raw_delEta_Vs_delPhi_LeftPtBlob", "SBR_Raw_delEta_Vs_delPhi_LeftPtBlob"};
TString D0RawEtaVsRawPhiRightPtBlobLabel[3] = {"SBL_Raw_delEta_Vs_delPhi_RightPtBlob", "D0_Raw_delEta_Vs_delPhi_RightPtBlob", "SBR_Raw_delEta_Vs_delPhi_RightPtBlob"};
//TString D0CutPtBinsLabel[5] = {"0-1", "1-2", "2-3", "3-5", "5-10"};
TString D0CutPtBinsLabel[6] = {"500MeV-1", "1-2", "2-3", "3-5", "5-10", "Integrated"};
TString invMassD0PtBin = "D0_US_invMass_Pt_Bin_";
TString invMassLSPtBin = "LS_invMass_Pt_Bin_";
TString fine = "FINE_";
TString str1;
TString str2;
TString str3;
TString str4;
TString binLabelVz[10] = {"0", "1", "2", "3", "4", "5", "6", "7", "8","9"};
TString binLabelCent[16] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"};
TString binLabelPt[6] = {"0", "1", "2", "3", "4", "5"};
TString binLabelFinePt[11] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
TString binLabelCentralityClass[3] = {"_Peripheral", "_MidCentral", "_Central"};
// --------------------Begin User Variables-----------------------------------
//ptDist = new TH1D("Pt Distribution", "Pt Distribution", 1000, 0, 10);
invMass = new TH1D("unlikeSign", "unlikeSign", 50, 1.6, 2.1);
likeSignBG = new TH1D("LikeSignBG", "LikeSignBG", 50, 1.6, 2.1);
invMassPer = new TH1D("unlikeSign_Peripheral", "unlikeSign_Peripheral", 50, 1.6, 2.1);
invMassMidCent = new TH1D("unlikeSign_MidCentral", "unlikeSign_MidCentral", 50, 1.6, 2.1);
invMassCent = new TH1D("unlikeSign_Central", "unlikeSign_Central", 50, 1.6, 2.1);
likeSignBGPer = new TH1D("LikeSignBG_Peripheral", "LikeSignBG_Peripheral", 50, 1.6, 2.1);
likeSignBGMidCent = new TH1D("LikeSignBG_MidCentral", "LikeSignBG_MidCentral", 50, 1.6, 2.1);
likeSignBGCent = new TH1D("LikeSignBG_Central", "LikeSignBG_Central", 50, 1.6, 2.1);
if(USE_PT_BINS){
for(int k = 0; k < NUM_PT_BINS; k++){
for(int i = 0; i < 3; i++){
str1 = invMassD0PtBin + binLabelPt[k] + binLabelCentralityClass[i];
D0InvMassPtBin[k][i] = new TH1D(str1, str1, 50, 1.6, 2.1);
str1 = invMassLSPtBin + binLabelPt[k] + binLabelCentralityClass[i];
LSInvMassPtBin[k][i] = new TH1D(str1, str1, 50, 1.6, 2.1);
}
}
}
//Fine pt binning
if(USE_FINE_PT_BINS){
for(int k = 0; k < 11; k++){
for(int i = 0; i < 3; i++){
str1 = fine + invMassD0PtBin + binLabelFinePt[k] + binLabelCentralityClass[i];
D0InvMassFinePtBin[k][i] = new TH1D(str1, str1, 50, 1.6, 2.1);
str1 = fine + invMassLSPtBin + binLabelFinePt[k] + binLabelCentralityClass[i];
LSInvMassFinePtBin[k][i] = new TH1D(str1, str1, 50, 1.6, 2.1);
}
}
}
if(D0_HADRON_CORR){//begin D0-Hadron Correlation Histograms
for(int band = 0; band < 4; band++){
for(int i = 0; i < nVzBins; i++){ //Initialize all of the histograms for storing the sibling and mixed information
for(int j = 0; j < nCentBins; j++){
str1 = SibCorrLabels[band] + VzBinLabel + binLabelVz[i] + CentBinLabel + binLabelCent[j];
str2 = MixCorrLabels[band] + VzBinLabel + binLabelVz[i] + CentBinLabel + binLabelCent[j];
sibCorrBin[band][i][j] = new TH2D(str1, str1, NUM_ETA_BINS, -2, 2, NUM_PHI_BINS, -TMath::PiOver2()+phiBinShift, (3*TMath::PiOver2())+phiBinShift);
mixCorrBin[band][i][j] = new TH2D(str2, str2, NUM_ETA_BINS, -2, 2, NUM_PHI_BINS, -TMath::PiOver2()+phiBinShift, (3*TMath::PiOver2())+phiBinShift);
sibCorrBin[band][i][j]->Sumw2();
mixCorrBin[band][i][j]->Sumw2();
}
}
}
}
if(D0_HADRON_CORR && USE_PT_BINS){//begin D0-Hadron Correlation Histograms -- USE PT BINS HERE
for(int band = 0; band < 4; band++){
for(int i = 0; i < nVzBins; i++){
for(int j = 0; j < nCentBins; j++){
for(int k = 0; k < NUM_PT_BINS; k++){
str1 = SibCorrLabels[band] + PtBinLabel + binLabelPt[k] + VzBinLabel + binLabelVz[i] + CentBinLabel + binLabelCent[j];
str2 = MixCorrLabels[band] + PtBinLabel + binLabelPt[k] + VzBinLabel + binLabelVz[i] + CentBinLabel + binLabelCent[j];
sibCorrBinPt[band][k][i][j] = new TH2D(str1, str1, NUM_ETA_BINS, -2, 2, NUM_PHI_BINS, -TMath::PiOver2()+phiBinShift, (3*TMath::PiOver2())+phiBinShift);
mixCorrBinPt[band][k][i][j] = new TH2D(str2, str2, NUM_ETA_BINS, -2, 2, NUM_PHI_BINS, -TMath::PiOver2()+phiBinShift, (3*TMath::PiOver2())+phiBinShift);
sibCorrBinPt[band][k][i][j]->Sumw2();
mixCorrBinPt[band][k][i][j]->Sumw2();
}
}
}
}
}//end D0-Hadron Correlation Histograms -- USE PT BINS HERE
for(int band = 0; band < NUM_D0_CUT_PT_BINS; band++){
for(int i = 0; i < 3; i++){
str1 = D0ptLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0ptDist[i][band] = new TH1D(str1, str1, 250, 0, 10);
str1 = D0EtaLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0EtaDist[i][band] = new TH1D(str1, str1, 250, -1, 1);
str1 = D0PhiLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0PhiDist[i][band] = new TH1D(str1, str1, 250, -2*TMath::Pi(), 2*TMath::Pi());
str1 = D0KaonPtLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0KaonPtDist[i][band] = new TH1D(str1, str1, 250, 0, 10);
str1 = D0KaonEtaLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0KaonEtaDist[i][band] = new TH1D(str1, str1, 250, -1, 1);
str1 = D0KaonPhiLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0KaonPhiDist[i][band] = new TH1D(str1, str1, 250, -2*TMath::Pi(), 2*TMath::Pi());
str1 = D0PionPtLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0PionPtDist[i][band] = new TH1D(str1, str1, 250, 0, 10);
str1 = D0PionEtaLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0PionEtaDist[i][band] = new TH1D(str1, str1, 250, -1, 1);
str1 = D0PionPhiLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0PionPhiDist[i][band] = new TH1D(str1, str1, 250, -2*TMath::Pi(), 2*TMath::Pi());
str1 = D0DecayLengthLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0DecayLengthDist[i][band] = new TH1D(str1, str1, 250, 0, .4);
str1 = D0DCAToPVLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0DCAToPVDist[i][band] = new TH1D(str1, str1, 500, 0, .02);
str1 = D0KaonPVLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0KaonPVDist[i][band] = new TH1D(str1, str1, 500, 0, .1);
str1 = D0PionPVLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0PionPVDist[i][band] = new TH1D(str1, str1, 500, 0, .1);
str1 = D0DaughterDCALabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0DaughterDCADist[i][band] = new TH1D(str1, str1, 500, 0, .02);
str1 = D0PtKaonVsPtPionLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0PtKaonVsPtPion[i][band] = new TH2D(str1, str1, 250, 0, 6, 250, 0, 6);
str1 = D0PKaonVsPPionLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0PKaonVsPPion[i][band] = new TH2D(str1, str1, 250, 0, 6, 250, 0, 6);
str1 = D0RawEtaVsRawPhiLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0RawEtaVsRawPhi[i][band] = new TH2D(str1, str1, 250, 0, 2, 250, 0, TMath::Pi());
str1 = D0RawEtaVsRawPhiLeftPtBlobLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0RawEtaVsRawPhiLeftPtBlob[i][band] = new TH2D(str1, str1, 250, 0, 2, 250, 0, TMath::Pi());
str1 = D0RawEtaVsRawPhiRightPtBlobLabel[i] + PtBinLabel + D0CutPtBinsLabel[band];
D0RawEtaVsRawPhiRightPtBlob[i][band] = new TH2D(str1, str1, 250, 0, 2, 250, 0, TMath::Pi());
}
}
//Event QA Histograms
eventCounter = new TH1I("number_of_events_used", "number of events used", 6, 0, 6);
trackCounter = new TH1I("number_of_tracks_per_event", "number of tracks per event", 1500, 0, 1499);
usedTracks = new TH1I("Used_tracks", "Used tracks", 1500, 0, 1499);
pVtxX = new TH1D("X_position_of_pVtx", "X position of pVtx", 500, -10, 10);
pVtxY = new TH1D("Y_position_of_pVtx", "Y position of pVtx", 500, -10, 10);
pVtxZ = new TH1D("Z_position_of_pVtx", "Z position of pVtx", 500, -7, 7);
vZandCentBinPerEvent = new TH2D("event_counts_per_Vz_Cent_bin", "event counts per Vz/Cent bin", 16, 0, 16, 10, 0, 10);
vZandCentBinPerEvent->GetXaxis()->SetTitle("Centrality Bin");
vZandCentBinPerEvent->GetYaxis()->SetTitle("Vz Bin");
//Track QA Histograms
kaonEtaDist = new TH1D("Kaon_Eta_Distribution", "Kaon Eta Distribution", 250, -1, 1);
pionEtaDist = new TH1D("Pion_Eta_Distribution", "Pion Eta Distribution", 250, -1, 1);
kaonPhiDist = new TH1D("Kaon_Phi_Distribution", "Kaon Phi Distribution", 250, -2*TMath::Pi(), 2*TMath::Pi());
pionPhiDist = new TH1D("Pion_Phi_Distribution", "Pion Phi Distribution", 250, -2*TMath::Pi(), 2*TMath::Pi());
DCAtoPrimaryVertex = new TH1D("track_DCA_to_PV", "track DCA to PV", 500, 0.0, 10.0);
DCAtoPrimaryVertexCut = new TH1D("track_DCA_to_PV_cut_check", "track DCA to PV cut check", 500, 0.0, 10.0);
hadronPtDist = new TH1D("Inclusive_Hadron_pt", "Inclusive Hadron pt", 250, 0, 10);
hadronPhiDist = new TH1D("Inclusive_Hadron_Phi", "Inclusive Hadron Phi", 250, -TMath::Pi(), TMath::Pi());
hadronEtaDist = new TH1D("Inclusive_Hadron_Eta", "Inclusive Hadron Eta", 250, -1, 1);
hadronChi2 = new TH1D("Chi2_for_hadron_tracks", "Chi2 for hadron tracks", 500, 0, 10);
hadronNHitsFit = new TH1D("nHitsFit", "nHitsFit", 60, 0, 60);
hadronNHitsFitOverMax = new TH1D("nHitsFitOverMax", "nHitsFitOverMax", 100, 0, 1);
dEdxVsPt = new TH2D("dEdx_vs_P", "dEdx_vs_P", 400, 0, 4, 400, 1.5, 4);
invBetaVsPt = new TH2D("inv_Beta_Vs_P", "#Beta^{-1} Vs. P", 400, 0, 4, 400, 0, 4);
//nSigmaKaonDist =
//nSigmaPionDist =
//QA for mass-cut D0
//D0ptDist = new TH1D("D0_Candidate_Pt_Dist_mass_cut", "D0 Candidate pt Dist (mass cut)", 250, 0, 10);
//D0EtaDistInt = new TH1D("D0_Eta_Dist_Integrated", "D0_Eta_Dist_Integrated", 250, -1, 1);
//D0PhiDistInt = new TH1D("D0_Phi_Dist_Integrated", "D0_Phi_Dist_Integrated", 250, -2*TMath::Pi(), 2*TMath::Pi());
//D0KaonPtDistInt = new TH1D("D0_Kaon_Candidate_Pt_Dist_Integrated", "D0_Kaon_Candidate_Pt_Dist_Integrated", 250, 0, 10);
//D0KaonEtaDistInt = new TH1D("D0_Kaon_Eta_Dist_Integrated", "D0_Kaon_Eta_Dist_Integrated", 250, -1, 1);
//D0KaonPhiDistInt = new TH1D("D0_Kaon_Phi_Dist_Integrated", "D0_Kaon_Phi_Dist_Integrated", 250, -2*TMath::Pi(), 2*TMath::Pi());
//D0PionPtDistInt = new TH1D("D0_Candidate_Pion_Pt_Dist_Integrated", "D0_Candidate_Pion_Pt_Dist_Integrated", 250, 0, 10);
//D0PionEtaDistInt = new TH1D("D0_Pion_Eta_Dist_Integrated", "D0_Pion_Eta_Dist_Integrated", 250, -1, 1);
//D0PionPhiDistInt = new TH1D("D0_Pion_Phi_Dist_Integrated", "D0_Pion_Phi_Dist_Integrated", 250, -2*TMath::Pi(), 2*TMath::Pi());
//D0DecayLengthDistInt = new TH1D("D0_Decay_Length_Integrated", "D0_Decay_Length_Integrated", 250, 0, .4);
//D0DCAToPVDistInt = new TH1D("D0_DCA_to_PV_Integrated", "D0_DCA_to_PV_Integrated", 500, 0, .02);
//D0KaonPVDistInt = new TH1D("D0_Daughter_Kaon_DCA_to_PV_Integrated", "D0_Daughter_Kaon_DCA_to_PV_Integrated", 500, 0, .1);
//D0PionPVDistInt = new TH1D("D0_Daughter_Pion_DCA_to_PV_Integrated", "D0_Daughter_Pion_DCA_to_PV_Integrated", 500, 0, .1);
//D0DaughterDCADistInt = new TH1D("D0_Daughter_Pair_DCA_Integrated", "D0_Daughter_Pair_DCA_Integrated", 500, 0, .02);
//QA for all kPi pairs
//KPiptDist = new TH1D("KPi_Pt_Dist_mass_cut", "KPi pt Dist (mass cut)", 250, 0, 10);
//KPiEtaDistInt = new TH1D("KPi_Eta_Dist_Integrated", "KPi_Eta_Dist_Integrated", 250, -1, 1);
//KPiPhiDistInt = new TH1D("KPi_Phi_Dist_Integrated", "KPi_Phi_Dist_Integrated", 250, -2*TMath::Pi(), 2*TMath::Pi());
//KPiKaonPtDistInt = new TH1D("KPi_Kaon_Candidate_Pt_Dist_Integrated", "KPi_Kaon_Candidate_Pt_Dist_Integrated", 250, 0, 10);
//KPiKaonEtaDistInt = new TH1D("KPi_Kaon_Eta_Dist_Integrated", "KPi_Kaon_Eta_Dist_Integrated", 250, -1, 1);
//KPiKaonPhiDistInt = new TH1D("KPi_Kaon_Phi_Dist_Integrated", "KPi_Kaon_Phi_Dist_Integrated", 250, -2*TMath::Pi(), 2*TMath::Pi());
//KPiPionPtDistInt = new TH1D("KPi_Candidate_Pion_Pt_Dist_Integrated", "KPi_Candidate_Pion_Pt_Dist_Integrated", 250, 0, 10);
//KPiPionEtaDistInt = new TH1D("KPi_Pion_Eta_Dist_Integrated", "KPi_Pion_Eta_Dist_Integrated", 250, -1, 1);
//KPiPionPhiDistInt = new TH1D("KPi_Pion_Phi_Dist_Integrated", "KPi_Pion_Phi_Dist_Integrated", 250, -2*TMath::Pi(), 2*TMath::Pi());
//KPiDecayLengthDistInt = new TH1D("KPi_Decay_Length_Integrated", "KPi_Decay_Length_Integrated", 250, 0, .4);
//KPiDCAToPVDistInt = new TH1D("KPi_DCA_to_PV_Integrated", "KPi_DCA_to_PV_Integrated", 500, 0, .02);
//KPiKaonPVDistInt = new TH1D("KPi_Daughter_Kaon_DCA_to_PV_Integrated", "KPi_Daughter_Kaon_DCA_to_PV_Integrated", 500, 0, .1);
//KPiPionPVDistInt = new TH1D("KPi_Daughter_Pion_DCA_to_PV_Integrated", "KPi_Daughter_Pion_DCA_to_PV_Integrated", 500, 0, .1);
//KPiDaughterDCADistInt = new TH1D("KPi_Daughter_Pair_DCA_Integrated", "KPi_Daughter_Pair_DCA_Integrated", 500, 0, .02);
d0CountPerEvent = new TH1I("number_of_D0_candidates_per_event", "number of D0 candidates per event", 50, 0, 50);
histOfCuts = new TH1D("HistOfCuts", "HistOfCuts", 55, 1, 55);
//----Efficiency Mapping Functions--------------------
//-----------------------THIS IS THE VERY PRELIMINARY FUNCTION USED TO WEIGHT THE PAIRS BASED ON HADRON EFFICIENCY
effWeightPions = new TF1("effWeightPions", "[0]*TMath::Exp(-([1]/x)**[2])", 0, 15.45);
effWeightPions->SetParameter(0, .809);
effWeightPions->SetParameter(1, .109);
effWeightPions->SetParameter(2, 3.224);
effWeightKaons = new TF1("effWeightKaons", "[0]*TMath::Exp(-([1]/x)**[2]) + [3]*x", 0, 15.45);
effWeightKaons->SetParameter(0, .503);
effWeightKaons->SetParameter(1, .231);
effWeightKaons->SetParameter(2, 3.968);
effWeightKaons->SetParameter(3, .152);
effWeightD0 = new TF1("effWeightPD0", "TMath::Exp([0]*([1]-[2]*TMath::Exp(-x/[3])))", 0, 20);
effWeightD0->SetParameter(0, 2.30259);
effWeightD0->SetParameter(1, -1.306);
effWeightD0->SetParameter(2, 1.9760001);
effWeightD0->SetParameter(3, 3.3699999);
//levy = new TF1("Levy", "((x*x)/(TMath::Sqrt((x*x)+(1.86*1.86))))*([0]/((1+((TMath::Sqrt((x*x)+(1.86*1.86))-1.86)/([1]*[2])))**[1]))", 0, 10);
//single particle distributions for errors
if(SINGLES_DISTS){
for(int i = 0; i < nVzBins; i++){
for(int j = 0; j < nCentBins; j++){
for(int k = 0; k < NUM_PT_BINS; k++){
for(int band = 0; band < 4; band++){
str1 = phiD0vsPhiHLabel + PtBinLabel + binLabelPt[k] + VzBinLabel + binLabelVz[i] + CentBinLabel + binLabelCent[j];
str2 = etaD0vsEtaHLabel + PtBinLabel + binLabelPt[k] + VzBinLabel + binLabelVz[i] + CentBinLabel + binLabelCent[j];
str3 = phiD0vsEtaD0Label + PtBinLabel + binLabelPt[k] + VzBinLabel + binLabelVz[i] + CentBinLabel + binLabelCent[j];
str4 = phiHvsEtaHLabel + PtBinLabel + binLabelPt[k] + VzBinLabel + binLabelVz[i] + CentBinLabel + binLabelCent[j];
phiD0vsPhiH[band][k][i][j] = new TH2D(str1, str1, 48, -TMath::Pi(), TMath::Pi(), 48, -TMath::Pi(), TMath::Pi()); //d0 on y axis, h on x axis
etaD0vsEtaH[band][k][i][j] = new TH2D(str2, str2, 36, -1, 1, 36, -1, 1); //d0 on y axis, h on x axis
phiD0vsEtaD0[band][k][i][j] = new TH2D(str3, str3, 36, -1, 1, 48, -TMath::Pi(), TMath::Pi());
phiHvsEtaH[band][k][i][j] = new TH2D(str4, str4, 36, -1, 1, 48, -TMath::Pi(), TMath::Pi());
}
}
}
}
}
//Histogram formatting
eventCounter->GetXaxis()->SetBinLabel(1,"D0 Cand. events");
eventCounter->GetXaxis()->SetBinLabel(2,"minBias");
eventCounter->GetXaxis()->SetBinLabel(3,"total");
eventCounter->GetXaxis()->SetBinLabel(4,"events from bad runs");
eventCounter->GetXaxis()->SetBinLabel(5,"Left SB events");
eventCounter->GetXaxis()->SetBinLabel(6,"Right SB Events");
//----------------------End User Variables------------------------------------
//Fill Cuts histogram here for producing output text file
histOfCuts->SetBinContent(1, D0InvMassLow); //D0InvMassLow
histOfCuts->SetBinContent(2, D0InvMassHigh); //D0InvMassHigh
histOfCuts->SetBinContent(3, USSideBandLeftLow); //USSideBandLeftLow
histOfCuts->SetBinContent(4, USSideBandLeftHigh); //USSideBandLeftHigh
histOfCuts->SetBinContent(5, USSideBandRightLow); //USSideBandRightLow
histOfCuts->SetBinContent(6, USSideBandRightHigh); //USSideBandRightHigh
histOfCuts->SetBinContent(7, d0PtLow); //d0PtLow
histOfCuts->SetBinContent(8, d0PtHigh); //d0PtHigh
histOfCuts->SetBinContent(9, d0DaughterPionPtMin); //d0DaughterPionPtMin
histOfCuts->SetBinContent(10, d0DaughterKaonPtMin); //d0DaughterKaonPtMin
histOfCuts->SetBinContent(11, d0DecayLengthMax); //d0DecayLengthMax
histOfCuts->SetBinContent(12, d0TopologicalCutArray[0][0]); //d0DecayLengthMin
histOfCuts->SetBinContent(13, d0TopologicalCutArray[0][1]); //daughterDCA
histOfCuts->SetBinContent(14, d0TopologicalCutArray[0][2]); //d0DCAtoPV
histOfCuts->SetBinContent(15, d0TopologicalCutArray[0][3]); //pionDCA
histOfCuts->SetBinContent(16, d0TopologicalCutArray[0][4]); //kaonDCA
histOfCuts->SetBinContent(17, d0TopologicalCutArray[1][0]); //d0DecayLengthMin
histOfCuts->SetBinContent(18, d0TopologicalCutArray[1][1]); //daughterDCA
histOfCuts->SetBinContent(19, d0TopologicalCutArray[1][2]); //d0DCAtoPV
histOfCuts->SetBinContent(20, d0TopologicalCutArray[1][3]); //pionDCA
histOfCuts->SetBinContent(21, d0TopologicalCutArray[1][4]); //kaonDCA
histOfCuts->SetBinContent(22, d0TopologicalCutArray[2][0]); //d0DecayLengthMin
histOfCuts->SetBinContent(23, d0TopologicalCutArray[2][1]); //daughterDCA
histOfCuts->SetBinContent(24, d0TopologicalCutArray[2][2]); //d0DCAtoPV
histOfCuts->SetBinContent(25, d0TopologicalCutArray[2][3]); //pionDCA
histOfCuts->SetBinContent(26, d0TopologicalCutArray[2][4]); //kaonDCA
histOfCuts->SetBinContent(27, d0TopologicalCutArray[3][0]); //d0DecayLengthMin
histOfCuts->SetBinContent(28, d0TopologicalCutArray[3][1]); //daughterDCA
histOfCuts->SetBinContent(29, d0TopologicalCutArray[3][2]); //d0DCAtoPV
histOfCuts->SetBinContent(30, d0TopologicalCutArray[3][3]); //pionDCA
histOfCuts->SetBinContent(31, d0TopologicalCutArray[3][4]); //kaonDCA
histOfCuts->SetBinContent(32, d0TopologicalCutArray[4][0]); //d0DecayLengthMin
histOfCuts->SetBinContent(33, d0TopologicalCutArray[4][1]); //daughterDCA
histOfCuts->SetBinContent(34, d0TopologicalCutArray[4][2]); //d0DCAtoPV
histOfCuts->SetBinContent(35, d0TopologicalCutArray[4][3]); //pionDCA
histOfCuts->SetBinContent(36, d0TopologicalCutArray[4][4]); //kaonDCA
histOfCuts->SetBinContent(37, hadronPtMin); //hadronPtMin
histOfCuts->SetBinContent(38, hadronPtMax); //hadronPtMax
histOfCuts->SetBinContent(39, BUFFER_SIZE); //BUFFER_SIZE
histOfCuts->SetBinContent(40, NUM_PHI_BINS); //NUM_PHI_BINS
histOfCuts->SetBinContent(41, NUM_ETA_BINS); //NUM_ETA_BINS
histOfCuts->SetBinContent(42, 0); // Require HFT
histOfCuts->SetBinContent(43, trackChi2max); // chi2 cut
histOfCuts->SetBinContent(44, trackDCAtoPvtx); // DCA cut
histOfCuts->SetBinContent(49, 1); //Scale factor counter to produce text file
return kStOK;
}
//-----------------------------------------------------------------------------
//------------------------------------Destructor------------------------------
StPicoD0AnaMaker::~StPicoD0AnaMaker()
{
/* */
}
//-----------------------------------------------------------------------------
//------------------------------------Finish-----------------------------------
Int_t StPicoD0AnaMaker::Finish()
{
LOG_INFO << " StPicoD0AnaMaker - writing data and closing output file " <<endm;
mOutputFile->cd();
// save user variables here
if(D0_HADRON_CORR){
for(int band = 0; band < 4; band++){
for(int i = 0; i < nVzBins; i++){
for(int j = 0; j < nCentBins; j++){
sibCorrBin[band][i][j]->Write();
mixCorrBin[band][i][j]->Write();
for(int k = 0; k < NUM_PT_BINS; k++){
sibCorrBinPt[band][k][i][j]->Write();
mixCorrBinPt[band][k][i][j]->Write();
}
}
}
}
}
if(D0_HADRON_CORR){
for(int i = 0; i < nVzBins; i++){
for(int j = 0; j < nCentBins; j++){
cout << "deleting buffer[" << i << "][" << j << "]" << endl;
delete eventBufferPicoEvent[i][j];
delete eventBufferD0Candidate[i][j];
}
}
}
if(USE_PT_BINS){
for(int k = 0; k < NUM_PT_BINS; k++){
for(int i = 0; i < 3; i++){
D0InvMassPtBin[k][i]->Write();
LSInvMassPtBin[k][i]->Write();
}
}
}
if(USE_FINE_PT_BINS){
for(int k = 0; k < 11; k++){
for(int i = 0; i < 3; i++){
D0InvMassFinePtBin[k][i]->Write();
LSInvMassFinePtBin[k][i]->Write();
}
}
}
if(SINGLES_DISTS){
for(int i = 0; i < nVzBins; i++){
for(int j = 0; j < nCentBins ; j++){
phiD0vsPhiH[i][j]->Write();
etaD0vsEtaH[i][j]->Write();
phiD0vsEtaD0[i][j]->Write();
phiHvsEtaH[i][j]->Write();
}
}
}
invMass->Write();
likeSignBG->Write();
invMassPer->Write();
invMassMidCent->Write();
invMassCent->Write();
likeSignBGPer->Write();
likeSignBGMidCent->Write();
likeSignBGCent->Write();
//D0ptDist->Write();
for(int band = 0; band < NUM_D0_CUT_PT_BINS; band++){
for(int i = 0; i < 3; i++){
D0ptDist[i][band]->Write();
D0EtaDist[i][band]->Write();
D0PhiDist[i][band]->Write();
D0KaonPtDist[i][band]->Write();
D0KaonEtaDist[i][band]->Write();
D0KaonPhiDist[i][band]->Write();
D0PionPtDist[i][band]->Write();
D0PionEtaDist[i][band]->Write();
D0PionPhiDist[i][band]->Write();
D0DecayLengthDist[i][band]->Write();
D0DCAToPVDist[i][band]->Write();
D0KaonPVDist[i][band]->Write();
D0PionPVDist[i][band]->Write();
D0DaughterDCADist[i][band]->Write();
D0PtKaonVsPtPion[i][band]->Write();
D0PKaonVsPPion[i][band]->Write();
D0RawEtaVsRawPhi[i][band]->Write();
D0RawEtaVsRawPhiLeftPtBlob[i][band]->Write();
D0RawEtaVsRawPhiRightPtBlob[i][band]->Write();
}
}
//D0EtaDistInt->Write();
//D0PhiDistInt->Write();
//D0KaonPtDistInt->Write();
//D0KaonEtaDistInt->Write();
//D0KaonPhiDistInt->Write();
//D0PionPtDistInt->Write();
//D0PionEtaDistInt->Write();
//D0PionPhiDistInt->Write();
//D0DecayLengthDistInt->Write();
//D0DCAToPVDistInt->Write();
//D0KaonPVDistInt->Write();
//D0PionPVDistInt->Write();
//D0DaughterDCADistInt->Write();
//KPiptDist->Write();
//KPiEtaDistInt->Write();
//KPiPhiDistInt->Write();
//KPiKaonPtDistInt->Write();
//KPiKaonEtaDistInt->Write();
//KPiKaonPhiDistInt->Write();
//KPiPionPtDistInt->Write();
//KPiPionEtaDistInt->Write();
//KPiPionPhiDistInt->Write();
//KPiDecayLengthDistInt->Write();
//KPiDCAToPVDistInt->Write();
///KPiKaonPVDistInt->Write();
//KPiPionPVDistInt->Write();
//KPiDaughterDCADistInt->Write();
eventCounter->Write();
kaonEtaDist->Write();
pionEtaDist->Write();
kaonPhiDist->Write();
pionPhiDist->Write();
hadronPtDist->Write();
hadronPhiDist->Write();
hadronEtaDist->Write();
trackCounter->Write();
dEdxVsPt->Write();
invBetaVsPt->Write();
DCAtoPrimaryVertex->Write();
DCAtoPrimaryVertexCut->Write();
d0CountPerEvent->Write();
vZandCentBinPerEvent->Write();
usedTracks->Write();
histOfCuts->Write();
pVtxX->Write();
pVtxY->Write();
pVtxZ->Write();
hadronChi2->Write();
hadronNHitsFit->Write();
hadronNHitsFitOverMax->Write();
mOutputFile->Close();
return kStOK;
}
//-----------------------------------------------------------------------------
//----------------------------------Make---------------------------------------
Int_t StPicoD0AnaMaker::Make(){ //begin Make member function
readNextEvent();
if (!mPicoDstMaker)
{
LOG_WARN << " StPicoD0AnaMaker - No PicoDstMaker! Skip! " << endm;
return kStWarn;
}
StPicoDst const* picoDst = mPicoDstMaker->picoDst();
if (!picoDst)
{
LOG_WARN << "StPicoD0AnaMaker - No PicoDst! Skip! " << endm;
return kStWarn;
}
if(mPicoD0Event->runId() != picoDst->event()->runId() ||
mPicoD0Event->eventId() != picoDst->event()->eventId())
{
LOG_ERROR <<" StPicoD0AnaMaker - !!!!!!!!!!!! ATTENTION !!!!!!!!!!!!!"<<endm;
LOG_ERROR <<" StPicoD0AnaMaker - SOMETHING TERRIBLE JUST HAPPENED. StPicoEvent and StPicoD0Event are not in sync."<<endm;
exit(1);
}
//-------------------Begin User Analysis---------------------------
/****************************************************************************************************************/
/****************************GLOBAL AND LOCAL VARIABLES SET AND INITIALIZED BEGIN*********************************/
/***************************************************************************************************************/
//-------------- Various global cuts and pt ranges----------------
trackCount = 0;
centralityBin = 0; //This number will be between 0 and 8 -- 9 bins total
VzBin = 0;
bandBin = -1;
centralityClass = -1;
topologicalCutPtBin = -1;
ptBin = -1;
//--------------Local Variables used in the code-------------------
double delPhi = 0;
double delPhiCp = 0;
double delEta = 0;
double pt = 0;
double phi = 0;
double eta = 0;
double dEdx = 0;
double beta = 0;
double nHitsFitRatio = 0;
int PIDflag = 0;
int numD0s = 0;
bool minBiasFlag = false;
int realTracks = 0;
double hadronEffWeight = 1; //this is the efficiency weight for the hadrons, based on the exponential function
double oneOverEffWeight = 1;
double delEtaDaughters = 0;
double delPhiDaughters = 0;
double D0Eff = 1;
double oneOverD0Eff = 1;
double daughterPionPt = 0;
double daughterKaonPt = 0;
int kPiCharge = 0; //US is negative and LS is positive
double finalPairWeight = 1;
//TOF variables
//double invBetaMeasured = 1;
//double invBetaExpected = 1;
//double pionMassSquared =
//double kaonMassSquared =
//double invBetaDelta;
double tofCut = .03;
//----------------------------------------------------------------------------------------------------------------
bool storedD0Event = false;
bool storedLSBEvent = false;
bool storedRSBEvent = false;
StPicoTrack* trk;
StThreeVectorF trackMom;
StThreeVectorF trackMom2;
StThreeVectorF daughterKaonMom;
StThreeVectorF daughterPionMom;
double bField = picoDst->event()->bField();
StThreeVectorF pVtx = picoDst->event()->primaryVertex();
StThreeVectorF kaonPionMom;
std::vector <StThreeVectorF> mAssociatedHadronList;
bool storeEventToMix = true;
bool storeKaonPionEvent = false;
int d0Counter = 0;
/****************************************************************************************************************/
/****************************GLOBAL AND LOCAL VARIABLES SET AND INITIALIZED END********************************/
/***************************************************************************************************************/
/****************************************************************************************************************/
/****************************PRELIMINARY EVENT CUTS BEGIN********************************************************/
/***************************************************************************************************************/
//if(!mPicoD0Event->isGoodEvent()) { return kStOk; } //apply basic event cuts here
if(USE_VZ_BINS){
Vz = picoDst->event()->primaryVertex().z();
VzBin = getVzBin(Vz); //get Vz bin
}
else VzBin = 0;
if(VzBin == -1) { return kStOk; }
if(!mHFCuts->isGoodRun(picoDst->event())){
eventCounter->Fill(2);
eventCounter->Fill(3);
return kStOk; //makes sure the event comes from good run
}
eventCounter->Fill(2);
for(unsigned int i = 0; i < 5; i++){
if(picoDst->event()->isTrigger(trigger[i])){
minBiasFlag = true;