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