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