]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/Correlations/DPhi/AliAnalysisTaskDptDptCorrelations.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGCF / Correlations / DPhi / AliAnalysisTaskDptDptCorrelations.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 #include "TChain.h"
17 #include "TList.h"
18 #include "TFile.h"
19 #include "TTree.h"
20 #include "TH1D.h"
21 #include "TH2D.h"
22 #include "TH3D.h"
23 #include "THnSparse.h"
24 #include "TCanvas.h"
25 #include "TRandom.h"
26
27 #include <TROOT.h>
28 #include <TChain.h>
29 #include <TFile.h>
30 #include <TList.h>
31 #include <TMath.h>
32 #include <TTree.h>
33 #include <TH1F.h>
34 #include <TH2F.h>
35 #include <TH3F.h>
36 #include <TProfile.h>
37 #include <TH1D.h>
38 #include <TH2D.h>
39 #include <TH3D.h>
40 #include "AliAnalysisManager.h"
41
42 #include "AliAODHandler.h"
43 #include "AliAODInputHandler.h"
44 #include "AliInputEventHandler.h"
45 #include "AliLog.h"
46 #include "AliESDEvent.h"
47 #include "AliESDInputHandler.h"
48 #include "AliMultiplicity.h"
49 #include "AliCentrality.h"
50 #include "AliAnalysisTaskDptDptCorrelations.h"
51
52 #include "AliPID.h"
53 #include "AliPIDResponse.h"
54
55 #include "AliESDVertex.h"
56 #include "AliESDEvent.h"
57 #include "AliESDInputHandler.h"
58 #include "AliAODEvent.h"
59 #include "AliAODTrack.h"
60 #include "AliAODInputHandler.h"
61 #include "AliESD.h"
62 #include "AliESDEvent.h"
63 #include "AliAODEvent.h"
64 #include "AliStack.h"
65 #include "AliESDtrackCuts.h"
66 #include "AliAODMCHeader.h"
67
68
69 #include "AliGenHijingEventHeader.h"
70 #include "AliGenEventHeader.h"
71 #include "AliPID.h"
72 #include "AliAODPid.h"
73 #include "AliPIDResponse.h"
74 #include "AliAODpidUtil.h"
75 #include "AliPIDCombined.h"
76
77
78
79 ClassImp(AliAnalysisTaskDptDptCorrelations)
80
81 AliAnalysisTaskDptDptCorrelations::AliAnalysisTaskDptDptCorrelations()
82 : AliAnalysisTaskSE(),
83 fAODEvent(0), 
84 fESDEvent(0),             //! ESD Event 
85 fInputHandler(0),
86 fPIDResponse(0x0),
87 _outputHistoList(0),
88 _twoPi         ( 2.0 * 3.1415927),
89 _eventCount    ( 0), 
90 _debugLevel    ( 0),
91 _singlesOnly   ( 0), 
92 _useWeights    ( 0), 
93 _sameFilter    ( false),
94 _rejectPileup  ( 1), 
95 _rejectPairConversion ( 0), 
96 _vertexZMin           ( -10), 
97 _vertexZMax           (  10), 
98 _vertexXYMin          ( -10),
99 _vertexXYMax          (  10),
100 _centralityMethod     (  4),
101 _centralityMin        (  0.),
102 _centralityMax        (  0.),
103 _requestedCharge_1    (   1),
104 _requestedCharge_2    (  -1),
105 _dcaZMin              ( -3), 
106 _dcaZMax              (  3.), 
107 _dcaXYMin             ( -2.4), 
108 _dcaXYMax             (  2.4),
109 _dedxMin              ( 0),
110 _dedxMax              ( 100000),
111 _nClusterMin          ( 80), 
112 _trackFilterBit       (0),
113 fNSigmaCut            (3.),
114 _tpcnclus             ( 50),
115 _chi2ndf              (5.),
116 _field    ( 1.),
117 _nTracks  ( 0 ),
118 _mult0    ( 0 ),
119 _mult1    ( 0 ),
120 _mult2    ( 0 ),
121 _mult3    ( 0 ),
122 _mult4    ( 0 ),
123 _mult4a    ( 0 ),
124 _mult5    ( 0 ),
125 _mult6    ( 0 ),
126 arraySize ( 2500),
127 _id_1(0),       
128 _charge_1(0),    
129 _iEtaPhi_1(0),    
130 _iPt_1(0),     
131 _pt_1(0),       
132 _px_1(0),      
133 _py_1(0),      
134 _pz_1(0),      
135 _correction_1(0),   
136 _dedx_1(0),   
137 _id_2(0),      
138 _charge_2(0),    
139 _iEtaPhi_2(0),    
140 _iPt_2(0),     
141 _pt_2(0),      
142 _px_2(0),      
143 _py_2(0),      
144 _pz_2(0),      
145 _correction_2(0),   
146 _dedx_2(0),   
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),
157
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),
161
162 _nBins_etaPhi_1(0), 
163 _nBins_etaPhiPt_1(0),
164 _nBins_zEtaPhiPt_1(0),
165
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),
169
170 _nBins_etaPhi_2(0), 
171 _nBins_etaPhiPt_2(0),
172 _nBins_zEtaPhiPt_2(0),
173 _nBins_etaPhi_12(0),
174 __n1_1(0),
175 __n1_2(0),
176 __n2_12(0),   
177 __s1pt_1(0),
178 __s1pt_2(0),
179 __s2ptpt_12(0),
180 __s2NPt_12(0),
181 __s2PtN_12(0),
182 __n1Nw_1(0),
183 __n1Nw_2(0),
184 __n2Nw_12(0),   
185 __s1ptNw_1(0),
186 __s1ptNw_2(0),
187 __s2ptptNw_12(0),
188 __s2NPtNw_12(0),
189 __s2PtNNw_12(0),
190 __n1_1_vsPt(0),
191 __n1_1_vsEtaPhi(0), 
192 __s1pt_1_vsEtaPhi(0),
193 __n1_1_vsZEtaPhiPt(0),
194 __n1_2_vsPt(0),
195 __n1_2_vsEtaPhi(0), 
196 __s1pt_2_vsEtaPhi(0),
197 __n1_2_vsZEtaPhiPt(0),
198 __n2_12_vsPtPt(0),
199 __n2_12_vsEtaPhi(0),
200 __s2ptpt_12_vsEtaPhi(0),
201 __s2PtN_12_vsEtaPhi(0),
202 __s2NPt_12_vsEtaPhi(0),
203 _weight_1      ( 0    ),
204 _weight_2      ( 0    ),
205 _eventAccounting ( 0),
206 _m0 ( 0),
207 _m1 ( 0),
208 _m2 ( 0),
209 _m3 ( 0),
210 _m4 ( 0),
211 _m5 ( 0),
212 _m6 ( 0),
213 _vertexZ ( 0),
214   
215 _Ncluster1  ( 0),
216 _Ncluster2  ( 0),
217 _etadis ( 0),
218 _phidis ( 0),
219 _dcaz   ( 0),
220 _dcaxy  ( 0),
221 _n1_1_vsPt         ( 0),         
222 _n1_1_vsEtaVsPhi   ( 0),
223 _s1pt_1_vsEtaVsPhi ( 0), 
224 _n1_1_vsZVsEtaVsPhiVsPt ( 0),
225 _n1_1_vsM          ( 0), 
226 _s1pt_1_vsM        ( 0),
227 _n1Nw_1_vsM        ( 0),
228 _s1ptNw_1_vsM      ( 0),
229 _dedxVsP_1         ( 0),
230 _corrDedxVsP_1     ( 0),
231 _betaVsP_1         ( 0),
232 _n1_2_vsPt         ( 0),       
233 _n1_2_vsEtaVsPhi   ( 0),
234 _s1pt_2_vsEtaVsPhi ( 0),
235 _n1_2_vsZVsEtaVsPhiVsPt ( 0), 
236 _n1_2_vsM          ( 0),
237 _s1pt_2_vsM        ( 0),
238 _n1Nw_2_vsM        ( 0),
239 _s1ptNw_2_vsM      ( 0),
240 _dedxVsP_2         ( 0),
241 _corrDedxVsP_2     ( 0),
242 _betaVsP_2         ( 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),     
248 _n2_12_vsM         ( 0),        
249 _s2PtPt_12_vsM     ( 0),    
250 _s2PtN_12_vsM      ( 0),       
251 _s2NPt_12_vsM      ( 0), 
252 _n2Nw_12_vsM       ( 0),        
253 _s2PtPtNw_12_vsM   ( 0),    
254 _s2PtNNw_12_vsM    ( 0),       
255 _s2NPtNw_12_vsM    ( 0), 
256 _invMass           ( 0),
257 _invMassElec       ( 0),
258 n1Name("NA"),
259 n1NwName("NA"),
260 n2Name("NA"),
261 n2NwName("NA"),
262 n3Name("NA"),
263 n1n1Name("NA"),
264 n1n1n1Name("NA"),
265 n2n1Name("NA"),
266 r1Name("NA"),
267 r2Name("NA"),
268 r3Name("NA"),
269 r2r1Name("NA"),
270 c2Name("NA"),
271 c3Name("NA"),
272 d3Name("NA"),
273 p3Name("NA"),
274 cName("NA"),
275
276 intR2Name("NA"),
277 binCorrName("NA"),
278 intBinCorrName("NA"),
279
280 countsName("NA"),
281 part_1_Name("NA"),
282 part_2_Name("NA"),
283 part_3_Name("NA"),
284 pair_12_Name("NA"),
285 pair_13_Name("NA"),
286 pair_23_Name("NA"),
287 tripletName("NA"),
288
289 avg("NA"),
290 avgName("NA"),
291 sumName("NA"),
292 s1ptName("NA"),
293 s1ptNwName("NA"),
294 s1DptName("NA"),
295
296 s2PtPtName("NA"),
297 s2NPtName("NA"),
298 s2PtNName("NA"),
299 s2DptDptName("NA"),
300
301 s2PtPtNwName("NA"),
302 s2NPtNwName("NA"),
303 s2PtNNwName("NA"),
304
305 ptName("NA"),
306 ptptName("NA"),
307 pt1pt1Name("NA"),
308 DptName("NA"),
309 DptDptName("NA"),
310 RDptDptName("NA"),
311 nPtName("NA"),
312 ptNName("NA"),
313 seanName("NA"),
314
315 _title_counts("NA"),
316
317 _title_m0("NA"),
318 _title_m1("NA"),
319 _title_m2("NA"),
320 _title_m3("NA"),
321 _title_m4("NA"),
322 _title_m5("NA"),
323 _title_m6("NA"),
324
325 _title_eta_1("NA"),
326 _title_phi_1("NA"),
327 _title_pt_1("NA"),
328 _title_etaPhi_1("NA"),
329 _title_n_1("NA"),
330 _title_SumPt_1("NA"),
331 _title_AvgPt_1("NA"),
332 _title_AvgN_1("NA"),
333 _title_AvgSumPt_1("NA"),
334
335 _title_eta_2("NA"),
336 _title_phi_2("NA"),
337 _title_pt_2("NA"),
338 _title_etaPhi_2("NA"),
339 _title_n_2("NA"),
340 _title_SumPt_2("NA"),
341 _title_AvgPt_2("NA"),
342 _title_AvgN_2("NA"),
343 _title_AvgSumPt_2("NA"),
344
345 _title_etaPhi_12("NA"),
346
347 _title_AvgN2_12("NA"),
348 _title_AvgSumPtPt_12("NA"),
349 _title_AvgSumPtN_12("NA"),
350 _title_AvgNSumPt_12("NA"),
351
352 vsZ("NA"),
353 vsM("NA"),
354 vsPt("NA"),
355 vsPhi("NA"), 
356 vsEta("NA"), 
357 vsEtaPhi("NA"), 
358 vsPtVsPt("NA")
359 {
360   printf("Default constructor called \n");
361   
362   printf("passed \n ");
363   
364 }
365
366 AliAnalysisTaskDptDptCorrelations::AliAnalysisTaskDptDptCorrelations(const TString & name)
367 : AliAnalysisTaskSE(name),
368 fAODEvent(0), 
369 fESDEvent(0),  
370 fInputHandler(0),
371 fPIDResponse(0),
372 _outputHistoList(0),
373 _twoPi         ( 2.0 * 3.1415927),
374 _eventCount    ( 0), 
375 _debugLevel    ( 0),
376 _singlesOnly   ( 0), 
377 _useWeights    ( 0), 
378 _sameFilter    ( false),
379 _rejectPileup  ( 1), 
380 _rejectPairConversion ( 0), 
381 _vertexZMin           ( -10.), 
382 _vertexZMax           (  10.), 
383 _vertexXYMin          ( -10.),
384 _vertexXYMax          (  10.),
385 _centralityMethod     (  4),
386 _centralityMin        (  0.),
387 _centralityMax        (  1.),
388 _requestedCharge_1    (   1),
389 _requestedCharge_2    (  -1),
390 _dcaZMin              ( -3), 
391 _dcaZMax              (  3.), 
392 _dcaXYMin             ( -2.4), 
393 _dcaXYMax             (  2.4),
394 _dedxMin              ( 0),
395 _dedxMax              ( 100000),
396 _nClusterMin          ( 80), 
397 _trackFilterBit       ( 0),
398 fNSigmaCut            ( 3.),
399 _tpcnclus             ( 50),
400 _chi2ndf              (5.),
401 _field    ( 1.),
402 _nTracks  ( 0 ),
403 _mult0    ( 0 ),
404 _mult1    ( 0 ),
405 _mult2    ( 0 ),
406 _mult3    ( 0 ),
407 _mult4    ( 0 ),
408 _mult4a    ( 0 ),
409 _mult5    ( 0 ),
410 _mult6    ( 0 ),
411 arraySize ( 2500),
412 _id_1(0),       
413 _charge_1(0),    
414 _iEtaPhi_1(0),    
415 _iPt_1(0),     
416 _pt_1(0),       
417 _px_1(0),      
418 _py_1(0),      
419 _pz_1(0),      
420 _correction_1(0),   
421 _dedx_1(0),   
422 _id_2(0),      
423 _charge_2(0),    
424 _iEtaPhi_2(0),    
425 _iPt_2(0),     
426 _pt_2(0),      
427 _px_2(0),      
428 _py_2(0),      
429 _pz_2(0),      
430 _correction_2(0),   
431 _dedx_2(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),
442
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),
446
447 _nBins_etaPhi_1(0), 
448 _nBins_etaPhiPt_1(0),
449 _nBins_zEtaPhiPt_1(0),
450
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),
454
455 _nBins_etaPhi_2(0), 
456 _nBins_etaPhiPt_2(0),
457 _nBins_zEtaPhiPt_2(0),
458 _nBins_etaPhi_12(0),
459 __n1_1(0),
460 __n1_2(0),
461 __n2_12(0),   
462 __s1pt_1(0),
463 __s1pt_2(0),
464 __s2ptpt_12(0),
465 __s2NPt_12(0),
466 __s2PtN_12(0),
467 __n1Nw_1(0),
468 __n1Nw_2(0),
469 __n2Nw_12(0),   
470 __s1ptNw_1(0),
471 __s1ptNw_2(0),
472 __s2ptptNw_12(0),
473 __s2NPtNw_12(0),
474 __s2PtNNw_12(0),
475 __n1_1_vsPt(0),
476 __n1_1_vsEtaPhi(0), 
477 __s1pt_1_vsEtaPhi(0),
478 __n1_1_vsZEtaPhiPt(0),
479 __n1_2_vsPt(0),
480 __n1_2_vsEtaPhi(0), 
481 __s1pt_2_vsEtaPhi(0),
482 __n1_2_vsZEtaPhiPt(0),
483 __n2_12_vsPtPt(0),
484 __n2_12_vsEtaPhi(0),
485 __s2ptpt_12_vsEtaPhi(0),
486 __s2PtN_12_vsEtaPhi(0),
487 __s2NPt_12_vsEtaPhi(0),
488 _weight_1        ( 0    ),
489 _weight_2        ( 0    ),
490 _eventAccounting ( 0),
491 _m0 ( 0),
492 _m1 ( 0),
493 _m2 ( 0),
494 _m3 ( 0),
495 _m4 ( 0),
496 _m5 ( 0),
497 _m6 ( 0),
498 _vertexZ ( 0),
499 _Ncluster1  ( 0),
500 _Ncluster2  ( 0),
501 _etadis ( 0),
502 _phidis ( 0),
503
504 _dcaz ( 0),
505 _dcaxy ( 0),
506 _n1_1_vsPt         ( 0),         
507 _n1_1_vsEtaVsPhi   ( 0),
508 _s1pt_1_vsEtaVsPhi ( 0), 
509 _n1_1_vsZVsEtaVsPhiVsPt ( 0),
510 _n1_1_vsM          ( 0), 
511 _s1pt_1_vsM        ( 0),
512 _n1Nw_1_vsM        ( 0), 
513 _s1ptNw_1_vsM      ( 0),
514 _dedxVsP_1         ( 0),
515 _corrDedxVsP_1     ( 0),
516 _betaVsP_1         ( 0),
517 _n1_2_vsPt         ( 0),       
518 _n1_2_vsEtaVsPhi   ( 0),
519 _s1pt_2_vsEtaVsPhi ( 0),
520 _n1_2_vsZVsEtaVsPhiVsPt ( 0), 
521 _n1_2_vsM          ( 0),
522 _s1pt_2_vsM        ( 0),
523 _n1Nw_2_vsM        ( 0),
524 _s1ptNw_2_vsM      ( 0),
525 _dedxVsP_2         ( 0),
526 _corrDedxVsP_2     ( 0),
527 _betaVsP_2         ( 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),     
533 _n2_12_vsM         ( 0),        
534 _s2PtPt_12_vsM     ( 0),    
535 _s2PtN_12_vsM      ( 0),       
536 _s2NPt_12_vsM      ( 0), 
537 _n2Nw_12_vsM       ( 0),        
538 _s2PtPtNw_12_vsM   ( 0),    
539 _s2PtNNw_12_vsM    ( 0),       
540 _s2NPtNw_12_vsM    ( 0), 
541 _invMass           ( 0),
542 _invMassElec       ( 0),
543 n1Name("NA"),
544 n1NwName("NA"),
545 n2Name("NA"),
546 n2NwName("NA"),
547 n3Name("NA"),
548 n1n1Name("NA"),
549 n1n1n1Name("NA"),
550 n2n1Name("NA"),
551 r1Name("NA"),
552 r2Name("NA"),
553 r3Name("NA"),
554 r2r1Name("NA"),
555 c2Name("NA"),
556 c3Name("NA"),
557 d3Name("NA"),
558 p3Name("NA"),
559 cName("NA"),
560
561 intR2Name("NA"),
562 binCorrName("NA"),
563 intBinCorrName("NA"),
564
565 countsName("NA"),
566 part_1_Name("NA"),
567 part_2_Name("NA"),
568 part_3_Name("NA"),
569 pair_12_Name("NA"),
570 pair_13_Name("NA"),
571 pair_23_Name("NA"),
572 tripletName("NA"),
573
574 avg("NA"),
575 avgName("NA"),
576 sumName("NA"),
577 s1ptName("NA"),
578 s1ptNwName("NA"),
579 s1DptName("NA"),
580
581 s2PtPtName("NA"),
582 s2NPtName("NA"),
583 s2PtNName("NA"),
584 s2DptDptName("NA"),
585
586 s2PtPtNwName("NA"),
587 s2NPtNwName("NA"),
588 s2PtNNwName("NA"),
589
590 ptName("NA"),
591 ptptName("NA"),
592 pt1pt1Name("NA"),
593 DptName("NA"),
594 DptDptName("NA"),
595 RDptDptName("NA"),
596 nPtName("NA"),
597 ptNName("NA"),
598 seanName("NA"),
599
600 _title_counts("NA"),
601
602 _title_m0("NA"),
603 _title_m1("NA"),
604 _title_m2("NA"),
605 _title_m3("NA"),
606 _title_m4("NA"),
607 _title_m5("NA"),
608 _title_m6("NA"),
609
610 _title_eta_1("NA"),
611 _title_phi_1("NA"),
612 _title_pt_1("NA"),
613 _title_etaPhi_1("NA"),
614 _title_n_1("NA"),
615 _title_SumPt_1("NA"),
616 _title_AvgPt_1("NA"),
617 _title_AvgN_1("NA"),
618 _title_AvgSumPt_1("NA"),
619
620 _title_eta_2("NA"),
621 _title_phi_2("NA"),
622 _title_pt_2("NA"),
623 _title_etaPhi_2("NA"),
624 _title_n_2("NA"),
625 _title_SumPt_2("NA"),
626 _title_AvgPt_2("NA"),
627 _title_AvgN_2("NA"),
628 _title_AvgSumPt_2("NA"),
629
630 _title_etaPhi_12("NA"),
631
632 _title_AvgN2_12("NA"),
633 _title_AvgSumPtPt_12("NA"),
634 _title_AvgSumPtN_12("NA"),
635 _title_AvgNSumPt_12("NA"),
636
637 vsZ("NA"),
638 vsM("NA"),
639 vsPt("NA"),
640 vsPhi("NA"), 
641 vsEta("NA"), 
642 vsEtaPhi("NA"), 
643 vsPtVsPt("NA")
644 {
645   printf("2nd constructor called ");
646   
647   DefineOutput(0, TList::Class());
648   
649   printf("passed  ");
650   
651 }
652
653 AliAnalysisTaskDptDptCorrelations::~AliAnalysisTaskDptDptCorrelations()
654 {
655   
656 }
657
658 void AliAnalysisTaskDptDptCorrelations::UserCreateOutputObjects()
659 {
660   OpenFile(0);
661   _outputHistoList = new TList();
662   _outputHistoList->SetOwner();
663   
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;
671   
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;
682   
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;
690     
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];
700   _dedx_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.);
705   
706     
707   if (_requestedCharge_2!=_requestedCharge_1)
708     {
709       _sameFilter = 0;
710     //particle 2
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];
720     _dedx_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.);
725     
726     }
727   
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.);
733   
734   // Setup all the labels needed.
735   
736   part_1_Name   = "_1";
737   part_2_Name   = "_2";
738   pair_12_Name  = "_12";
739   
740   n1Name     = "n1";
741   n2Name     = "n2";
742   n1NwName   = "n1Nw";
743   n2NwName   = "n2Nw";
744   r1Name     = "r1";
745   r2Name     = "r2";
746   r3Name     = "r3";
747   r2r1Name   = "r2r1";
748   c2Name     = "c2";
749   c3Name     = "c3";
750   d3Name     = "d3";
751   p3Name     = "p3";
752   cName      = "sean";
753   
754   intR2Name       = "intR2";
755   binCorrName     = "binCorr";
756   intBinCorrName  = "intBinCorr";
757   
758   avgName      = "avg";
759   sumName      = "sum";
760   s1ptName     = "sumPt";
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";
771   ptName       = "avgPt";
772   ptptName     = "avgPtPt";
773   pt1pt1Name   = "avgPtavgPt";
774   DptName      = "avgDpt";
775   DptDptName   = "avgDptDpt";
776   RDptDptName  = "relDptDpt"; // ratio of avgDptDpt by avgPt*avgPt
777   nPtName      = "avgNpt";
778   ptNName      = "avgPtN";
779   seanName     = "seanC";
780   
781   _title_counts = "yield";
782   
783   _title_m0     = "M_{0}";
784   _title_m1     = "M_{1}";
785   _title_m2     = "M_{2}";
786   _title_m3     = "M_{3}";
787   _title_m4     = "V0Centrality";
788   _title_m5     = "TrkCentrality";
789   _title_m6     = "SpdCentrality";
790   
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)";
800   
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)";
810   
811   _title_etaPhi_12   = "#eta_{1}#times#varphi_{1}#times#eta_{2}#times#varphi_{2}";
812   
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";;
817   
818   
819   vsZ         = "_vsZ";
820   vsM         = "_vsM";
821   vsPt         = "_vsPt";
822   vsPhi        = "_vsPhi"; 
823   vsEta        = "_vsEta"; 
824   vsEtaPhi     = "_vsEtaPhi"; 
825   vsPtVsPt     = "_vsPtVsPt";
826   
827   
828   if (_useWeights)
829     {
830     int iZ, iEtaPhi, iPt;
831     int iZ1,iEtaPhi1,iPt1;
832     int a, b;
833     if (_weight_1)
834       {
835       _correctionWeight_1 = new float[_nBins_vertexZ*_nBins_etaPhi_1*_nBins_pt_1];
836       a = _nBins_pt_1;
837       b = _nBins_etaPhi_1*_nBins_pt_1;
838       for (iZ=0,iZ1=1; iZ<_nBins_vertexZ; iZ++, iZ1++)
839         {
840         for (iEtaPhi=0,iEtaPhi1=1; iEtaPhi<_nBins_etaPhi_1; iEtaPhi++, iEtaPhi1++)
841           {
842           for (iPt=0,iPt1=1; iPt<_nBins_pt_1; iPt++, iPt1++)
843             {
844             _correctionWeight_1[iZ*b+iEtaPhi*a+iPt] = _weight_1->GetBinContent(iZ1,iEtaPhi1,iPt1);
845             }      
846           }
847         }
848       } // _weight_1
849     else
850       {
851       AliError("AliAnalysisTaskDptDptCorrelations:: _weight_1 is a null pointer.");
852       return;
853       }
854     if (!_sameFilter) 
855       {
856       if (_weight_2)
857         {
858         _correctionWeight_2 = new float[_nBins_vertexZ*_nBins_etaPhi_2*_nBins_pt_2];
859         a = _nBins_pt_2;
860         b = _nBins_etaPhi_2*_nBins_pt_2;
861         for (iZ=0,iZ1=1; iZ<_nBins_vertexZ; iZ++, iZ1++)
862           {
863           for (iEtaPhi=0,iEtaPhi1=1; iEtaPhi<_nBins_etaPhi_2; iEtaPhi++, iEtaPhi1++)
864             {
865             for (iPt=0,iPt1=1; iPt<_nBins_pt_2; iPt++, iPt1++)
866               {
867               _correctionWeight_2[iZ*b+iEtaPhi*a+iPt] = _weight_2->GetBinContent(iZ1,iEtaPhi1,iPt1);
868               }      
869             }
870           }
871         } // _weight_2
872       else
873         {
874         AliError("AliAnalysisTaskDptDptCorrelations:: _weight_1 is a null pointer.");
875         return;
876         }
877       }
878     }
879   
880   createHistograms();
881   PostData(0,_outputHistoList);
882   
883   //cout<< "AliAnalysisTaskDptDptCorrelations::CreateOutputObjects() DONE " << endl;
884   
885 }
886
887 void  AliAnalysisTaskDptDptCorrelations::createHistograms()
888 {
889   AliInfo(" AliAnalysisTaskDptDptCorrelations::createHistoHistograms() Creating Event Histos");
890   TString name;
891   
892   name = "eventAccounting";
893   
894    _eventAccounting      = createHisto1D(name,name,10, -0.5, 9.5, "event Code", _title_counts);
895   
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);
904   
905
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");
910
911   name = "Nclus1";   _Ncluster1    = createHisto1F(name,name, 200, 0, 200, "Ncluster1","counts");
912   //name = "Nclus2";   _Ncluster2    = createHisto1F(name,name, 200, 0, 200, "Ncluster2","counts");
913   
914   if (_singlesOnly)
915     {
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);
918
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);
921
922     }
923   else
924     {
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);
931
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);
938
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);        
944     
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);     
949     
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);     
954     
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"); 
957     }
958   
959   AliInfo(" AliAnalysisTaskDptDptCorrelations::createHistoHistograms() All Done"); 
960 }
961 //-----------------------//
962
963 void  AliAnalysisTaskDptDptCorrelations::finalizeHistograms()
964 {
965   
966   AliInfo("AliAnalysisTaskDptDptCorrelations::finalizeHistograms() starting");
967   AliInfo(Form("CorrelationAnalyzers::finalizeHistograms()   _eventCount : %d",int(_eventCount)));
968   if (_singlesOnly)
969     {
970     if (_sameFilter)
971       {
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);
976       }
977     else
978       {
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);
983       }
984     }
985   else
986     {
987     if (_sameFilter)
988       {
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);
993       }
994     else
995       {
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);
1000       }
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);
1006
1007     }  
1008   AliInfo("AliAnalysisTaskDptDptCorrelations::finalizeHistograms()  Done ");
1009 }
1010 //--------------//
1011
1012
1013 void  AliAnalysisTaskDptDptCorrelations::UserExec(Option_t */*option*/)
1014 {
1015   
1016   int    k1,k2;
1017   int    iPhi, iEta, iEtaPhi, iPt, charge;
1018   float  q, phi, pt, eta, corr, corrPt, px, py, pz, dedx;
1019   int    ij;
1020   int    id_1, q_1, iEtaPhi_1, iPt_1;
1021   float  pt_1, px_1, py_1, pz_1, corr_1, dedx_1;
1022   int    id_2, q_2, iEtaPhi_2, iPt_2;
1023   float  pt_2, px_2, py_2, pz_2, corr_2, dedx_2;
1024   float  ptpt;
1025   int    iVertex, iVertexP1, iVertexP2;
1026   int    iZEtaPhiPt;
1027   float  massElecSq = 1.94797849000000016e-02;
1028   //double b[2];
1029   //double bCov[3];
1030   const  AliAODVertex*  vertex;
1031   int    nClus;
1032   bool   bitOK;
1033   
1034   AliAnalysisManager* manager = AliAnalysisManager::GetAnalysisManager();
1035   if (!manager) {
1036     return;
1037   }
1038   AliAODInputHandler* inputHandler = dynamic_cast<AliAODInputHandler*> (manager->GetInputEventHandler());
1039   if (!inputHandler) {
1040     return;
1041   }
1042   
1043   fAODEvent = dynamic_cast<AliAODEvent*>(InputEvent());
1044   //AliAODEvent* fAODEvent = dynamic_cast<AliAODEvent*>(InputEvent());
1045   
1046   if (!fAODEvent)
1047     {
1048       return;
1049     }
1050   fPIDResponse =inputHandler->GetPIDResponse();
1051   if (!fPIDResponse){
1052     AliFatal("This Task needs the PID response attached to the inputHandler");
1053     return;
1054   }
1055   
1056   // count all events looked at here
1057   _eventCount++;
1058   
1059   if (_eventAccounting)
1060     {
1061       _eventAccounting->Fill(0);// count all calls to this function
1062     }
1063   else 
1064     {
1065       
1066       return;
1067     }
1068   
1069   _eventAccounting->Fill(1);// count all calls to this function with a valid pointer
1070   //reset single particle counters
1071   k1 = k2 = 0;
1072   __n1_1 = __n1_2 = __s1pt_1 = __s1pt_2 = __n1Nw_1 = __n1Nw_2 = __s1ptNw_1 = __s1ptNw_2 = 0;
1073   
1074   float v0Centr  = -999.;
1075   float v0ACentr  = -999.;
1076   float trkCentr = -999.;
1077   float spdCentr = -999.;
1078   
1079   float vertexX  = -999;
1080   float vertexY  = -999;
1081   float vertexZ  = -999;
1082   //float vertexXY = -999;
1083   //float dcaZ     = -999;
1084   //float dcaXY    = -999;
1085   float centrality = -999;
1086   
1087   if(fAODEvent)
1088     {
1089       //Centrality
1090       AliCentrality* centralityObject =  fAODEvent->GetHeader()->GetCentralityP();
1091       if (centralityObject)
1092         {
1093           //cout << "AliAnalysisTaskDptDptCorrelations::UserExec(Option_t *option) - 6" << endl;
1094           
1095           v0Centr  = centralityObject->GetCentralityPercentile("V0M");
1096           v0ACentr  = centralityObject->GetCentralityPercentile("V0A");
1097           trkCentr = centralityObject->GetCentralityPercentile("TRK"); 
1098           spdCentr = centralityObject->GetCentralityPercentile("CL1");
1099           
1100         }
1101       
1102       _nTracks  =fAODEvent->GetNumberOfTracks();//NEW Test
1103       
1104       _mult3    = _nTracks; 
1105       _mult4    = v0Centr;
1106       _mult4a    = v0ACentr;
1107       _mult5    = trkCentr;
1108       _mult6    = spdCentr;
1109       _field    = fAODEvent->GetMagneticField(); 
1110       
1111       //_centralityMethod
1112       switch (_centralityMethod)
1113         {
1114         case 0: centrality = _mult0; break;
1115         case 1: centrality = _mult1; break;
1116         case 2: centrality = _mult2; break;
1117         case 3: centrality = _mult3; break;
1118         case 4: centrality = _mult4; break;
1119         case 5: centrality = _mult5; break;
1120         case 6: centrality = _mult6; break;
1121         case 7: centrality = _mult4a; break;
1122         }
1123       
1124       
1125       if ( centrality < _centralityMin ||  centrality > _centralityMax )
1126         {
1127           return;
1128         }
1129       _eventAccounting->Fill(2);// count all events with right centrality
1130       
1131       // filter on z and xy vertex
1132       vertex = (AliAODVertex*) fAODEvent->GetPrimaryVertex();
1133       // Double_t V[2];
1134       //vertex->GetXYZ(V);      
1135
1136       if(vertex)
1137         {
1138           Double32_t fCov[6];
1139           vertex->GetCovarianceMatrix(fCov);
1140           if(vertex->GetNContributors() > 0)
1141             {
1142               if(fCov[5] != 0)
1143                 {
1144                   vertexX = vertex->GetX();
1145                   vertexY = vertex->GetY();
1146                   vertexZ = vertex->GetZ();
1147                   
1148                   if(TMath::Abs(vertexZ) > 10)
1149                     {
1150                       return;
1151                     } // Z-Vertex Cut  
1152                 }
1153             }
1154         }
1155       
1156       _vertexZ->Fill(vertexZ);
1157       
1158       iVertex = int((vertexZ-_min_vertexZ)/_width_vertexZ);
1159       iVertexP1 = iVertex*_nBins_etaPhiPt_1;
1160       iVertexP2 = iVertex*_nBins_etaPhiPt_2;
1161       if (iVertex<0 || iVertex>=_nBins_vertexZ)
1162         {
1163           AliError("AliAnalysisTaskDptDptCorrelations::Exec(Option_t *option) iVertex<0 || iVertex>=_nBins_vertexZ ");
1164           return;
1165         }
1166       _eventAccounting->Fill(3);// count all calls to this function with a valid pointer
1167       //====================== 
1168       
1169       //*********************************************************
1170        TExMap *trackMap = new TExMap();//Mapping matrix----                                            
1171
1172       //1st loop track for Global tracks                                                                                
1173       for(Int_t i = 0; i < _nTracks; i++)
1174         {
1175           AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(fAODEvent->GetTrack(i));
1176           if(!aodTrack) {
1177             AliError(Form("ERROR: Could not retrieve AODtrack %d",i));
1178             continue;
1179           }
1180           Int_t gID = aodTrack->GetID();
1181           if (aodTrack->TestFilterBit(1)) trackMap->Add(gID, i);//Global tracks                       
1182           }
1183            
1184       AliAODTrack* newAodTrack;
1185       
1186       //Track Loop starts here
1187       for (int iTrack=0; iTrack< _nTracks; iTrack++)
1188         {
1189           AliAODTrack* t = dynamic_cast<AliAODTrack *>(fAODEvent->GetTrack(iTrack));
1190           if (!t) {
1191             AliError(Form("Could not receive track %d", iTrack));
1192             continue;
1193           }
1194           
1195           bitOK  = t->TestFilterBit(_trackFilterBit);
1196           if (!bitOK) continue; //128bit or 272bit
1197           
1198           Int_t gID = t->GetID();
1199           newAodTrack = gID >= 0 ?t : fAODEvent->GetTrack(trackMap->GetValue(-1-gID));
1200           
1201           q      = t->Charge();
1202           charge = int(q);
1203           phi    = t->Phi();
1204           pt     = t->Pt();
1205           px     = t->Px();
1206           py     = t->Py();
1207           pz     = t->Pz();
1208           eta    = t->Eta();
1209           dedx   = t->GetTPCsignal();
1210           //dcaXY = t->DCA(); 
1211           //dcaZ  = t->ZAtDCA();  
1212           nClus  = t->GetTPCNcls();       
1213           
1214            if ( nClus<_nClusterMin ) continue;
1215           
1216           _Ncluster1->Fill(nClus);
1217           
1218           /*
1219           //cuts on more than 0 shared cluster (suggested by Michael)
1220           if(t->GetTPCnclsS() > 0){
1221           continue;
1222           }*/
1223           
1224           //for Global tracks
1225            Double_t nsigmaelectron = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,(AliPID::EParticleType)AliPID::kElectron));
1226           Double_t nsigmapion = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,(AliPID::EParticleType)AliPID::kPion));
1227           Double_t nsigmakaon = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,(AliPID::EParticleType)AliPID::kKaon));
1228           Double_t nsigmaproton = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,(AliPID::EParticleType)AliPID::kProton));
1229           
1230           //nsigma cut to reject electron 
1231           
1232           if(nsigmaelectron  < fNSigmaCut
1233              && nsigmapion   > fNSigmaCut
1234              && nsigmakaon   > fNSigmaCut
1235              && nsigmaproton > fNSigmaCut ) continue;
1236           
1237
1238           if(charge == 0) continue;
1239           // Kinematics cuts used                                                                                        
1240           if( pt < _min_pt_1 || pt > _max_pt_1) continue;
1241           if( eta < _min_eta_1 || eta > _max_eta_1) continue;
1242           
1243           /*      Double_t pos[3];
1244           newAodTrack->GetXYZ(pos);
1245
1246           Double_t DCAX = pos[0] - vertexX;
1247           Double_t DCAY = pos[1] - vertexY;
1248           Double_t DCAZ = pos[2] - vertexZ;
1249                 
1250           Double_t DCAXY = TMath::Sqrt((DCAX*DCAX) + (DCAY*DCAY));
1251           
1252           if (DCAZ     <  _dcaZMin || 
1253               DCAZ     >  _dcaZMax ||
1254               DCAXY    >  _dcaXYMax ) continue; 
1255           */
1256
1257             //------- Eff. test---------- //just for checking
1258           //Double_t yy = (1 - 0.7)/1.8;
1259           //Double_t zz = (pt - 0.2);
1260           //Double_t effValue = 0.7 + yy*zz;
1261           //Double_t R = gRandom->Rndm();
1262           //if(R > effValue) continue;
1263           //---------------------------   
1264           
1265           //==== QA ===========================
1266           //_dcaz->Fill(DCAZ);
1267           //_dcaxy->Fill(DCAXY);
1268           _etadis->Fill(eta);
1269           //_phidis->Fill(phi);
1270           //===================================
1271           //*************************************************
1272                   
1273           //Particle 1
1274           if (_requestedCharge_1 == charge && dedx >=  _dedxMin && dedx < _dedxMax)
1275             {
1276               iPhi   = int( phi/_width_phi_1);
1277               
1278               if (iPhi<0 || iPhi>=_nBins_phi_1 ) 
1279                 {
1280                   AliWarning("AliAnalysisTaskDptDptCorrelations::analyze() iPhi<0 || iPhi>=_nBins_phi_1");
1281                   return;
1282                 }
1283               
1284               iEta    = int((eta-_min_eta_1)/_width_eta_1); 
1285               if (iEta<0 || iEta>=_nBins_eta_1) 
1286                 {
1287                   AliWarning(Form("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) Mismatched iEta: %d", iEta));
1288                   continue;
1289                 }
1290               iPt     = int((pt -_min_pt_1 )/_width_pt_1 ); 
1291               if (iPt<0  || iPt >=_nBins_pt_1)
1292                 {
1293                   AliWarning(Form("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) Mismatched iPt: %d",iPt));
1294                   continue;
1295                 }
1296               iEtaPhi = iEta*_nBins_phi_1+iPhi;
1297               iZEtaPhiPt = iVertexP1 + iEtaPhi*_nBins_pt_1 + iPt;
1298               
1299               if (_correctionWeight_1)
1300                 corr = _correctionWeight_1[iZEtaPhiPt];
1301               else
1302                 corr = 1;
1303               if (iZEtaPhiPt<0 || iZEtaPhiPt>=_nBins_zEtaPhiPt_1)
1304                 {
1305                   AliWarning("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) iZEtaPhiPt<0 || iZEtaPhiPt>=_nBins_zEtaPhiPt_1");
1306                   continue;
1307                 }
1308               
1309               
1310               if (_singlesOnly)
1311                 {
1312                   
1313                   __n1_1_vsPt[iPt]               += corr;          //cout << "step 15" << endl;
1314                   __n1_1_vsZEtaPhiPt[iZEtaPhiPt] += corr;       //cout << "step 12" << endl;
1315                   
1316                 }
1317               else
1318                 {
1319                   corrPt                      = corr*pt;
1320                   _id_1[k1]                   = iTrack;     
1321                   _charge_1[k1]               = charge;
1322                   _iEtaPhi_1[k1]              = iEtaPhi; 
1323                   _iPt_1[k1]                  = iPt;   
1324                   _pt_1[k1]                   = pt;   
1325                   _px_1[k1]                   = px;   
1326                   _py_1[k1]                   = py;   
1327                   _pz_1[k1]                   = pz;   
1328                   _correction_1[k1]           = corr; 
1329                   __n1_1                      += corr;
1330                   __n1_1_vsEtaPhi[iEtaPhi]    += corr; 
1331                   __s1pt_1                    += corrPt;
1332                   __s1pt_1_vsEtaPhi[iEtaPhi]  += corrPt;
1333                   __n1Nw_1                    += 1;
1334                   __s1ptNw_1                  += pt;
1335                   ++k1;
1336                   if (k1>=arraySize)
1337                     {
1338                       AliError(Form("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) k1 >=arraySize; arraySize: %d",arraySize));
1339                       return;
1340                     }
1341                 }
1342             }
1343           
1344           if (!_sameFilter && _requestedCharge_2 == charge && 
1345               dedx >=  _dedxMin && dedx < _dedxMax)
1346                
1347             {
1348               
1349               iPhi   = int( phi/_width_phi_2);
1350               
1351               if (iPhi<0 || iPhi>=_nBins_phi_2 ) 
1352                 {
1353                   AliWarning("AliAnalysisTaskDptDptCorrelations::analyze() iPhi<0 || iPhi>=_nBins_phi_1");
1354                   return;
1355                 }
1356               
1357               iEta    = int((eta-_min_eta_2)/_width_eta_2);
1358               if (iEta<0 || iEta>=_nBins_eta_2) 
1359                 {
1360                   AliWarning(Form("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) Mismatched iEta: %d", iEta));
1361                   continue;
1362                 }
1363               iPt     = int((pt -_min_pt_2 )/_width_pt_2 ); 
1364               if (iPt<0  || iPt >=_nBins_pt_2)
1365                 {
1366                   AliWarning(Form("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) Mismatched iPt: %d",iPt));
1367                   continue;
1368                 }
1369               
1370               iEtaPhi = iEta*_nBins_phi_2+iPhi;
1371               iZEtaPhiPt = iVertexP2 + iEtaPhi*_nBins_pt_2 + iPt;
1372               if (iZEtaPhiPt<0 || iZEtaPhiPt>=_nBins_zEtaPhiPt_2)
1373                 {
1374                   AliWarning("AliAnalysisTaskDptDptCorrelations::analyze(AliceEvent * event) iZEtaPhiPt<0 || iZEtaPhiPt>=_nBins_zEtaPhiPt_2");
1375                   continue;
1376                 }
1377               
1378               
1379               if (_correctionWeight_2)
1380                 corr = _correctionWeight_2[iZEtaPhiPt];
1381               else
1382                 corr = 1;
1383               
1384               if (_singlesOnly)
1385                 {
1386                   __n1_2_vsPt[iPt]               += corr;          //cout << "step 15" << endl;
1387                   __n1_2_vsZEtaPhiPt[iZEtaPhiPt] += corr;       //cout << "step 12" << endl;
1388                 }
1389               else
1390                 {
1391                   corrPt                      = corr*pt;
1392                   _id_2[k2]                   = iTrack;         //cout << "step 1" << endl;
1393                   _charge_2[k2]               = charge;         //cout << "step 2" << endl;
1394                   _iEtaPhi_2[k2]              = iEtaPhi;        //cout << "step 3" << endl;
1395                   _iPt_2[k2]                  = iPt;            //cout << "step 4" << endl;
1396                   _pt_2[k2]                   = pt;             //cout << "step 5" << endl;
1397                   _px_2[k2]                   = px;             //cout << "step 6" << endl;
1398                   _py_2[k2]                   = py;             //cout << "step 7" << endl;
1399                   _pz_2[k2]                   = pz;             //cout << "step 8" << endl;
1400                   _correction_2[k2]           = corr;           //cout << "step 9" << endl;
1401                   __n1_2                      += corr;          //cout << "step 10" << endl;
1402                   __s1pt_2                    += corrPt;        //cout << "step 13" << endl;
1403                   __n1Nw_2                    += 1;
1404                   __n1_2_vsEtaPhi[iEtaPhi]    += corr;          //cout << "step 11" << endl;
1405                   __s1pt_2_vsEtaPhi[iEtaPhi]  += corrPt;        //cout << "step 14" << endl;
1406                   __s1ptNw_2                  += pt;
1407                   ++k2;
1408                   if (k2>=arraySize)
1409                     {
1410                       AliWarning(Form("-W- k2 >=arraySize; arraySize: %d",arraySize)); 
1411                       return;
1412                     }
1413                 }
1414               
1415               //cout << "done with track" << endl;
1416             } //iTrack
1417         } //aod 
1418     }
1419   
1420   
1421   //cout << "Filling histograms now" << endl;
1422   _m0->Fill(_mult0);
1423   _m1->Fill(_mult1);
1424   _m2->Fill(_mult2);
1425   _m3->Fill(_mult3);
1426   _m4->Fill(_mult4);
1427   _m5->Fill(_mult5);
1428   _m6->Fill(_mult6);
1429   //_vertexZ->Fill(vertexZ);
1430   
1431   if (_singlesOnly)
1432     {
1433       // nothing to do here.
1434     }
1435   else
1436     {
1437       if (_sameFilter)
1438         {
1439       _n1_1_vsM->Fill(centrality,      __n1_1);
1440       _s1pt_1_vsM->Fill(centrality,    __s1pt_1);
1441       _n1Nw_1_vsM->Fill(centrality,    __n1Nw_1);
1442       _s1ptNw_1_vsM->Fill(centrality,  __s1ptNw_1);
1443       _n1_2_vsM->Fill(centrality,      __n1_1);
1444       _s1pt_2_vsM->Fill(centrality,    __s1pt_1);
1445       _n1Nw_2_vsM->Fill(centrality,    __n1Nw_1);
1446       _s1ptNw_2_vsM->Fill(centrality,  __s1ptNw_1);
1447       // reset pair counters
1448       __n2_12   = __s2ptpt_12   = __s2NPt_12    = __s2PtN_12    = 0;
1449       __n2Nw_12 = __s2ptptNw_12 = __s2NPtNw_12  = __s2PtNNw_12  = 0;
1450       if (_field>0)
1451         {
1452           for (int i1=0; i1<k1; i1++)
1453             {
1454               ////cout << "         i1:" << i1 << endl;
1455               id_1      = _id_1[i1];           ////cout << "       id_1:" << id_1 << endl;
1456               q_1       = _charge_1[i1];       ////cout << "        q_1:" << q_1 << endl;
1457               iEtaPhi_1 = _iEtaPhi_1[i1];      ////cout << "  iEtaPhi_1:" << iEtaPhi_1 << endl;
1458               iPt_1     = _iPt_1[i1];          ////cout << "      iPt_1:" << iPt_1 << endl;
1459               corr_1    = _correction_1[i1];   ////cout << "     corr_1:" << corr_1 << endl;
1460               pt_1      = _pt_1[i1];           ////cout << "       pt_1:" << pt_1 << endl;
1461               dedx_1    = _dedx_1[i1];         ////cout << "     dedx_1:" << dedx_1 << endl;
1462               //1 and 2
1463               for (int i2=i1+1; i2<k1; i2++)
1464                 {        
1465                   ////cout << "         i2:" << i2 << endl;
1466                   id_2      = _id_1[i2];              ////cout << "       id_2:" << id_2 << endl;
1467                   if (id_1!=id_2)
1468                     {
1469                       q_2       = _charge_1[i2];     ////cout << "        q_1:" << q_1 << endl;
1470                       iEtaPhi_2 = _iEtaPhi_1[i2];    ////cout << "  iEtaPhi_1:" << iEtaPhi_1 << endl;
1471                       iPt_2     = _iPt_1[i2];        ////cout << "      iPt_1:" << iPt_1 << endl;
1472                       corr_2    = _correction_1[i2]; ////cout << "     corr_1:" << corr_1 << endl;
1473                       pt_2      = _pt_1[i2];         ////cout << "       pt_1:" << pt_1 << endl;
1474                       dedx_2    = _dedx_1[i2];       ////cout << "     dedx_2:" << dedx_2 << endl;
1475                       corr      = corr_1*corr_2;
1476                       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))
1477                         {
1478                           ij = iEtaPhi_1*_nBins_etaPhi_1 + iEtaPhi_2;   ////cout << " ij:" << ij<< endl;
1479                         }
1480                       else // swap particles
1481                         {
1482                           ij = iEtaPhi_2*_nBins_etaPhi_1 + iEtaPhi_1;   ////cout << " ij:" << ij<< endl;
1483                         }
1484                       
1485                       __n2_12                  += corr;
1486                       __n2_12_vsEtaPhi[ij]     += corr;
1487                       ptpt                     = pt_1*pt_2;
1488                       __s2ptpt_12              += corr*ptpt;
1489                       __s2PtN_12               += corr*pt_1;
1490                       __s2NPt_12               += corr*pt_2;
1491                       __s2ptpt_12_vsEtaPhi[ij] += corr*ptpt;
1492                       __s2PtN_12_vsEtaPhi[ij]  += corr*pt_1;
1493                       __s2NPt_12_vsEtaPhi[ij]  += corr*pt_2;
1494                       __n2_12_vsPtPt[iPt_1*_nBins_pt_2 + iPt_2] += corr;
1495                       
1496                       __n2Nw_12                  += 1;
1497                       __s2ptptNw_12              += ptpt;
1498                       __s2PtNNw_12               += pt_1;
1499                       __s2NPtNw_12               += pt_2;
1500                       
1501                     }
1502                 } //i2       
1503             } //i1       
1504         }
1505       else // field<0
1506         {
1507           for (int i1=0; i1<k1; i1++)
1508             {
1509               ////cout << "         i1:" << i1 << endl;
1510               id_1      = _id_1[i1];           ////cout << "       id_1:" << id_1 << endl;
1511               q_1       = _charge_1[i1];       ////cout << "        q_1:" << q_1 << endl;
1512               iEtaPhi_1 = _iEtaPhi_1[i1];      ////cout << "  iEtaPhi_1:" << iEtaPhi_1 << endl;
1513               iPt_1     = _iPt_1[i1];          ////cout << "      iPt_1:" << iPt_1 << endl;
1514               corr_1    = _correction_1[i1];   ////cout << "     corr_1:" << corr_1 << endl;
1515               pt_1      = _pt_1[i1];           ////cout << "       pt_1:" << pt_1 << endl;
1516               dedx_1    = _dedx_1[i1];         ////cout << "     dedx_1:" << dedx_1 << endl;
1517               //1 and 2
1518               for (int i2=i1+1; i2<k1; i2++)
1519                 {        
1520                   ////cout << "         i2:" << i2 << endl;
1521                   id_2      = _id_1[i2];              ////cout << "       id_2:" << id_2 << endl;
1522                   if (id_1!=id_2)
1523                     {
1524                       q_2       = _charge_1[i2];     ////cout << "        q_2:" << q_2 << endl;
1525                       iEtaPhi_2 = _iEtaPhi_1[i2];    ////cout << "  iEtaPhi_2:" << iEtaPhi_2 << endl;
1526                       iPt_2     = _iPt_1[i2];        ////cout << "      iPt_2:" << iPt_2 << endl;
1527                       corr_2    = _correction_1[i2]; ////cout << "     corr_2:" << corr_2 << endl;
1528                       pt_2      = _pt_1[i2];         ////cout << "       pt_2:" << pt_2 << endl;
1529                       dedx_2    = _dedx_1[i2];       ////cout << "     dedx_2:" << dedx_2 << endl;
1530                       corr      = corr_1*corr_2;
1531                       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))
1532                         {
1533                           ij = iEtaPhi_1*_nBins_etaPhi_1 + iEtaPhi_2;   ////cout << " ij:" << ij<< endl;
1534                         }
1535                       else // swap particles
1536                         {
1537                           ij = iEtaPhi_2*_nBins_etaPhi_1 + iEtaPhi_1;   ////cout << " ij:" << ij<< endl;
1538                         }
1539                       
1540                       __n2_12                  += corr;
1541                       __n2_12_vsEtaPhi[ij]     += corr;
1542                       ptpt                     = pt_1*pt_2;
1543                       __s2ptpt_12              += corr*ptpt;
1544                       __s2PtN_12               += corr*pt_1;
1545                       __s2NPt_12               += corr*pt_2;
1546                       __s2ptpt_12_vsEtaPhi[ij] += corr*ptpt;
1547                       __s2PtN_12_vsEtaPhi[ij]  += corr*pt_1;
1548                       __s2NPt_12_vsEtaPhi[ij]  += corr*pt_2;
1549                       __n2_12_vsPtPt[iPt_1*_nBins_pt_2 + iPt_2] += corr;
1550                       
1551                       __n2Nw_12                  += 1;
1552                       __s2ptptNw_12              += ptpt;
1553                       __s2PtNNw_12               += pt_1;
1554                       __s2NPtNw_12               += pt_2;
1555                       
1556                     }
1557                 } //i2       
1558             } //i1  
1559         }
1560         }
1561       else  // filter 1 and 2 are different -- must do all particle pairs...
1562         {
1563           _n1_1_vsM->Fill(centrality,      __n1_1);
1564           _s1pt_1_vsM->Fill(centrality,    __s1pt_1);
1565           _n1Nw_1_vsM->Fill(centrality,    __n1Nw_1);
1566           _s1ptNw_1_vsM->Fill(centrality,  __s1ptNw_1);
1567           _n1_2_vsM->Fill(centrality,      __n1_2);
1568           _s1pt_2_vsM->Fill(centrality,    __s1pt_2);
1569           _n1Nw_2_vsM->Fill(centrality,    __n1Nw_2);
1570           _s1ptNw_2_vsM->Fill(centrality,  __s1ptNw_2);
1571           // reset pair counters
1572           __n2_12   = __s2ptpt_12   = __s2NPt_12    = __s2PtN_12    = 0;
1573           __n2Nw_12 = __s2ptptNw_12 = __s2NPtNw_12  = __s2PtNNw_12  = 0;
1574           for (int i1=0; i1<k1; i1++)
1575             {
1576               ////cout << "         i1:" << i1 << endl;
1577               id_1      = _id_1[i1];           ////cout << "       id_1:" << id_1 << endl;
1578               q_1       = _charge_1[i1];       ////cout << "        q_1:" << q_1 << endl;
1579               iEtaPhi_1 = _iEtaPhi_1[i1];      ////cout << "  iEtaPhi_1:" << iEtaPhi_1 << endl;
1580               iPt_1     = _iPt_1[i1];          ////cout << "      iPt_1:" << iPt_1 << endl;
1581               corr_1    = _correction_1[i1];   ////cout << "     corr_1:" << corr_1 << endl;
1582               pt_1      = _pt_1[i1];           ////cout << "       pt_1:" << pt_1 << endl;
1583               px_1      = _px_1[i1];          ////cout << "      px_1:" << px_1 << endl;
1584               py_1      = _py_1[i1];          ////cout << "      py_1:" << py_1 << endl;
1585               pz_1      = _pz_1[i1];          ////cout << "      pz_1:" << pz_1 << endl;
1586               dedx_1    = _dedx_1[i1];        ////cout << "     dedx_1:" << dedx_1 << endl;
1587               
1588               //1 and 2
1589               for (int i2=0; i2<k2; i2++)
1590                 {        
1591                   ////cout << "         i2:" << i2 << endl;
1592                   id_2   = _id_2[i2];              ////cout << "       id_2:" << id_2 << endl;
1593                   if (id_1!=id_2)  // exclude auto correlation
1594                     {
1595                       q_2       = _charge_2[i2];     ////cout << "        q_2:" << q_2 << endl;
1596                       iEtaPhi_2 = _iEtaPhi_2[i2];    ////cout << "  iEtaPhi_2:" << iEtaPhi_2 << endl;
1597                       iPt_2     = _iPt_2[i2];        ////cout << "      iPt_2:" << iPt_2 << endl;
1598                       corr_2    = _correction_2[i2]; ////cout << "     corr_2:" << corr_2 << endl;
1599                       pt_2      = _pt_2[i2];         ////cout << "       pt_2:" << pt_2 << endl;
1600                       px_2      = _px_2[i2];          ////cout << "      px_2:" << px_2 << endl;
1601                       py_2      = _py_2[i2];          ////cout << "      py_2:" << py_2 << endl;
1602                       pz_2      = _pz_2[i2];          ////cout << "      pz_2:" << pz_2 << endl;
1603                       dedx_2    = _dedx_2[i2];        ////cout << "     dedx_2:" << dedx_2 << endl;
1604                       
1605                       
1606                       if (_rejectPairConversion)
1607                         {
1608                           float e1Sq = massElecSq + pt_1*pt_1 + pz_1*pz_1;
1609                           float e2Sq = massElecSq + pt_2*pt_2 + pz_2*pz_2;
1610                           float mInvSq = 2*(massElecSq + sqrt(e1Sq*e2Sq) - px_1*px_2 - py_1*py_2 - pz_1*pz_2 );
1611                           float mInv = sqrt(mInvSq);
1612                           _invMass->Fill(mInv);
1613                           if (mInv<0.51)
1614                             {
1615                               if (dedx_1>75. && dedx_2>75.)
1616                                 {
1617                                   //_invMassElec->Fill(mInv);
1618                                   if (mInv<0.05) continue;
1619                                 }
1620                             }
1621                         }
1622                       
1623                       corr      = corr_1*corr_2;
1624                       ij        = iEtaPhi_1*_nBins_etaPhi_1 + iEtaPhi_2;   ////cout << " ij:" << ij<< endl;
1625                       __n2_12                  += corr;
1626                       __n2_12_vsEtaPhi[ij]     += corr;
1627                       ptpt                     = pt_1*pt_2;
1628                       __s2ptpt_12              += corr*ptpt;
1629                       __s2PtN_12               += corr*pt_1;
1630                       __s2NPt_12               += corr*pt_2;
1631                       __s2ptpt_12_vsEtaPhi[ij] += corr*ptpt;
1632                       __s2PtN_12_vsEtaPhi[ij]  += corr*pt_1;
1633                       __s2NPt_12_vsEtaPhi[ij]  += corr*pt_2;
1634                       __n2_12_vsPtPt[iPt_1*_nBins_pt_2 + iPt_2] += corr;         
1635                       __n2Nw_12                  += 1;
1636                       __s2ptptNw_12              += ptpt;
1637                       __s2PtNNw_12               += pt_1;
1638                       __s2NPtNw_12               += pt_2;
1639                       
1640                     }
1641                 } //i2       
1642             } //i1         
1643         }
1644       
1645       _n2_12_vsM->Fill(centrality,     __n2_12);
1646       _s2PtPt_12_vsM->Fill(centrality, __s2ptpt_12); 
1647       _s2PtN_12_vsM->Fill(centrality,  __s2NPt_12);
1648       _s2NPt_12_vsM->Fill(centrality,  __s2PtN_12);
1649       
1650       _n2Nw_12_vsM->Fill(centrality,     __n2Nw_12);
1651       _s2PtPtNw_12_vsM->Fill(centrality, __s2ptptNw_12); 
1652       _s2PtNNw_12_vsM->Fill(centrality,  __s2NPtNw_12);
1653       _s2NPtNw_12_vsM->Fill(centrality,  __s2PtNNw_12);
1654       
1655     }
1656   
1657   
1658   AliInfo("AliAnalysisTaskDptDptCorrelations::UserExec()   -----------------Event Done ");
1659   PostData(0,_outputHistoList);
1660   
1661 }
1662
1663 void   AliAnalysisTaskDptDptCorrelations::FinishTaskOutput()
1664 {
1665   AliInfo("AliAnalysisTaskDptDptCorrelations::FinishTaskOutput() Starting.");
1666   Printf("= 0 ====================================================================");
1667   finalizeHistograms();
1668   AliInfo("= 1 ====================================================================");
1669   PostData(0,_outputHistoList);
1670   AliInfo("= 2 ====================================================================");
1671   AliInfo("AliAnalysisTaskDptDptCorrelations::FinishTaskOutput() Done.");
1672 }
1673
1674 void   AliAnalysisTaskDptDptCorrelations::Terminate(Option_t* /*option*/)
1675 {
1676   AliInfo("AliAnalysisTaskDptDptCorrelations::Terminate() Starting/Done.");
1677 }
1678
1679
1680 //Tools
1681 //===================================================================================================
1682 void  AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH1 * h, float * array, int size)
1683 {
1684   int i, i1;
1685   float v1, ev1, v2, ev2, sum, esum;
1686   for (i=0, i1=1; i<size; ++i,++i1)
1687     {
1688     v1  = array[i]; ev1 = sqrt(v1);
1689     v2  = h->GetBinContent(i1);
1690     ev2 = h->GetBinError(i1);
1691     sum = v1 + v2;
1692     esum = sqrt(ev1*ev1+ev2*ev2);
1693     h->SetBinContent(i1,sum);
1694     h->SetBinError(i1,esum);
1695     }
1696 }
1697
1698 void  AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH2 * h, float * array, int size1, int size2)
1699 {
1700   int i, i1;
1701   int j, j1;
1702   float v1, ev1, v2, ev2, sum, esum;
1703   for (i=0, i1=1; i<size1; ++i,++i1)
1704     {
1705     for (j=0, j1=1; j<size2; ++j,++j1)
1706       {
1707       v1  = array[i*size2+j]; ev1 = sqrt(v1);
1708       v2  = h->GetBinContent(i1,j1);
1709       ev2 = h->GetBinError(i1,j1);
1710       sum = v1 + v2;
1711       esum = sqrt(ev1*ev1+ev2*ev2);
1712       h->SetBinContent(i1,j1,sum);
1713       h->SetBinError(i1,j1,esum);
1714       }
1715     }
1716 }
1717
1718 void  AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH3 * h, float * array, int size1, int size2, int size3)
1719 {
1720   int i, i1;
1721   int j, j1;
1722   int k, k1;
1723   float v1, ev1, v2, ev2, sum, esum;
1724   int size23 = size2*size3;
1725   for (i=0, i1=1; i<size1; ++i,++i1)
1726     {
1727     for (j=0, j1=1; j<size2; ++j,++j1)
1728       {
1729       for (k=0, k1=1; k<size3; ++k,++k1)
1730         {
1731         v1  = array[i*size23+j*size3+k]; ev1 = sqrt(v1);
1732         v2  = h->GetBinContent(i1,j1,k1);
1733         ev2 = h->GetBinError(i1,j1,k1);
1734         sum = v1 + v2;
1735         esum = sqrt(ev1*ev1+ev2*ev2);
1736         h->SetBinContent(i1,j1,k1,sum);
1737         h->SetBinError(i1,j1,k1,esum);
1738         }
1739       }
1740     }
1741 }
1742
1743 void  AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH1 * h, double * array, int size)
1744 {
1745   int i, i1;
1746   double v1, ev1, v2, ev2, sum, esum;
1747   for (i=0, i1=1; i<size; ++i,++i1)
1748     {
1749     v1  = array[i]; ev1 = sqrt(v1);
1750     v2  = h->GetBinContent(i1);
1751     ev2 = h->GetBinError(i1);
1752     sum = v1 + v2;
1753     esum = sqrt(ev1*ev1+ev2*ev2);
1754     h->SetBinContent(i1,sum);
1755     h->SetBinError(i1,esum);
1756     }
1757 }
1758
1759 void  AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH2 * h, double * array, int size1, int size2)
1760 {
1761   int i, i1;
1762   int j, j1;
1763   double v1, ev1, v2, ev2, sum, esum;
1764   for (i=0, i1=1; i<size1; ++i,++i1)
1765     {
1766     for (j=0, j1=1; j<size2; ++j,++j1)
1767       {
1768       v1  = array[i*size2+j]; ev1 = sqrt(v1);
1769       v2  = h->GetBinContent(i1,j1);
1770       ev2 = h->GetBinError(i1,j1);
1771       sum = v1 + v2;
1772       esum = sqrt(ev1*ev1+ev2*ev2);
1773       h->SetBinContent(i1,j1,sum);
1774       h->SetBinError(i1,j1,esum);
1775       }
1776     }
1777 }
1778
1779 void  AliAnalysisTaskDptDptCorrelations::fillHistoWithArray(TH3 * h, double * array, int size1, int size2, int size3)
1780 {
1781   int i, i1;
1782   int j, j1;
1783   int k, k1;
1784   double v1, ev1, v2, ev2, sum, esum;
1785   int size23 = size2*size3;
1786   for (i=0, i1=1; i<size1; ++i,++i1)
1787     {
1788     for (j=0, j1=1; j<size2; ++j,++j1)
1789       {
1790       for (k=0, k1=1; k<size3; ++k,++k1)
1791         {
1792         v1  = array[i*size23+j*size3+k]; ev1 = sqrt(v1);
1793         v2  = h->GetBinContent(i1,j1,k1);
1794         ev2 = h->GetBinError(i1,j1,k1);
1795         sum = v1 + v2;
1796         esum = sqrt(ev1*ev1+ev2*ev2);
1797         h->SetBinContent(i1,j1,k1,sum);
1798         h->SetBinError(i1,j1,k1,esum);
1799         }
1800       }
1801     }
1802 }
1803
1804 //________________________________________________________________________
1805 double *  AliAnalysisTaskDptDptCorrelations::getDoubleArray(int size, double v)
1806 {
1807   /// Allocate an array of type double with n values
1808   /// Initialize the array to the given value
1809   double * array = new double [size];
1810   for (int i=0;i<size;++i) array[i]=v;
1811   return array;
1812 }
1813
1814 //________________________________________________________________________
1815 float *  AliAnalysisTaskDptDptCorrelations::getFloatArray(int size, float v)
1816 {
1817   /// Allocate an array of type float with n values
1818   /// Initialize the array to the given value
1819   float * array = new float [size];
1820   for (int i=0;i<size;++i) array[i]=v;
1821   return array;
1822 }
1823
1824
1825 //________________________________________________________________________
1826 TH1D * AliAnalysisTaskDptDptCorrelations::createHisto1D(const TString &  name, const TString &  title, 
1827                                                       int n, double xMin, double xMax, 
1828                                                       const TString &  xTitle, const TString &  yTitle)
1829 {
1830   //CreateHisto new 1D historgram
1831   AliInfo(Form("createHisto 1D histo %s   nBins: %d  xMin: %f   xMax: %f",name.Data(),n,xMin,xMax));
1832   TH1D * h = new TH1D(name,title,n,xMin,xMax);
1833   h->GetXaxis()->SetTitle(xTitle);
1834   h->GetYaxis()->SetTitle(yTitle);
1835   addToList(h);
1836   return h;
1837 }
1838
1839
1840 //________________________________________________________________________
1841 TH1D * AliAnalysisTaskDptDptCorrelations::createHisto1D(const TString &  name, const TString &  title, 
1842                                                       int n, double * bins, 
1843                                                       const TString &  xTitle, const TString &  yTitle)
1844 {
1845   AliInfo(Form("createHisto 1D histo %s   with %d non uniform nBins",name.Data(),n));
1846   TH1D * h = new TH1D(name,title,n,bins);
1847   h->GetXaxis()->SetTitle(xTitle);
1848   h->GetYaxis()->SetTitle(yTitle);
1849   addToList(h);
1850   return h;
1851 }
1852
1853
1854 //________________________________________________________________________
1855 TH2D * AliAnalysisTaskDptDptCorrelations::createHisto2D(const TString &  name, const TString &  title, 
1856                                                       int nx, double xMin, double xMax, int ny, double yMin, double yMax, 
1857                                                       const TString &  xTitle, const TString &  yTitle, const TString &  zTitle)
1858 {
1859   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));
1860   TH2D * h = new TH2D(name,title,nx,xMin,xMax,ny,yMin,yMax);
1861   h->GetXaxis()->SetTitle(xTitle);
1862   h->GetYaxis()->SetTitle(yTitle);
1863   h->GetZaxis()->SetTitle(zTitle);
1864   addToList(h);
1865   return h;
1866 }
1867
1868 //________________________________________________________________________
1869 TH2D * AliAnalysisTaskDptDptCorrelations::createHisto2D(const TString &  name, const TString &  title, 
1870                                                       int nx, double* xbins, int ny, double yMin, double yMax, 
1871                                                       const TString &  xTitle, const TString &  yTitle, const TString &  zTitle)
1872 {
1873   AliInfo(Form("createHisto 2D histo %s   with %d non uniform nBins",name.Data(),nx));
1874   TH2D * h;
1875   h = new TH2D(name,title,nx,xbins,ny,yMin,yMax);
1876   h->GetXaxis()->SetTitle(xTitle);
1877   h->GetYaxis()->SetTitle(yTitle);
1878   h->GetZaxis()->SetTitle(zTitle);
1879   addToList(h);
1880   return h;
1881 }
1882
1883 //// F /////
1884 //________________________________________________________________________
1885 TH1F * AliAnalysisTaskDptDptCorrelations::createHisto1F(const TString &  name, const TString &  title, 
1886                                                         int n, double xMin, double xMax, 
1887                                                         const TString &  xTitle, const TString &  yTitle)
1888 {
1889   //CreateHisto new 1D historgram
1890   AliInfo(Form("createHisto 1D histo %s   nBins: %d  xMin: %f   xMax: %f",name.Data(),n,xMin,xMax));
1891   TH1F * h = new TH1F(name,title,n,xMin,xMax);
1892   h->GetXaxis()->SetTitle(xTitle);
1893   h->GetYaxis()->SetTitle(yTitle);
1894   addToList(h);
1895   return h;
1896 }
1897
1898
1899 //________________________________________________________________________
1900 TH1F * AliAnalysisTaskDptDptCorrelations::createHisto1F(const TString &  name, const TString &  title, 
1901                                                         int n, double * bins, 
1902                                                         const TString &  xTitle, const TString &  yTitle)
1903 {
1904   AliInfo(Form("createHisto 1D histo %s   with %d non uniform nBins",name.Data(),n));
1905   TH1F * h = new TH1F(name,title,n,bins);
1906   h->GetXaxis()->SetTitle(xTitle);
1907   h->GetYaxis()->SetTitle(yTitle);
1908   addToList(h);
1909   return h;
1910 }
1911
1912
1913 //________________________________________________________________________
1914 TH2F * AliAnalysisTaskDptDptCorrelations::createHisto2F(const TString &  name, const TString &  title, 
1915                                                         int nx, double xMin, double xMax, int ny, double yMin, double yMax, 
1916                                                         const TString &  xTitle, const TString &  yTitle, const TString &  zTitle)
1917 {
1918   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));
1919   TH2F * h = new TH2F(name,title,nx,xMin,xMax,ny,yMin,yMax);
1920   h->GetXaxis()->SetTitle(xTitle);
1921   h->GetYaxis()->SetTitle(yTitle);
1922   h->GetZaxis()->SetTitle(zTitle);
1923   addToList(h);
1924   return h;
1925 }
1926
1927 //________________________________________________________________________
1928 TH2F * AliAnalysisTaskDptDptCorrelations::createHisto2F(const TString &  name, const TString &  title, 
1929                                                         int nx, double* xbins, int ny, double yMin, double yMax, 
1930                                                         const TString &  xTitle, const TString &  yTitle, const TString &  zTitle)
1931 {
1932   AliInfo(Form("createHisto 2D histo %s   with %d non uniform nBins",name.Data(),nx));
1933   TH2F * h;
1934   h = new TH2F(name,title,nx,xbins,ny,yMin,yMax);
1935   h->GetXaxis()->SetTitle(xTitle);
1936   h->GetYaxis()->SetTitle(yTitle);
1937   h->GetZaxis()->SetTitle(zTitle);
1938   addToList(h);
1939   return h;
1940 }
1941
1942
1943 //________________________________________________________________________
1944 TH3F * AliAnalysisTaskDptDptCorrelations::createHisto3F(const TString &  name, const TString &  title, 
1945                                                       int nx, double xMin, double xMax, 
1946                                                       int ny, double yMin, double yMax, 
1947                                                       int nz, double zMin, double zMax, 
1948                                                       const TString &  xTitle, const TString &  yTitle, const TString &  zTitle)
1949 {
1950   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));
1951   TH3F * h = new TH3F(name,title,nx,xMin,xMax,ny,yMin,yMax,nz,zMin,zMax);
1952   h->GetXaxis()->SetTitle(xTitle);
1953   h->GetYaxis()->SetTitle(yTitle);
1954   h->GetZaxis()->SetTitle(zTitle);
1955   addToList(h);
1956   return h;
1957 }
1958
1959
1960 //________________________________________________________________________
1961 TProfile * AliAnalysisTaskDptDptCorrelations::createProfile(const TString & name, const TString & description, 
1962                                                             int nx,double xMin,double xMax,
1963                                                             const TString &  xTitle, const TString &  yTitle)
1964 {
1965   AliInfo(Form("createHisto 1D profile %s   nBins: %d  xMin: %f10.4 xMax: %f10.4",name.Data(),nx,xMin,xMax));
1966   TProfile * h = new TProfile(name,description,nx,xMin,xMax);
1967   h->GetXaxis()->SetTitle(xTitle);
1968   h->GetYaxis()->SetTitle(yTitle);
1969   addToList(h);
1970   return h;  
1971 }
1972
1973 //________________________________________________________________________
1974 TProfile * AliAnalysisTaskDptDptCorrelations::createProfile(const TString &  name,const TString &  description, 
1975                                                             int nx,  double* bins,
1976                                                             const TString &  xTitle, const TString &  yTitle)
1977 {
1978   AliInfo(Form("createHisto 1D profile %s  with %d non uniform bins",name.Data(),nx));
1979   TProfile * h = new TProfile(name,description,nx,bins);
1980   h->GetXaxis()->SetTitle(xTitle);
1981   h->GetYaxis()->SetTitle(yTitle);
1982   addToList(h);
1983   return h;
1984 }
1985
1986
1987 void   AliAnalysisTaskDptDptCorrelations::addToList(TH1 *h)
1988 {
1989   if (_outputHistoList)
1990     {
1991     _outputHistoList->Add(h);
1992     }
1993   else
1994     AliInfo("addToList(TH1 *h) _outputHistoList is null!!!!! Should abort ship");
1995
1996 }
1997
1998
1999