1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
23 #include "THnSparse.h"
40 #include "AliAnalysisManager.h"
42 #include "AliAODHandler.h"
43 #include "AliAODInputHandler.h"
44 #include "AliInputEventHandler.h"
46 #include "AliESDEvent.h"
47 #include "AliESDInputHandler.h"
48 #include "AliMultiplicity.h"
49 #include "AliCentrality.h"
50 #include "AliAnalysisTaskDptDptCorrelations.h"
53 #include "AliPIDResponse.h"
55 #include "AliESDVertex.h"
56 #include "AliESDEvent.h"
57 #include "AliESDInputHandler.h"
58 #include "AliAODEvent.h"
59 #include "AliAODTrack.h"
60 #include "AliAODInputHandler.h"
62 #include "AliESDEvent.h"
63 #include "AliAODEvent.h"
65 #include "AliESDtrackCuts.h"
66 #include "AliAODMCHeader.h"
69 #include "AliGenHijingEventHeader.h"
70 #include "AliGenEventHeader.h"
72 #include "AliAODPid.h"
73 #include "AliPIDResponse.h"
74 #include "AliAODpidUtil.h"
75 #include "AliPIDCombined.h"
79 ClassImp(AliAnalysisTaskDptDptCorrelations)
81 AliAnalysisTaskDptDptCorrelations::AliAnalysisTaskDptDptCorrelations()
82 : AliAnalysisTaskSE(),
84 fESDEvent(0), //! ESD Event
88 _twoPi ( 2.0 * 3.1415927),
95 _rejectPairConversion ( 0),
100 _centralityMethod ( 4),
101 _centralityMin ( 0.),
102 _centralityMax ( 0.),
103 _requestedCharge_1 ( 1),
104 _requestedCharge_2 ( -1),
147 _correctionWeight_1(0),
148 _correctionWeight_2(0),
149 _nBins_M0(500), _min_M0(0), _max_M0(10000), _width_M0(20),
150 _nBins_M1(500), _min_M1(0), _max_M1(10000), _width_M1(20),
151 _nBins_M2(500), _min_M2(0), _max_M2(10000), _width_M2(20),
152 _nBins_M3(500), _min_M3(0), _max_M3(10000), _width_M3(20),
153 _nBins_M4(100), _min_M4(0), _max_M4(1), _width_M4(0.01),
154 _nBins_M5(100), _min_M5(0), _max_M5(1), _width_M5(0.01),
155 _nBins_M6(100), _min_M6(0), _max_M6(1), _width_M6(0.01),
156 _nBins_vertexZ(40), _min_vertexZ(-10), _max_vertexZ(10), _width_vertexZ(0.5),
158 _nBins_pt_1(18), _min_pt_1(0.2), _max_pt_1(2.0), _width_pt_1(0.1),
159 _nBins_phi_1(72), _min_phi_1(0), _max_phi_1(2.*3.1415927),_width_phi_1(2.*3.1415927/72.),
160 _nBins_eta_1(0), _min_eta_1(0), _max_eta_1(0), _width_eta_1(0.1),
163 _nBins_etaPhiPt_1(0),
164 _nBins_zEtaPhiPt_1(0),
166 _nBins_pt_2(18), _min_pt_2(0.2), _max_pt_2(2.0), _width_pt_2(0.1),
167 _nBins_phi_2(72), _min_phi_2(0), _max_phi_2(2.*3.1415927),_width_phi_2(2.*3.1415927/72),
168 _nBins_eta_2(0), _min_eta_2(0), _max_eta_2(0), _width_eta_2(0.1),
171 _nBins_etaPhiPt_2(0),
172 _nBins_zEtaPhiPt_2(0),
192 __s1pt_1_vsEtaPhi(0),
193 __n1_1_vsZEtaPhiPt(0),
196 __s1pt_2_vsEtaPhi(0),
197 __n1_2_vsZEtaPhiPt(0),
200 __s2ptpt_12_vsEtaPhi(0),
201 __s2PtN_12_vsEtaPhi(0),
202 __s2NPt_12_vsEtaPhi(0),
205 _eventAccounting ( 0),
222 _n1_1_vsEtaVsPhi ( 0),
223 _s1pt_1_vsEtaVsPhi ( 0),
224 _n1_1_vsZVsEtaVsPhiVsPt ( 0),
233 _n1_2_vsEtaVsPhi ( 0),
234 _s1pt_2_vsEtaVsPhi ( 0),
235 _n1_2_vsZVsEtaVsPhiVsPt ( 0),
243 _n2_12_vsEtaPhi ( 0),
244 _n2_12_vsPtVsPt ( 0),
245 _s2PtPt_12_vsEtaPhi( 0),
246 _s2PtN_12_vsEtaPhi ( 0),
247 _s2NPt_12_vsEtaPhi ( 0),
253 _s2PtPtNw_12_vsM ( 0),
254 _s2PtNNw_12_vsM ( 0),
255 _s2NPtNw_12_vsM ( 0),
278 intBinCorrName("NA"),
328 _title_etaPhi_1("NA"),
330 _title_SumPt_1("NA"),
331 _title_AvgPt_1("NA"),
333 _title_AvgSumPt_1("NA"),
338 _title_etaPhi_2("NA"),
340 _title_SumPt_2("NA"),
341 _title_AvgPt_2("NA"),
343 _title_AvgSumPt_2("NA"),
345 _title_etaPhi_12("NA"),
347 _title_AvgN2_12("NA"),
348 _title_AvgSumPtPt_12("NA"),
349 _title_AvgSumPtN_12("NA"),
350 _title_AvgNSumPt_12("NA"),
360 printf("Default constructor called \n");
362 printf("passed \n ");
366 AliAnalysisTaskDptDptCorrelations::AliAnalysisTaskDptDptCorrelations(const TString & name)
367 : AliAnalysisTaskSE(name),
373 _twoPi ( 2.0 * 3.1415927),
378 _sameFilter ( false),
380 _rejectPairConversion ( 0),
383 _vertexXYMin ( -10.),
385 _centralityMethod ( 4),
386 _centralityMin ( 0.),
387 _centralityMax ( 1.),
388 _requestedCharge_1 ( 1),
389 _requestedCharge_2 ( -1),
397 _trackFilterBit ( 0),
432 _correctionWeight_1(0),
433 _correctionWeight_2(0),
434 _nBins_M0(500), _min_M0(0), _max_M0(10000), _width_M0(20),
435 _nBins_M1(500), _min_M1(0), _max_M1(10000), _width_M1(20),
436 _nBins_M2(500), _min_M2(0), _max_M2(10000), _width_M2(20),
437 _nBins_M3(500), _min_M3(0), _max_M3(10000), _width_M3(20),
438 _nBins_M4(100), _min_M4(0), _max_M4(1), _width_M4(0.01),
439 _nBins_M5(100), _min_M5(0), _max_M5(1), _width_M5(0.01),
440 _nBins_M6(100), _min_M6(0), _max_M6(1), _width_M6(0.01),
441 _nBins_vertexZ(40), _min_vertexZ(-10), _max_vertexZ(10), _width_vertexZ(0.5),
443 _nBins_pt_1(18), _min_pt_1(0.2), _max_pt_1(2.0), _width_pt_1(0.1),
444 _nBins_phi_1(72), _min_phi_1(0), _max_phi_1(2.*3.1415927),_width_phi_1(2.*3.1415927/72.),
445 _nBins_eta_1(0), _min_eta_1(0), _max_eta_1(0), _width_eta_1(0.1),
448 _nBins_etaPhiPt_1(0),
449 _nBins_zEtaPhiPt_1(0),
451 _nBins_pt_2(18), _min_pt_2(0.2), _max_pt_2(2.0), _width_pt_2(0.1),
452 _nBins_phi_2(72), _min_phi_2(0), _max_phi_2(2.*3.1415927),_width_phi_2(2.*3.1415927/72),
453 _nBins_eta_2(0), _min_eta_2(0), _max_eta_2(0), _width_eta_2(0.1),
456 _nBins_etaPhiPt_2(0),
457 _nBins_zEtaPhiPt_2(0),
477 __s1pt_1_vsEtaPhi(0),
478 __n1_1_vsZEtaPhiPt(0),
481 __s1pt_2_vsEtaPhi(0),
482 __n1_2_vsZEtaPhiPt(0),
485 __s2ptpt_12_vsEtaPhi(0),
486 __s2PtN_12_vsEtaPhi(0),
487 __s2NPt_12_vsEtaPhi(0),
490 _eventAccounting ( 0),
507 _n1_1_vsEtaVsPhi ( 0),
508 _s1pt_1_vsEtaVsPhi ( 0),
509 _n1_1_vsZVsEtaVsPhiVsPt ( 0),
518 _n1_2_vsEtaVsPhi ( 0),
519 _s1pt_2_vsEtaVsPhi ( 0),
520 _n1_2_vsZVsEtaVsPhiVsPt ( 0),
528 _n2_12_vsEtaPhi ( 0),
529 _n2_12_vsPtVsPt ( 0),
530 _s2PtPt_12_vsEtaPhi( 0),
531 _s2PtN_12_vsEtaPhi ( 0),
532 _s2NPt_12_vsEtaPhi ( 0),
538 _s2PtPtNw_12_vsM ( 0),
539 _s2PtNNw_12_vsM ( 0),
540 _s2NPtNw_12_vsM ( 0),
563 intBinCorrName("NA"),
613 _title_etaPhi_1("NA"),
615 _title_SumPt_1("NA"),
616 _title_AvgPt_1("NA"),
618 _title_AvgSumPt_1("NA"),
623 _title_etaPhi_2("NA"),
625 _title_SumPt_2("NA"),
626 _title_AvgPt_2("NA"),
628 _title_AvgSumPt_2("NA"),
630 _title_etaPhi_12("NA"),
632 _title_AvgN2_12("NA"),
633 _title_AvgSumPtPt_12("NA"),
634 _title_AvgSumPtN_12("NA"),
635 _title_AvgNSumPt_12("NA"),
645 printf("2nd constructor called ");
647 DefineOutput(0, TList::Class());
653 AliAnalysisTaskDptDptCorrelations::~AliAnalysisTaskDptDptCorrelations()
658 void AliAnalysisTaskDptDptCorrelations::UserCreateOutputObjects()
661 _outputHistoList = new TList();
662 _outputHistoList->SetOwner();
664 _nBins_M0 = 500; _min_M0 = 0.; _max_M0 = 5000.; _width_M0 = (_max_M0-_min_M0)/_nBins_M0;
665 _nBins_M1 = 500; _min_M1 = 0.; _max_M1 = 5000.; _width_M1 = (_max_M1-_min_M1)/_nBins_M1;
666 _nBins_M2 = 500; _min_M2 = 0.; _max_M2 = 5000.; _width_M2 = (_max_M2-_min_M2)/_nBins_M2;
667 _nBins_M3 = 500; _min_M3 = 0.; _max_M3 = 5000.; _width_M3 = (_max_M3-_min_M3)/_nBins_M3;
668 _nBins_M4 = 100; _min_M4 = 0.; _max_M4 = 100.; _width_M4 = (_max_M4-_min_M4)/_nBins_M4;
669 _nBins_M5 = 100; _min_M5 = 0.; _max_M5 = 100.; _width_M5 = (_max_M5-_min_M5)/_nBins_M5;
670 _nBins_M6 = 100; _min_M6 = 0.; _max_M6 = 100.; _width_M6 = (_max_M6-_min_M6)/_nBins_M6;
672 _min_vertexZ = _vertexZMin;
673 _max_vertexZ = _vertexZMax;
674 _width_vertexZ = 0.5;
675 _nBins_vertexZ = int(0.5+ (_max_vertexZ - _min_vertexZ)/_width_vertexZ);
676 _nBins_pt_1 = int(0.5+ (_max_pt_1 -_min_pt_1 )/_width_pt_1);
677 _nBins_eta_1 = int(0.5+ (_max_eta_1-_min_eta_1)/_width_eta_1);
678 _width_phi_1 = (_max_phi_1 - _min_phi_1) /_nBins_phi_1;
679 _nBins_etaPhi_1 = _nBins_phi_1 * _nBins_eta_1;
680 _nBins_etaPhiPt_1 = _nBins_etaPhi_1 * _nBins_pt_1;
681 _nBins_zEtaPhiPt_1 = _nBins_vertexZ * _nBins_etaPhiPt_1;
683 _nBins_pt_2 = int(0.5+ (_max_pt_2 -_min_pt_2 )/_width_pt_2);
684 _nBins_eta_2 = int(0.5+ (_max_eta_2-_min_eta_2)/_width_eta_2);
685 _width_phi_2 = (_max_phi_2 - _min_phi_2) /_nBins_phi_2;
686 _nBins_etaPhi_2 = _nBins_phi_2 * _nBins_eta_2;
687 _nBins_etaPhiPt_2 = _nBins_etaPhi_2 * _nBins_pt_2;
688 _nBins_zEtaPhiPt_2 = _nBins_vertexZ * _nBins_etaPhiPt_2;
689 _nBins_etaPhi_12 = _nBins_etaPhi_1 * _nBins_etaPhi_2;
691 _id_1 = new int[arraySize];
692 _charge_1 = new int[arraySize];
693 _iEtaPhi_1 = new int[arraySize];
694 _iPt_1 = new int[arraySize];
695 _pt_1 = new float[arraySize];
696 _px_1 = new float[arraySize];
697 _py_1 = new float[arraySize];
698 _pz_1 = new float[arraySize];
699 _correction_1 = new float[arraySize];
701 __n1_1_vsPt = getDoubleArray(_nBins_pt_1, 0.);
702 __n1_1_vsEtaPhi = getDoubleArray(_nBins_etaPhi_1, 0.);
703 __s1pt_1_vsEtaPhi = getDoubleArray(_nBins_etaPhi_1, 0.);
704 __n1_1_vsZEtaPhiPt = getFloatArray(_nBins_zEtaPhiPt_1, 0.);
707 if (_requestedCharge_2!=_requestedCharge_1)
711 _id_2 = new int[arraySize];
712 _charge_2 = new int[arraySize];
713 _iEtaPhi_2 = new int[arraySize];
714 _iPt_2 = new int[arraySize];
715 _pt_2 = new float[arraySize];
716 _px_2 = new float[arraySize];
717 _py_2 = new float[arraySize];
718 _pz_2 = new float[arraySize];
719 _correction_2 = new float[arraySize];
721 __n1_2_vsPt = getDoubleArray(_nBins_pt_2, 0.);
722 __n1_2_vsEtaPhi = getDoubleArray(_nBins_etaPhi_2, 0.);
723 __s1pt_2_vsEtaPhi = getDoubleArray(_nBins_etaPhi_2, 0.);
724 __n1_2_vsZEtaPhiPt = getFloatArray(_nBins_zEtaPhiPt_2, 0.);
728 __n2_12_vsPtPt = getDoubleArray(_nBins_pt_1*_nBins_pt_2,0.);
729 __n2_12_vsEtaPhi = getFloatArray(_nBins_etaPhi_12, 0.);
730 __s2ptpt_12_vsEtaPhi = getFloatArray(_nBins_etaPhi_12, 0.);
731 __s2PtN_12_vsEtaPhi = getFloatArray(_nBins_etaPhi_12, 0.);
732 __s2NPt_12_vsEtaPhi = getFloatArray(_nBins_etaPhi_12, 0.);
734 // Setup all the labels needed.
738 pair_12_Name = "_12";
755 binCorrName = "binCorr";
756 intBinCorrName = "intBinCorr";
761 s1ptNwName = "sumPtNw";
762 s1DptName = "sumDpt";
763 s2PtPtName = "sumPtPt";
764 s2PtPtNwName = "sumPtPtNw";
765 s2DptDptName = "sumDptDpt";
766 s2NPtName = "sumNPt";
767 s2NPtNwName = "sumNPtNw";
768 s2PtNName = "sumPtN";
769 s2NPtNwName = "sumNPtNw";
770 s2PtNNwName = "sumPtNNw";
772 ptptName = "avgPtPt";
773 pt1pt1Name = "avgPtavgPt";
775 DptDptName = "avgDptDpt";
776 RDptDptName = "relDptDpt"; // ratio of avgDptDpt by avgPt*avgPt
781 _title_counts = "yield";
787 _title_m4 = "V0Centrality";
788 _title_m5 = "TrkCentrality";
789 _title_m6 = "SpdCentrality";
791 _title_eta_1 = "#eta_{1}";
792 _title_phi_1 = "#varphi_{1} (radian)";
793 _title_etaPhi_1 = "#eta_{1}#times#varphi_{1}";
794 _title_pt_1 = "p_{t,1} (GeV/c)";
795 _title_n_1 = "n_{1}";
796 _title_SumPt_1 = "#Sigma p_{t,1} (GeV/c)";
797 _title_AvgPt_1 = "#LT p_{t,1} #GT (GeV/c)";
798 _title_AvgN_1 = "#LT n_{1} #GT";
799 _title_AvgSumPt_1 = "#LT #Sigma p_{t,1} #GT (GeV/c)";
801 _title_eta_2 = "#eta_{2}";
802 _title_phi_2 = "#varphi_{2} (radian)";
803 _title_etaPhi_2 = "#eta_{2}#times#varphi_{2}";
804 _title_pt_2 = "p_{t,2} (GeV/c)";
805 _title_n_2 = "n_{2}";
806 _title_SumPt_2 = "#Sigma p_{t,1} (GeV/c)";
807 _title_AvgPt_2 = "#LT p_{t,2} #GT (GeV/c)";
808 _title_AvgN_2 = "#LT n_{2} #GT";
809 _title_AvgSumPt_2 = "#LT #Sigma p_{t,2} #GT (GeV/c)";
811 _title_etaPhi_12 = "#eta_{1}#times#varphi_{1}#times#eta_{2}#times#varphi_{2}";
813 _title_AvgN2_12 = "#LT n_{2} #GT";;
814 _title_AvgSumPtPt_12 = "#LT #Sigma p_{t,1}p_{t,2} #GT";;
815 _title_AvgSumPtN_12 = "#LT #Sigma p_{t,1}N #GT";;
816 _title_AvgNSumPt_12 = "#LT N#Sigma p_{t,2} #GT";;
824 vsEtaPhi = "_vsEtaPhi";
825 vsPtVsPt = "_vsPtVsPt";
830 int iZ, iEtaPhi, iPt;
831 int iZ1,iEtaPhi1,iPt1;
835 _correctionWeight_1 = new float[_nBins_vertexZ*_nBins_etaPhi_1*_nBins_pt_1];
837 b = _nBins_etaPhi_1*_nBins_pt_1;
838 for (iZ=0,iZ1=1; iZ<_nBins_vertexZ; iZ++, iZ1++)
840 for (iEtaPhi=0,iEtaPhi1=1; iEtaPhi<_nBins_etaPhi_1; iEtaPhi++, iEtaPhi1++)
842 for (iPt=0,iPt1=1; iPt<_nBins_pt_1; iPt++, iPt1++)
844 _correctionWeight_1[iZ*b+iEtaPhi*a+iPt] = _weight_1->GetBinContent(iZ1,iEtaPhi1,iPt1);
851 AliError("AliAnalysisTaskDptDptCorrelations:: _weight_1 is a null pointer.");
858 _correctionWeight_2 = new float[_nBins_vertexZ*_nBins_etaPhi_2*_nBins_pt_2];
860 b = _nBins_etaPhi_2*_nBins_pt_2;
861 for (iZ=0,iZ1=1; iZ<_nBins_vertexZ; iZ++, iZ1++)
863 for (iEtaPhi=0,iEtaPhi1=1; iEtaPhi<_nBins_etaPhi_2; iEtaPhi++, iEtaPhi1++)
865 for (iPt=0,iPt1=1; iPt<_nBins_pt_2; iPt++, iPt1++)
867 _correctionWeight_2[iZ*b+iEtaPhi*a+iPt] = _weight_2->GetBinContent(iZ1,iEtaPhi1,iPt1);
874 AliError("AliAnalysisTaskDptDptCorrelations:: _weight_1 is a null pointer.");
881 PostData(0,_outputHistoList);
883 //cout<< "AliAnalysisTaskDptDptCorrelations::CreateOutputObjects() DONE " << endl;
887 void AliAnalysisTaskDptDptCorrelations::createHistograms()
889 AliInfo(" AliAnalysisTaskDptDptCorrelations::createHistoHistograms() Creating Event Histos");
892 name = "eventAccounting";
894 _eventAccounting = createHisto1D(name,name,10, -0.5, 9.5, "event Code", _title_counts);
896 name = "m0"; _m0 = createHisto1D(name,name,_nBins_M1, _min_M1, _max_M1, _title_m0, _title_counts);
897 name = "m1"; _m1 = createHisto1D(name,name,_nBins_M1, _min_M1, _max_M1, _title_m1, _title_counts);
898 name = "m2"; _m2 = createHisto1D(name,name,_nBins_M2, _min_M2, _max_M2, _title_m2, _title_counts);
899 name = "m3"; _m3 = createHisto1D(name,name,_nBins_M3, _min_M3, _max_M3, _title_m3, _title_counts);
900 name = "m4"; _m4 = createHisto1D(name,name,_nBins_M4, _min_M4, _max_M4, _title_m4, _title_counts);
901 name = "m5"; _m5 = createHisto1D(name,name,_nBins_M5, _min_M5, _max_M5, _title_m5, _title_counts);
902 name = "m6"; _m6 = createHisto1D(name,name,_nBins_M6, _min_M6, _max_M6, _title_m6, _title_counts);
903 name = "zV"; _vertexZ = createHisto1D(name,name,100, -10, 10, "z-Vertex (cm)", _title_counts);
906 name = "Eta"; _etadis = createHisto1F(name,name, 200, -1.0, 1.0, "#eta","counts");
907 name = "Phi"; _phidis = createHisto1F(name,name, 360, 0.0, 6.4, "#phi","counts");
908 name = "DCAz"; _dcaz = createHisto1F(name,name, 500, -5.0, 5.0, "dcaZ","counts");
909 name = "DCAxy"; _dcaxy = createHisto1F(name,name, 500, -5.0, 5.0, "dcaXY","counts");
911 //name = "Nclus1"; _Ncluster1 = createHisto1F(name,name, 200, 0, 200, "Ncluster1","counts");
912 //name = "Nclus2"; _Ncluster2 = createHisto1F(name,name, 200, 0, 200, "Ncluster2","counts");
916 name = n1Name+part_1_Name+vsPt; _n1_1_vsPt = createHisto1F(name,name, _nBins_pt_1, _min_pt_1, _max_pt_1, _title_pt_1, _title_AvgN_1);
917 name = n1Name+part_1_Name+vsZ+vsEtaPhi+vsPt; _n1_1_vsZVsEtaVsPhiVsPt = createHisto3F(name,name, _nBins_vertexZ,_min_vertexZ,_max_vertexZ, _nBins_etaPhi_1, 0., double(_nBins_etaPhi_1), _nBins_pt_1, _min_pt_1, _max_pt_1, "zVertex", _title_etaPhi_1, _title_pt_1);
919 name = n1Name+part_2_Name+vsPt; _n1_2_vsPt = createHisto1F(name,name, _nBins_pt_2, _min_pt_2, _max_pt_2, _title_pt_2, _title_AvgN_2);
920 name = n1Name+part_2_Name+vsZ+vsEtaPhi+vsPt; _n1_2_vsZVsEtaVsPhiVsPt = createHisto3F(name,name, _nBins_vertexZ,_min_vertexZ,_max_vertexZ, _nBins_etaPhi_2, 0., double(_nBins_etaPhi_2), _nBins_pt_2, _min_pt_2, _max_pt_2, "zVertex", _title_etaPhi_2, _title_pt_2);
925 name = n1Name+part_1_Name+vsEtaPhi; _n1_1_vsEtaVsPhi = createHisto2F(name,name, _nBins_eta_1, _min_eta_1, _max_eta_1, _nBins_phi_1, _min_phi_1, _max_phi_1, _title_eta_1, _title_phi_1, _title_AvgN_1);
926 name = s1ptName+part_1_Name+vsEtaPhi; _s1pt_1_vsEtaVsPhi = createHisto2F(name,name, _nBins_eta_1, _min_eta_1, _max_eta_1, _nBins_phi_1, _min_phi_1, _max_phi_1, _title_eta_1, _title_phi_1, _title_AvgSumPt_1);
927 name = n1Name+part_1_Name+vsM; _n1_1_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgN_1);
928 name = s1ptName+part_1_Name+vsM; _s1pt_1_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgSumPt_1);
929 name = n1NwName+part_1_Name+vsM; _n1Nw_1_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgN_1);
930 name = s1ptNwName+part_1_Name+vsM; _s1ptNw_1_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgSumPt_1);
932 name = n1Name+part_2_Name+vsEtaPhi; _n1_2_vsEtaVsPhi = createHisto2F(name,name, _nBins_eta_2, _min_eta_2, _max_eta_2, _nBins_phi_2, _min_phi_2, _max_phi_2, _title_eta_2, _title_phi_2, _title_AvgN_2);
933 name = s1ptName+part_2_Name+vsEtaPhi; _s1pt_2_vsEtaVsPhi = createHisto2F(name,name, _nBins_eta_2, _min_eta_2, _max_eta_2, _nBins_phi_2, _min_phi_2, _max_phi_2, _title_eta_2, _title_phi_2, _title_AvgSumPt_2);
934 name = n1Name+part_2_Name + vsM; _n1_2_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgN_2);
935 name = s1ptName+part_2_Name + vsM; _s1pt_2_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgSumPt_2);
936 name = n1NwName+part_2_Name+vsM; _n1Nw_2_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgN_1);
937 name = s1ptNwName+part_2_Name+vsM; _s1ptNw_2_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgSumPt_1);
939 name = n2Name+pair_12_Name+vsEtaPhi; _n2_12_vsEtaPhi = createHisto1F(name,name, _nBins_etaPhi_12, 0., double(_nBins_etaPhi_12), _title_etaPhi_12, _title_AvgN2_12);
940 name = s2PtPtName+pair_12_Name + vsEtaPhi;_s2PtPt_12_vsEtaPhi = createHisto1F(name,name, _nBins_etaPhi_12, 0., double(_nBins_etaPhi_12), _title_etaPhi_12, _title_AvgSumPtPt_12);
941 name = s2PtNName+pair_12_Name + vsEtaPhi; _s2PtN_12_vsEtaPhi = createHisto1F(name,name, _nBins_etaPhi_12, 0., double(_nBins_etaPhi_12), _title_etaPhi_12, _title_AvgSumPtN_12);
942 name = s2NPtName+pair_12_Name + vsEtaPhi; _s2NPt_12_vsEtaPhi = createHisto1F(name,name, _nBins_etaPhi_12, 0., double(_nBins_etaPhi_12), _title_etaPhi_12, _title_AvgNSumPt_12);
943 name = n2Name+pair_12_Name+vsPtVsPt; _n2_12_vsPtVsPt = createHisto2F(name,name, _nBins_pt_1, _min_pt_1, _max_pt_1, _nBins_pt_2, _min_pt_2, _max_pt_2, _title_pt_1, _title_pt_2, _title_AvgN2_12);
945 name = n2Name+pair_12_Name + vsM; _n2_12_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgN2_12);
946 name = s2PtPtName+pair_12_Name + vsM; _s2PtPt_12_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgSumPtPt_12);
947 name = s2PtNName+pair_12_Name + vsM; _s2PtN_12_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgSumPtN_12);
948 name = s2NPtName+pair_12_Name + vsM; _s2NPt_12_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgNSumPt_12);
950 name = n2NwName+pair_12_Name + vsM; _n2Nw_12_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgN2_12);
951 name = s2PtPtNwName+pair_12_Name + vsM; _s2PtPtNw_12_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgSumPtPt_12);
952 name = s2PtNNwName+pair_12_Name + vsM; _s2PtNNw_12_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgSumPtN_12);
953 name = s2NPtNwName+pair_12_Name + vsM; _s2NPtNw_12_vsM = createProfile(name,name, _nBins_M4, _min_M4, _max_M4, _title_m4, _title_AvgNSumPt_12);
955 name = "mInv"; _invMass = createHisto1F(name,name, 50, 0.41, 0.55, "M_{inv}","counts");
956 name = "mInvElec"; _invMassElec = createHisto1F(name,name, 500, 0., 1.000, "M_{inv}","counts");
959 AliInfo(" AliAnalysisTaskDptDptCorrelations::createHistoHistograms() All Done");
961 //-----------------------//
963 void AliAnalysisTaskDptDptCorrelations::finalizeHistograms()
966 AliInfo("AliAnalysisTaskDptDptCorrelations::finalizeHistograms() starting");
967 AliInfo(Form("CorrelationAnalyzers::finalizeHistograms() _eventCount : %d",int(_eventCount)));
972 fillHistoWithArray(_n1_1_vsPt, __n1_1_vsPt, _nBins_pt_1);
973 fillHistoWithArray(_n1_1_vsZVsEtaVsPhiVsPt, __n1_1_vsZEtaPhiPt, _nBins_vertexZ, _nBins_etaPhi_1, _nBins_pt_1);
974 fillHistoWithArray(_n1_2_vsPt, __n1_1_vsPt, _nBins_pt_1);
975 fillHistoWithArray(_n1_2_vsZVsEtaVsPhiVsPt, __n1_1_vsZEtaPhiPt, _nBins_vertexZ, _nBins_etaPhi_1, _nBins_pt_1);
979 fillHistoWithArray(_n1_1_vsPt, __n1_1_vsPt, _nBins_pt_1);
980 fillHistoWithArray(_n1_1_vsZVsEtaVsPhiVsPt, __n1_1_vsZEtaPhiPt, _nBins_vertexZ, _nBins_etaPhi_1, _nBins_pt_1);
981 fillHistoWithArray(_n1_2_vsPt, __n1_2_vsPt, _nBins_pt_2);
982 fillHistoWithArray(_n1_2_vsZVsEtaVsPhiVsPt, __n1_2_vsZEtaPhiPt, _nBins_vertexZ, _nBins_etaPhi_2, _nBins_pt_2);
989 fillHistoWithArray(_n1_1_vsEtaVsPhi, __n1_1_vsEtaPhi, _nBins_eta_1, _nBins_phi_1);
990 fillHistoWithArray(_s1pt_1_vsEtaVsPhi, __s1pt_1_vsEtaPhi, _nBins_eta_1, _nBins_phi_1);
991 fillHistoWithArray(_n1_2_vsEtaVsPhi, __n1_1_vsEtaPhi, _nBins_eta_1, _nBins_phi_1);
992 fillHistoWithArray(_s1pt_2_vsEtaVsPhi, __s1pt_1_vsEtaPhi, _nBins_eta_1, _nBins_phi_1);
996 fillHistoWithArray(_n1_1_vsEtaVsPhi, __n1_1_vsEtaPhi, _nBins_eta_1, _nBins_phi_1);
997 fillHistoWithArray(_s1pt_1_vsEtaVsPhi, __s1pt_1_vsEtaPhi, _nBins_eta_1, _nBins_phi_1);
998 fillHistoWithArray(_n1_2_vsEtaVsPhi, __n1_2_vsEtaPhi, _nBins_eta_2, _nBins_phi_2);
999 fillHistoWithArray(_s1pt_2_vsEtaVsPhi, __s1pt_2_vsEtaPhi, _nBins_eta_2, _nBins_phi_2);
1001 fillHistoWithArray(_n2_12_vsEtaPhi, __n2_12_vsEtaPhi, _nBins_etaPhi_12);
1002 fillHistoWithArray(_s2PtPt_12_vsEtaPhi, __s2ptpt_12_vsEtaPhi, _nBins_etaPhi_12);
1003 fillHistoWithArray(_s2PtN_12_vsEtaPhi, __s2PtN_12_vsEtaPhi, _nBins_etaPhi_12);
1004 fillHistoWithArray(_s2NPt_12_vsEtaPhi, __s2NPt_12_vsEtaPhi, _nBins_etaPhi_12);
1005 fillHistoWithArray(_n2_12_vsPtVsPt, __n2_12_vsPtPt, _nBins_pt_1, _nBins_pt_2);
1008 AliInfo("AliAnalysisTaskDptDptCorrelations::finalizeHistograms() Done ");
1013 void AliAnalysisTaskDptDptCorrelations::UserExec(Option_t */*option*/)
1017 int iPhi, iEta, iEtaPhi, iPt, charge;
1018 float q, phi, pt, eta, corr, corrPt, px, py, pz;
1020 int id_1, q_1, iEtaPhi_1, iPt_1;
1021 float pt_1, px_1, py_1, pz_1, corr_1;
1022 int id_2, q_2, iEtaPhi_2, iPt_2;
1023 float pt_2, px_2, py_2, pz_2, corr_2;
1025 int iVertex, iVertexP1, iVertexP2;
1027 float massElecSq = 1.94797849000000016e-02;
1030 const AliAODVertex* vertex;
1033 AliAnalysisManager* manager = AliAnalysisManager::GetAnalysisManager();
1037 AliAODInputHandler* inputHandler = dynamic_cast<AliAODInputHandler*> (manager->GetInputEventHandler());
1038 if (!inputHandler) {
1042 fAODEvent = dynamic_cast<AliAODEvent*>(InputEvent());
1043 //AliAODEvent* fAODEvent = dynamic_cast<AliAODEvent*>(InputEvent());
1049 fPIDResponse =inputHandler->GetPIDResponse();
1051 AliFatal("This Task needs the PID response attached to the inputHandler");
1055 // count all events looked at here
1058 if (_eventAccounting)
1060 _eventAccounting->Fill(0);// count all calls to this function
1068 _eventAccounting->Fill(1);// count all calls to this function with a valid pointer
1069 //reset single particle counters
1071 __n1_1 = __n1_2 = __s1pt_1 = __s1pt_2 = __n1Nw_1 = __n1Nw_2 = __s1ptNw_1 = __s1ptNw_2 = 0;
1073 float v0Centr = -999.;
1074 float v0ACentr = -999.;
1075 float trkCentr = -999.;
1076 float spdCentr = -999.;
1078 float vertexX = -999;
1079 float vertexY = -999;
1080 float vertexZ = -999;
1081 //float vertexXY = -999;
1082 //float dcaZ = -999;
1083 //float dcaXY = -999;
1084 float centrality = -999;
1089 AliCentrality* centralityObject = fAODEvent->GetHeader()->GetCentralityP();
1090 if (centralityObject)
1092 //cout << "AliAnalysisTaskDptDptCorrelations::UserExec(Option_t *option) - 6" << endl;
1094 v0Centr = centralityObject->GetCentralityPercentile("V0M");
1095 v0ACentr = centralityObject->GetCentralityPercentile("V0A");
1096 trkCentr = centralityObject->GetCentralityPercentile("TRK");
1097 spdCentr = centralityObject->GetCentralityPercentile("CL1");
1101 _nTracks =fAODEvent->GetNumberOfTracks();//NEW Test
1108 _field = fAODEvent->GetMagneticField();
1111 switch (_centralityMethod)
1113 case 0: centrality = _mult0; break;
1114 case 1: centrality = _mult1; break;
1115 case 2: centrality = _mult2; break;
1116 case 3: centrality = _mult3; break;
1117 case 4: centrality = _mult4; break;
1118 case 5: centrality = _mult5; break;
1119 case 6: centrality = _mult6; break;
1120 case 7: centrality = _mult4a; break;
1124 if ( centrality < _centralityMin || centrality > _centralityMax )
1128 _eventAccounting->Fill(2);// count all events with right centrality
1130 // filter on z and xy vertex
1131 vertex = (AliAODVertex*) fAODEvent->GetPrimaryVertex();
1133 //vertex->GetXYZ(V);
1138 vertex->GetCovarianceMatrix(fCov);
1139 if(vertex->GetNContributors() > 0)
1143 vertexX = vertex->GetX();
1144 vertexY = vertex->GetY();
1145 vertexZ = vertex->GetZ();
1147 if(TMath::Abs(vertexZ) > 10)
1155 _vertexZ->Fill(vertexZ);
1157 iVertex = int((vertexZ-_min_vertexZ)/_width_vertexZ);
1158 iVertexP1 = iVertex*_nBins_etaPhiPt_1;
1159 iVertexP2 = iVertex*_nBins_etaPhiPt_2;
1160 if (iVertex<0 || iVertex>=_nBins_vertexZ)
1162 AliError("AliAnalysisTaskDptDptCorrelations::Exec(Option_t *option) iVertex<0 || iVertex>=_nBins_vertexZ ");
1165 _eventAccounting->Fill(3);// count all calls to this function with a valid pointer
1166 //======================
1168 //*********************************************************
1169 TExMap *trackMap = new TExMap();//Mapping matrix----
1170 //TRandom *ran = new TRandom(); //random eff. correction
1172 //1st loop track for Global tracks
1173 for(Int_t i = 0; i < _nTracks; i++)
1175 AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(fAODEvent->GetTrack(i));
1177 AliError(Form("ERROR: Could not retrieve AODtrack %d",i));
1180 Int_t gID = aodTrack->GetID();
1181 if (aodTrack->TestFilterBit(1)) trackMap->Add(gID, i);//Global tracks
1184 AliAODTrack* newAodTrack;
1186 //Track Loop starts here
1187 for (int iTrack=0; iTrack< _nTracks; iTrack++)
1189 AliAODTrack* t = dynamic_cast<AliAODTrack *>(fAODEvent->GetTrack(iTrack));
1191 AliError(Form("Could not receive track %d", iTrack));
1195 bitOK = t->TestFilterBit(_trackFilterBit);
1196 if (!bitOK) continue; //128bit or 272bit
1198 /* //------- Eff. test----------
1199 Double_t yy = (1-0.7)/1.8;
1200 Double_t zz = (pt-0.2);
1201 //Double_t effValue = 0.7+yy*zz; //Slope
1202 Double_t effValue = 0.7; //Flat
1203 Double_t R = ran->Uniform(0,1);
1205 if(R > effValue) continue;
1206 //---------------------------
1209 Int_t gID = t->GetID();
1210 newAodTrack = gID >= 0 ?t : fAODEvent->GetTrack(trackMap->GetValue(-1-gID));
1221 //dcaZ = t->ZAtDCA();
1224 Double_t nsigmaelectron = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,(AliPID::EParticleType)AliPID::kElectron));
1225 Double_t nsigmapion = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,(AliPID::EParticleType)AliPID::kPion));
1226 Double_t nsigmakaon = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,(AliPID::EParticleType)AliPID::kKaon));
1227 Double_t nsigmaproton = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,(AliPID::EParticleType)AliPID::kProton));
1229 //nsigma cut to reject electron
1231 if(nsigmaelectron < fNSigmaCut
1232 && nsigmapion > fNSigmaCut
1233 && nsigmakaon > fNSigmaCut
1234 && nsigmaproton > fNSigmaCut ) continue;
1236 if(charge == 0) continue;
1238 // Kinematics cuts used
1239 if( pt < _min_pt_1 || pt > _max_pt_1) continue;
1240 if( eta < _min_eta_1 || eta > _max_eta_1) continue;
1243 newAodTrack->GetXYZ(pos);
1245 Double_t DCAX = pos[0] - vertexX;
1246 Double_t DCAY = pos[1] - vertexY;
1247 Double_t DCAZ = pos[2] - vertexZ;
1249 Double_t DCAXY = TMath::Sqrt((DCAX*DCAX) + (DCAY*DCAY));
1251 if (DCAZ < _dcaZMin ||
1253 DCAXY > _dcaXYMax ) continue;
1256 //==== QA ===========================
1257 //_dcaz->Fill(DCAZ);
1258 //_dcaxy->Fill(DCAXY);
1259 //_etadis->Fill(eta);
1260 //_phidis->Fill(phi);
1261 //===================================
1262 //*************************************************
1265 if (_requestedCharge_1 == charge)
1268 iPhi = int( phi/_width_phi_1);
1270 if (iPhi<0 || iPhi>=_nBins_phi_1 )
1272 AliWarning("AliAnalysisTaskDptDptCorrelations::analyze() iPhi<0 || iPhi>=_nBins_phi_1");
1276 iEta = int((eta-_min_eta_1)/_width_eta_1);
1277 if (iEta<0 || iEta>=_nBins_eta_1)
1279 AliWarning(Form("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) Mismatched iEta: %d", iEta));
1282 iPt = int((pt -_min_pt_1 )/_width_pt_1 );
1283 if (iPt<0 || iPt >=_nBins_pt_1)
1285 AliWarning(Form("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) Mismatched iPt: %d",iPt));
1288 iEtaPhi = iEta*_nBins_phi_1+iPhi;
1289 iZEtaPhiPt = iVertexP1 + iEtaPhi*_nBins_pt_1 + iPt;
1291 if (_correctionWeight_1)
1292 corr = _correctionWeight_1[iZEtaPhiPt];
1295 if (iZEtaPhiPt<0 || iZEtaPhiPt>=_nBins_zEtaPhiPt_1)
1297 AliWarning("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) iZEtaPhiPt<0 || iZEtaPhiPt>=_nBins_zEtaPhiPt_1");
1305 __n1_1_vsPt[iPt] += corr; //cout << "step 15" << endl;
1306 __n1_1_vsZEtaPhiPt[iZEtaPhiPt] += corr; //cout << "step 12" << endl;
1313 _charge_1[k1] = charge;
1314 _iEtaPhi_1[k1] = iEtaPhi;
1320 _correction_1[k1] = corr;
1322 __n1_1_vsEtaPhi[iEtaPhi] += corr;
1324 __s1pt_1_vsEtaPhi[iEtaPhi] += corrPt;
1330 AliError(Form("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) k1 >=arraySize; arraySize: %d",arraySize));
1336 if (!_sameFilter && _requestedCharge_2 == charge)
1339 iPhi = int( phi/_width_phi_2);
1341 if (iPhi<0 || iPhi>=_nBins_phi_2 )
1343 AliWarning("AliAnalysisTaskDptDptCorrelations::analyze() iPhi<0 || iPhi>=_nBins_phi_1");
1347 iEta = int((eta-_min_eta_2)/_width_eta_2);
1348 if (iEta<0 || iEta>=_nBins_eta_2)
1350 AliWarning(Form("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) Mismatched iEta: %d", iEta));
1353 iPt = int((pt -_min_pt_2 )/_width_pt_2 );
1354 if (iPt<0 || iPt >=_nBins_pt_2)
1356 AliWarning(Form("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) Mismatched iPt: %d",iPt));
1360 iEtaPhi = iEta*_nBins_phi_2+iPhi;
1361 iZEtaPhiPt = iVertexP2 + iEtaPhi*_nBins_pt_2 + iPt;
1362 if (iZEtaPhiPt<0 || iZEtaPhiPt>=_nBins_zEtaPhiPt_2)
1364 AliWarning("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) iZEtaPhiPt<0 || iZEtaPhiPt>=_nBins_zEtaPhiPt_2");
1369 if (_correctionWeight_2)
1370 corr = _correctionWeight_2[iZEtaPhiPt];
1376 __n1_2_vsPt[iPt] += corr; //cout << "step 15" << endl;
1377 __n1_2_vsZEtaPhiPt[iZEtaPhiPt] += corr; //cout << "step 12" << endl;
1382 _id_2[k2] = iTrack; //cout << "step 1" << endl;
1383 _charge_2[k2] = charge; //cout << "step 2" << endl;
1384 _iEtaPhi_2[k2] = iEtaPhi; //cout << "step 3" << endl;
1385 _iPt_2[k2] = iPt; //cout << "step 4" << endl;
1386 _pt_2[k2] = pt; //cout << "step 5" << endl;
1387 _px_2[k2] = px; //cout << "step 6" << endl;
1388 _py_2[k2] = py; //cout << "step 7" << endl;
1389 _pz_2[k2] = pz; //cout << "step 8" << endl;
1390 _correction_2[k2] = corr; //cout << "step 9" << endl;
1391 __n1_2 += corr; //cout << "step 10" << endl;
1392 __s1pt_2 += corrPt; //cout << "step 13" << endl;
1394 __n1_2_vsEtaPhi[iEtaPhi] += corr; //cout << "step 11" << endl;
1395 __s1pt_2_vsEtaPhi[iEtaPhi] += corrPt; //cout << "step 14" << endl;
1400 AliWarning(Form("-W- k2 >=arraySize; arraySize: %d",arraySize));
1405 //cout << "done with track" << endl;
1411 //cout << "Filling histograms now" << endl;
1419 //_vertexZ->Fill(vertexZ);
1423 // nothing to do here.
1429 _n1_1_vsM->Fill(centrality, __n1_1);
1430 _s1pt_1_vsM->Fill(centrality, __s1pt_1);
1431 _n1Nw_1_vsM->Fill(centrality, __n1Nw_1);
1432 _s1ptNw_1_vsM->Fill(centrality, __s1ptNw_1);
1433 _n1_2_vsM->Fill(centrality, __n1_1);
1434 _s1pt_2_vsM->Fill(centrality, __s1pt_1);
1435 _n1Nw_2_vsM->Fill(centrality, __n1Nw_1);
1436 _s1ptNw_2_vsM->Fill(centrality, __s1ptNw_1);
1437 // reset pair counters
1438 __n2_12 = __s2ptpt_12 = __s2NPt_12 = __s2PtN_12 = 0;
1439 __n2Nw_12 = __s2ptptNw_12 = __s2NPtNw_12 = __s2PtNNw_12 = 0;
1442 for (int i1=0; i1<k1; i1++)
1444 ////cout << " i1:" << i1 << endl;
1445 id_1 = _id_1[i1]; ////cout << " id_1:" << id_1 << endl;
1446 q_1 = _charge_1[i1]; ////cout << " q_1:" << q_1 << endl;
1447 iEtaPhi_1 = _iEtaPhi_1[i1]; ////cout << " iEtaPhi_1:" << iEtaPhi_1 << endl;
1448 iPt_1 = _iPt_1[i1]; ////cout << " iPt_1:" << iPt_1 << endl;
1449 corr_1 = _correction_1[i1]; ////cout << " corr_1:" << corr_1 << endl;
1450 pt_1 = _pt_1[i1]; ////cout << " pt_1:" << pt_1 << endl;
1451 //dedx_1 = _dedx_1[i1]; ////cout << " dedx_1:" << dedx_1 << endl;
1453 for (int i2=i1+1; i2<k1; i2++)
1455 ////cout << " i2:" << i2 << endl;
1456 id_2 = _id_1[i2]; ////cout << " id_2:" << id_2 << endl;
1459 q_2 = _charge_1[i2]; ////cout << " q_1:" << q_1 << endl;
1460 iEtaPhi_2 = _iEtaPhi_1[i2]; ////cout << " iEtaPhi_1:" << iEtaPhi_1 << endl;
1461 iPt_2 = _iPt_1[i2]; ////cout << " iPt_1:" << iPt_1 << endl;
1462 corr_2 = _correction_1[i2]; ////cout << " corr_1:" << corr_1 << endl;
1463 pt_2 = _pt_1[i2]; ////cout << " pt_1:" << pt_1 << endl;
1464 //dedx_2 = _dedx_1[i2]; ////cout << " dedx_2:" << dedx_2 << endl;
1465 corr = corr_1*corr_2;
1466 if (q_2>q_1 || (q_1>0 && q_2>0 && pt_2<=pt_1) || (q_1<0 && q_2<0 && pt_2>=pt_1))
1468 ij = iEtaPhi_1*_nBins_etaPhi_1 + iEtaPhi_2; ////cout << " ij:" << ij<< endl;
1470 else // swap particles
1472 ij = iEtaPhi_2*_nBins_etaPhi_1 + iEtaPhi_1; ////cout << " ij:" << ij<< endl;
1476 __n2_12_vsEtaPhi[ij] += corr;
1478 __s2ptpt_12 += corr*ptpt;
1479 __s2PtN_12 += corr*pt_1;
1480 __s2NPt_12 += corr*pt_2;
1481 __s2ptpt_12_vsEtaPhi[ij] += corr*ptpt;
1482 __s2PtN_12_vsEtaPhi[ij] += corr*pt_1;
1483 __s2NPt_12_vsEtaPhi[ij] += corr*pt_2;
1484 __n2_12_vsPtPt[iPt_1*_nBins_pt_2 + iPt_2] += corr;
1487 __s2ptptNw_12 += ptpt;
1488 __s2PtNNw_12 += pt_1;
1489 __s2NPtNw_12 += pt_2;
1497 for (int i1=0; i1<k1; i1++)
1499 ////cout << " i1:" << i1 << endl;
1500 id_1 = _id_1[i1]; ////cout << " id_1:" << id_1 << endl;
1501 q_1 = _charge_1[i1]; ////cout << " q_1:" << q_1 << endl;
1502 iEtaPhi_1 = _iEtaPhi_1[i1]; ////cout << " iEtaPhi_1:" << iEtaPhi_1 << endl;
1503 iPt_1 = _iPt_1[i1]; ////cout << " iPt_1:" << iPt_1 << endl;
1504 corr_1 = _correction_1[i1]; ////cout << " corr_1:" << corr_1 << endl;
1505 pt_1 = _pt_1[i1]; ////cout << " pt_1:" << pt_1 << endl;
1506 //dedx_1 = _dedx_1[i1]; ////cout << " dedx_1:" << dedx_1 << endl;
1508 for (int i2=i1+1; i2<k1; i2++)
1510 ////cout << " i2:" << i2 << endl;
1511 id_2 = _id_1[i2]; ////cout << " id_2:" << id_2 << endl;
1514 q_2 = _charge_1[i2]; ////cout << " q_2:" << q_2 << endl;
1515 iEtaPhi_2 = _iEtaPhi_1[i2]; ////cout << " iEtaPhi_2:" << iEtaPhi_2 << endl;
1516 iPt_2 = _iPt_1[i2]; ////cout << " iPt_2:" << iPt_2 << endl;
1517 corr_2 = _correction_1[i2]; ////cout << " corr_2:" << corr_2 << endl;
1518 pt_2 = _pt_1[i2]; ////cout << " pt_2:" << pt_2 << endl;
1519 //dedx_2 = _dedx_1[i2]; ////cout << " dedx_2:" << dedx_2 << endl;
1520 corr = corr_1*corr_2;
1521 if ( q_2<q_1 || (q_1>0 && q_2>0 && pt_2>=pt_1) || (q_1<0 && q_2<0 && pt_2<=pt_1))
1523 ij = iEtaPhi_1*_nBins_etaPhi_1 + iEtaPhi_2; ////cout << " ij:" << ij<< endl;
1525 else // swap particles
1527 ij = iEtaPhi_2*_nBins_etaPhi_1 + iEtaPhi_1; ////cout << " ij:" << ij<< endl;
1531 __n2_12_vsEtaPhi[ij] += corr;
1533 __s2ptpt_12 += corr*ptpt;
1534 __s2PtN_12 += corr*pt_1;
1535 __s2NPt_12 += corr*pt_2;
1536 __s2ptpt_12_vsEtaPhi[ij] += corr*ptpt;
1537 __s2PtN_12_vsEtaPhi[ij] += corr*pt_1;
1538 __s2NPt_12_vsEtaPhi[ij] += corr*pt_2;
1539 __n2_12_vsPtPt[iPt_1*_nBins_pt_2 + iPt_2] += corr;
1542 __s2ptptNw_12 += ptpt;
1543 __s2PtNNw_12 += pt_1;
1544 __s2NPtNw_12 += pt_2;
1551 else // filter 1 and 2 are different -- must do all particle pairs...
1553 _n1_1_vsM->Fill(centrality, __n1_1);
1554 _s1pt_1_vsM->Fill(centrality, __s1pt_1);
1555 _n1Nw_1_vsM->Fill(centrality, __n1Nw_1);
1556 _s1ptNw_1_vsM->Fill(centrality, __s1ptNw_1);
1557 _n1_2_vsM->Fill(centrality, __n1_2);
1558 _s1pt_2_vsM->Fill(centrality, __s1pt_2);
1559 _n1Nw_2_vsM->Fill(centrality, __n1Nw_2);
1560 _s1ptNw_2_vsM->Fill(centrality, __s1ptNw_2);
1561 // reset pair counters
1562 __n2_12 = __s2ptpt_12 = __s2NPt_12 = __s2PtN_12 = 0;
1563 __n2Nw_12 = __s2ptptNw_12 = __s2NPtNw_12 = __s2PtNNw_12 = 0;
1564 for (int i1=0; i1<k1; i1++)
1566 ////cout << " i1:" << i1 << endl;
1567 id_1 = _id_1[i1]; ////cout << " id_1:" << id_1 << endl;
1568 q_1 = _charge_1[i1]; ////cout << " q_1:" << q_1 << endl;
1569 iEtaPhi_1 = _iEtaPhi_1[i1]; ////cout << " iEtaPhi_1:" << iEtaPhi_1 << endl;
1570 iPt_1 = _iPt_1[i1]; ////cout << " iPt_1:" << iPt_1 << endl;
1571 corr_1 = _correction_1[i1]; ////cout << " corr_1:" << corr_1 << endl;
1572 pt_1 = _pt_1[i1]; ////cout << " pt_1:" << pt_1 << endl;
1573 px_1 = _px_1[i1]; ////cout << " px_1:" << px_1 << endl;
1574 py_1 = _py_1[i1]; ////cout << " py_1:" << py_1 << endl;
1575 pz_1 = _pz_1[i1]; ////cout << " pz_1:" << pz_1 << endl;
1576 //dedx_1 = _dedx_1[i1]; ////cout << " dedx_1:" << dedx_1 << endl;
1579 for (int i2=0; i2<k2; i2++)
1581 ////cout << " i2:" << i2 << endl;
1582 id_2 = _id_2[i2]; ////cout << " id_2:" << id_2 << endl;
1583 if (id_1!=id_2) // exclude auto correlation
1585 q_2 = _charge_2[i2]; ////cout << " q_2:" << q_2 << endl;
1586 iEtaPhi_2 = _iEtaPhi_2[i2]; ////cout << " iEtaPhi_2:" << iEtaPhi_2 << endl;
1587 iPt_2 = _iPt_2[i2]; ////cout << " iPt_2:" << iPt_2 << endl;
1588 corr_2 = _correction_2[i2]; ////cout << " corr_2:" << corr_2 << endl;
1589 pt_2 = _pt_2[i2]; ////cout << " pt_2:" << pt_2 << endl;
1590 px_2 = _px_2[i2]; ////cout << " px_2:" << px_2 << endl;
1591 py_2 = _py_2[i2]; ////cout << " py_2:" << py_2 << endl;
1592 pz_2 = _pz_2[i2]; ////cout << " pz_2:" << pz_2 << endl;
1593 //dedx_2 = _dedx_2[i2]; ////cout << " dedx_2:" << dedx_2 << endl;
1596 if (_rejectPairConversion)
1598 float e1Sq = massElecSq + pt_1*pt_1 + pz_1*pz_1;
1599 float e2Sq = massElecSq + pt_2*pt_2 + pz_2*pz_2;
1600 float mInvSq = 2*(massElecSq + sqrt(e1Sq*e2Sq) - px_1*px_2 - py_1*py_2 - pz_1*pz_2 );
1601 float mInv = sqrt(mInvSq);
1602 _invMass->Fill(mInv);
1605 corr = corr_1*corr_2;
1606 ij = iEtaPhi_1*_nBins_etaPhi_1 + iEtaPhi_2; ////cout << " ij:" << ij<< endl;
1608 __n2_12_vsEtaPhi[ij] += corr;
1610 __s2ptpt_12 += corr*ptpt;
1611 __s2PtN_12 += corr*pt_1;
1612 __s2NPt_12 += corr*pt_2;
1613 __s2ptpt_12_vsEtaPhi[ij] += corr*ptpt;
1614 __s2PtN_12_vsEtaPhi[ij] += corr*pt_1;
1615 __s2NPt_12_vsEtaPhi[ij] += corr*pt_2;
1616 __n2_12_vsPtPt[iPt_1*_nBins_pt_2 + iPt_2] += corr;
1618 __s2ptptNw_12 += ptpt;
1619 __s2PtNNw_12 += pt_1;
1620 __s2NPtNw_12 += pt_2;
1627 _n2_12_vsM->Fill(centrality, __n2_12);
1628 _s2PtPt_12_vsM->Fill(centrality, __s2ptpt_12);
1629 _s2PtN_12_vsM->Fill(centrality, __s2NPt_12);
1630 _s2NPt_12_vsM->Fill(centrality, __s2PtN_12);
1632 _n2Nw_12_vsM->Fill(centrality, __n2Nw_12);
1633 _s2PtPtNw_12_vsM->Fill(centrality, __s2ptptNw_12);
1634 _s2PtNNw_12_vsM->Fill(centrality, __s2NPtNw_12);
1635 _s2NPtNw_12_vsM->Fill(centrality, __s2PtNNw_12);
1640 AliInfo("AliAnalysisTaskDptDptCorrelations::UserExec() -----------------Event Done ");
1641 PostData(0,_outputHistoList);
1645 void AliAnalysisTaskDptDptCorrelations::FinishTaskOutput()
1647 AliInfo("AliAnalysisTaskDptDptCorrelations::FinishTaskOutput() Starting.");
1648 Printf("= 0 ====================================================================");
1649 finalizeHistograms();
1650 AliInfo("= 1 ====================================================================");
1651 PostData(0,_outputHistoList);
1652 AliInfo("= 2 ====================================================================");
1653 AliInfo("AliAnalysisTaskDptDptCorrelations::FinishTaskOutput() Done.");
1656 void AliAnalysisTaskDptDptCorrelations::Terminate(Option_t* /*option*/)
1658 AliInfo("AliAnalysisTaskDptDptCorrelations::Terminate() Starting/Done.");
1663 //===================================================================================================
1664 void AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH1 * h, float * array, int size)
1667 float v1, ev1, v2, ev2, sum, esum;
1668 for (i=0, i1=1; i<size; ++i,++i1)
1670 v1 = array[i]; ev1 = sqrt(v1);
1671 v2 = h->GetBinContent(i1);
1672 ev2 = h->GetBinError(i1);
1674 esum = sqrt(ev1*ev1+ev2*ev2);
1675 h->SetBinContent(i1,sum);
1676 h->SetBinError(i1,esum);
1680 void AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH2 * h, float * array, int size1, int size2)
1684 float v1, ev1, v2, ev2, sum, esum;
1685 for (i=0, i1=1; i<size1; ++i,++i1)
1687 for (j=0, j1=1; j<size2; ++j,++j1)
1689 v1 = array[i*size2+j]; ev1 = sqrt(v1);
1690 v2 = h->GetBinContent(i1,j1);
1691 ev2 = h->GetBinError(i1,j1);
1693 esum = sqrt(ev1*ev1+ev2*ev2);
1694 h->SetBinContent(i1,j1,sum);
1695 h->SetBinError(i1,j1,esum);
1700 void AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH3 * h, float * array, int size1, int size2, int size3)
1705 float v1, ev1, v2, ev2, sum, esum;
1706 int size23 = size2*size3;
1707 for (i=0, i1=1; i<size1; ++i,++i1)
1709 for (j=0, j1=1; j<size2; ++j,++j1)
1711 for (k=0, k1=1; k<size3; ++k,++k1)
1713 v1 = array[i*size23+j*size3+k]; ev1 = sqrt(v1);
1714 v2 = h->GetBinContent(i1,j1,k1);
1715 ev2 = h->GetBinError(i1,j1,k1);
1717 esum = sqrt(ev1*ev1+ev2*ev2);
1718 h->SetBinContent(i1,j1,k1,sum);
1719 h->SetBinError(i1,j1,k1,esum);
1725 void AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH1 * h, double * array, int size)
1728 double v1, ev1, v2, ev2, sum, esum;
1729 for (i=0, i1=1; i<size; ++i,++i1)
1731 v1 = array[i]; ev1 = sqrt(v1);
1732 v2 = h->GetBinContent(i1);
1733 ev2 = h->GetBinError(i1);
1735 esum = sqrt(ev1*ev1+ev2*ev2);
1736 h->SetBinContent(i1,sum);
1737 h->SetBinError(i1,esum);
1741 void AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH2 * h, double * array, int size1, int size2)
1745 double v1, ev1, v2, ev2, sum, esum;
1746 for (i=0, i1=1; i<size1; ++i,++i1)
1748 for (j=0, j1=1; j<size2; ++j,++j1)
1750 v1 = array[i*size2+j]; ev1 = sqrt(v1);
1751 v2 = h->GetBinContent(i1,j1);
1752 ev2 = h->GetBinError(i1,j1);
1754 esum = sqrt(ev1*ev1+ev2*ev2);
1755 h->SetBinContent(i1,j1,sum);
1756 h->SetBinError(i1,j1,esum);
1761 void AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH3 * h, double * array, int size1, int size2, int size3)
1766 double v1, ev1, v2, ev2, sum, esum;
1767 int size23 = size2*size3;
1768 for (i=0, i1=1; i<size1; ++i,++i1)
1770 for (j=0, j1=1; j<size2; ++j,++j1)
1772 for (k=0, k1=1; k<size3; ++k,++k1)
1774 v1 = array[i*size23+j*size3+k]; ev1 = sqrt(v1);
1775 v2 = h->GetBinContent(i1,j1,k1);
1776 ev2 = h->GetBinError(i1,j1,k1);
1778 esum = sqrt(ev1*ev1+ev2*ev2);
1779 h->SetBinContent(i1,j1,k1,sum);
1780 h->SetBinError(i1,j1,k1,esum);
1786 //________________________________________________________________________
1787 double * AliAnalysisTaskDptDptCorrelations::getDoubleArray(int size, double v)
1789 /// Allocate an array of type double with n values
1790 /// Initialize the array to the given value
1791 double * array = new double [size];
1792 for (int i=0;i<size;++i) array[i]=v;
1796 //________________________________________________________________________
1797 float * AliAnalysisTaskDptDptCorrelations::getFloatArray(int size, float v)
1799 /// Allocate an array of type float with n values
1800 /// Initialize the array to the given value
1801 float * array = new float [size];
1802 for (int i=0;i<size;++i) array[i]=v;
1807 //________________________________________________________________________
1808 TH1D * AliAnalysisTaskDptDptCorrelations::createHisto1D(const TString & name, const TString & title,
1809 int n, double xMin, double xMax,
1810 const TString & xTitle, const TString & yTitle)
1812 //CreateHisto new 1D historgram
1813 AliInfo(Form("createHisto 1D histo %s nBins: %d xMin: %f xMax: %f",name.Data(),n,xMin,xMax));
1814 TH1D * h = new TH1D(name,title,n,xMin,xMax);
1815 h->GetXaxis()->SetTitle(xTitle);
1816 h->GetYaxis()->SetTitle(yTitle);
1822 //________________________________________________________________________
1823 TH1D * AliAnalysisTaskDptDptCorrelations::createHisto1D(const TString & name, const TString & title,
1824 int n, double * bins,
1825 const TString & xTitle, const TString & yTitle)
1827 AliInfo(Form("createHisto 1D histo %s with %d non uniform nBins",name.Data(),n));
1828 TH1D * h = new TH1D(name,title,n,bins);
1829 h->GetXaxis()->SetTitle(xTitle);
1830 h->GetYaxis()->SetTitle(yTitle);
1836 //________________________________________________________________________
1837 TH2D * AliAnalysisTaskDptDptCorrelations::createHisto2D(const TString & name, const TString & title,
1838 int nx, double xMin, double xMax, int ny, double yMin, double yMax,
1839 const TString & xTitle, const TString & yTitle, const TString & zTitle)
1841 AliInfo(Form("createHisto 2D histo %s nx: %d xMin: %f10.4 xMax: %f10.4 ny: %d yMin: %f10.4 yMax: %f10.4",name.Data(),nx,xMin,xMax,ny,yMin,yMax));
1842 TH2D * h = new TH2D(name,title,nx,xMin,xMax,ny,yMin,yMax);
1843 h->GetXaxis()->SetTitle(xTitle);
1844 h->GetYaxis()->SetTitle(yTitle);
1845 h->GetZaxis()->SetTitle(zTitle);
1850 //________________________________________________________________________
1851 TH2D * AliAnalysisTaskDptDptCorrelations::createHisto2D(const TString & name, const TString & title,
1852 int nx, double* xbins, int ny, double yMin, double yMax,
1853 const TString & xTitle, const TString & yTitle, const TString & zTitle)
1855 AliInfo(Form("createHisto 2D histo %s with %d non uniform nBins",name.Data(),nx));
1857 h = new TH2D(name,title,nx,xbins,ny,yMin,yMax);
1858 h->GetXaxis()->SetTitle(xTitle);
1859 h->GetYaxis()->SetTitle(yTitle);
1860 h->GetZaxis()->SetTitle(zTitle);
1866 //________________________________________________________________________
1867 TH1F * AliAnalysisTaskDptDptCorrelations::createHisto1F(const TString & name, const TString & title,
1868 int n, double xMin, double xMax,
1869 const TString & xTitle, const TString & yTitle)
1871 //CreateHisto new 1D historgram
1872 AliInfo(Form("createHisto 1D histo %s nBins: %d xMin: %f xMax: %f",name.Data(),n,xMin,xMax));
1873 TH1F * h = new TH1F(name,title,n,xMin,xMax);
1874 h->GetXaxis()->SetTitle(xTitle);
1875 h->GetYaxis()->SetTitle(yTitle);
1881 //________________________________________________________________________
1882 TH1F * AliAnalysisTaskDptDptCorrelations::createHisto1F(const TString & name, const TString & title,
1883 int n, double * bins,
1884 const TString & xTitle, const TString & yTitle)
1886 AliInfo(Form("createHisto 1D histo %s with %d non uniform nBins",name.Data(),n));
1887 TH1F * h = new TH1F(name,title,n,bins);
1888 h->GetXaxis()->SetTitle(xTitle);
1889 h->GetYaxis()->SetTitle(yTitle);
1895 //________________________________________________________________________
1896 TH2F * AliAnalysisTaskDptDptCorrelations::createHisto2F(const TString & name, const TString & title,
1897 int nx, double xMin, double xMax, int ny, double yMin, double yMax,
1898 const TString & xTitle, const TString & yTitle, const TString & zTitle)
1900 AliInfo(Form("createHisto 2D histo %s nx: %d xMin: %f10.4 xMax: %f10.4 ny: %d yMin: %f10.4 yMax: %f10.4",name.Data(),nx,xMin,xMax,ny,yMin,yMax));
1901 TH2F * h = new TH2F(name,title,nx,xMin,xMax,ny,yMin,yMax);
1902 h->GetXaxis()->SetTitle(xTitle);
1903 h->GetYaxis()->SetTitle(yTitle);
1904 h->GetZaxis()->SetTitle(zTitle);
1909 //________________________________________________________________________
1910 TH2F * AliAnalysisTaskDptDptCorrelations::createHisto2F(const TString & name, const TString & title,
1911 int nx, double* xbins, int ny, double yMin, double yMax,
1912 const TString & xTitle, const TString & yTitle, const TString & zTitle)
1914 AliInfo(Form("createHisto 2D histo %s with %d non uniform nBins",name.Data(),nx));
1916 h = new TH2F(name,title,nx,xbins,ny,yMin,yMax);
1917 h->GetXaxis()->SetTitle(xTitle);
1918 h->GetYaxis()->SetTitle(yTitle);
1919 h->GetZaxis()->SetTitle(zTitle);
1925 //________________________________________________________________________
1926 TH3F * AliAnalysisTaskDptDptCorrelations::createHisto3F(const TString & name, const TString & title,
1927 int nx, double xMin, double xMax,
1928 int ny, double yMin, double yMax,
1929 int nz, double zMin, double zMax,
1930 const TString & xTitle, const TString & yTitle, const TString & zTitle)
1932 AliInfo(Form("createHisto 2D histo %s nx: %d xMin: %f10.4 xMax: %f10.4 ny: %d yMin: %f10.4 yMax: %f10.4 nz: %d zMin: %f10.4 zMax: %f10.4",name.Data(),nx,xMin,xMax,ny,yMin,yMax,nz,zMin,zMax));
1933 TH3F * h = new TH3F(name,title,nx,xMin,xMax,ny,yMin,yMax,nz,zMin,zMax);
1934 h->GetXaxis()->SetTitle(xTitle);
1935 h->GetYaxis()->SetTitle(yTitle);
1936 h->GetZaxis()->SetTitle(zTitle);
1942 //________________________________________________________________________
1943 TProfile * AliAnalysisTaskDptDptCorrelations::createProfile(const TString & name, const TString & description,
1944 int nx,double xMin,double xMax,
1945 const TString & xTitle, const TString & yTitle)
1947 AliInfo(Form("createHisto 1D profile %s nBins: %d xMin: %f10.4 xMax: %f10.4",name.Data(),nx,xMin,xMax));
1948 TProfile * h = new TProfile(name,description,nx,xMin,xMax);
1949 h->GetXaxis()->SetTitle(xTitle);
1950 h->GetYaxis()->SetTitle(yTitle);
1955 //________________________________________________________________________
1956 TProfile * AliAnalysisTaskDptDptCorrelations::createProfile(const TString & name,const TString & description,
1957 int nx, double* bins,
1958 const TString & xTitle, const TString & yTitle)
1960 AliInfo(Form("createHisto 1D profile %s with %d non uniform bins",name.Data(),nx));
1961 TProfile * h = new TProfile(name,description,nx,bins);
1962 h->GetXaxis()->SetTitle(xTitle);
1963 h->GetYaxis()->SetTitle(yTitle);
1969 void AliAnalysisTaskDptDptCorrelations::addToList(TH1 *h)
1971 if (_outputHistoList)
1973 _outputHistoList->Add(h);
1976 AliInfo("addToList(TH1 *h) _outputHistoList is null!!!!! Should abort ship");