740104da14fe5e2fbaf5243b4c5791ca5ddf3a8f
[u/mrichter/AliRoot.git] / PWGJE / UserTasks / AliAnalysisTaskJetHadronCorrelation.cxx
1 //#include <string.h>
2 //#include <TStyle.h>
3 #include <list>
4 #include <string>
5
6 #include "TTree.h"
7 #include "TCanvas.h"
8 #include "AliAnalysisTask.h"
9 #include "AliInputEventHandler.h"
10 #include "AliESDtrack.h"
11 #include "AliAODVertex.h"
12 #include "AliAODCluster.h"
13
14 #include <TROOT.h>
15 #include <TRandom.h>
16 #include <TSystem.h>
17 #include <TInterpreter.h>
18 #include <TChain.h>
19 #include <TFile.h>
20 #include <TKey.h>
21 #include <TH1F.h>
22 #include <TH2F.h>
23 #include <TH3F.h>
24 #include <TProfile.h>
25 #include <TList.h>
26 #include <TLorentzVector.h>
27 #include <TClonesArray.h>
28 #include <TRefArray.h>
29
30 #include "TDatabasePDG.h"
31 #include "AliAnalysisManager.h"
32 #include "AliJetFinder.h"
33 #include "AliJetHeader.h"
34 #include "AliJetReader.h"
35 #include "AliJetReaderHeader.h"
36 #include "AliUA1JetHeaderV1.h"
37 #include "AliSISConeJetHeader.h"
38 #include "AliESDEvent.h"
39 #include "AliAODEvent.h"
40 #include "AliAODHandler.h"
41 #include "AliAODInputHandler.h"
42 #include "AliAODTrack.h"
43 #include "AliAODJet.h"
44 #include "AliAODJetEventBackground.h"
45 #include "AliMCParticle.h"
46 #include "AliAODMCParticle.h"
47 #include "AliMCEventHandler.h"
48 #include "AliMCEvent.h"
49 #include "AliStack.h"
50
51 #include "AliAODHeader.h"
52 #include "AliAODMCHeader.h"
53 //#include "AliGenPythiaEventHeader.h"
54 #include "AliJetKineReaderHeader.h"
55 #include "AliGenCocktailEventHeader.h"
56 #include "AliInputEventHandler.h"
57 #include "AliGenEventHeader.h"
58 #include "AliGenDPMjetEventHeader.h"
59
60
61
62 #include "AliAnalysisTaskJetHadronCorrelation.h"
63 #include "AliAnalysisTaskPhiCorrelations.h"
64 //#include "AliAnalysisHelperJetTasks.h"
65 #include "AliPWG4HighPtQAMC.h"
66
67
68
69
70 ClassImp(AliAnalysisTaskJetHadronCorrelation)
71
72                                 //________________________________________________________________________
73                                 AliAnalysisTaskJetHadronCorrelation::AliAnalysisTaskJetHadronCorrelation():
74                                                                 AliAnalysisTaskSE(),
75                                                                 fUseAODInput(kFALSE),
76                                                                 fFillAOD(kFALSE),
77                                                                 fJetBranch("jets"),
78                                                                 fNonStdFile(""),
79                                                                 fAODIn(0x0),
80                                                                 fAODOut(0x0),
81                                                                 fAODExtension(0x0),
82                                                                 JFAlg("ANTIKT"),         
83                                                                 Radius(0.4),
84                                                                 Filtermask(256),
85                                                                 BackM(0),
86                                                                 TrackPtcut(0.15),
87                                                                 SkipCone(0),
88                                                                 IsMC(kTRUE),
89                 fxsec(0.),
90                 ftrial(1.),
91                 fJetRecEtaWindow(0.5),       // eta window for rec jets
92                 fMinJetPt(10), 
93                                                                 fHistList(0x0), // Output list
94                                                                 fIfiles(0),
95                                                                 fH1Events(0x0),
96                                                                 fH1Xsec(0x0),
97                                                                 fH1Trials(0x0),
98                                                                 fH1JetAKT04_pt                (0x0),
99                                                                 fH1leadJetAKT04_pt            (0x0),
100                                                                 fH1leadJetAKT04_pt_dijet      (0x0),
101                                                                 fH1subJetAKT04_pt_dijet       (0x0),
102                                                                 fH2JetsJetAKT04_dphi          (0x0),
103                                                                 fH2JetsJetAKT04_deta          (0x0),
104                                                                 fH2JetsJetAKT04_Aj            (0x0),
105                                                                 fH2JetsJetAKT04_pt            (0x0),
106                                                                 fH1JetMCAKT04_pt              (0x0),
107                                                                 fH1leadJetMCAKT04_pt          (0x0),
108                                                                 fH1leadJetMCAKT04_pt_dijet    (0x0),
109                                                                 fH1subJetMCAKT04_pt_dijet     (0x0),
110                                                                 fH2JetsJetMCAKT04_dphi        (0x0),
111                                                                 fH2JetsJetMCAKT04_deta        (0x0),
112                                                                 fH2JetsJetMCAKT04_Aj          (0x0),
113                                                                 fH2JetsJetMCAKT04_pt          (0x0)
114
115
116 {
117
118
119                                 if(IsMC){
120                                                                 for(int j=0;j<5;j++){
121                                                                                                 fH1AKT04_ndiJ_ediv[j]=0;
122                                                                                                 fH1leadJetMCAKT04_dphiResolution          [j]=0;
123                                                                                                 fH1subJetMCAKT04_dphiResolution           [j]=0;
124                                                                                                 for(int k=0;k<5;k++){
125                                                                                                                                 fH1JetHadronAKT04_dphi_ediv               [j][k]=0;
126                                                                                                                                 fH1JetHadronAKT04_dphi_tptweight_ediv     [j][k]=0;
127                                                                                                                                 fH1JetHadronAKT04_dphi_tJptweight_ediv    [j][k]=0;
128                                                                                                 }
129                                                                 }
130                                 }else{
131                                                                 for(int j=0;j<5;j++){
132                                                                                                 fH1AKT04_ndiJ_ediv[j]=0;
133                                                                                                 for(int k=0;k<5;k++){
134                                                                                                                                 fH1JetHadronAKT04_dphi_ediv             [j][k]=0;
135                                                                                                                                 fH1JetHadronAKT04_dphi_tptweight_ediv   [j][k]=0;
136                                                                                                                                 fH1JetHadronAKT04_dphi_tJptweight_ediv  [j][k]=0;
137                                                                                                 }
138                                                                 }
139                                 }
140
141
142                                 // Default constructor
143 }
144
145 //________________________________________________________________________
146 AliAnalysisTaskJetHadronCorrelation::AliAnalysisTaskJetHadronCorrelation(const char *name):
147                                 AliAnalysisTaskSE(name),
148                                 fUseAODInput(kFALSE),
149                                 fFillAOD(kFALSE),
150                                 fJetBranch("jets"),
151                                 fNonStdFile(""),
152                                 fAODIn(0x0), 
153                                 fAODOut(0x0), 
154                                 fAODExtension(0x0),
155                                 JFAlg("ANTIKT"),         
156                                 Radius(0.4),
157                                 Filtermask(256),
158                                 BackM(0),
159                                 TrackPtcut(0.15),
160                                 SkipCone(0),
161                                 IsMC(kTRUE),
162                                 fxsec(0.),
163                                 ftrial(1.),
164                                 fJetRecEtaWindow(0.5),       // eta window for rec jets
165                                 fMinJetPt(10), 
166                                 fHistList(0x0), // Output list
167                                 fIfiles(0),
168
169                                 fH1Events(0x0),
170                                 fH1Xsec(0x0),
171                                 fH1Trials(0x0),
172                                 fH1JetAKT04_pt                (0x0),
173                                 fH1leadJetAKT04_pt            (0x0),
174                                 fH1leadJetAKT04_pt_dijet      (0x0),
175                                 fH1subJetAKT04_pt_dijet       (0x0),
176                                 fH2JetsJetAKT04_dphi          (0x0),
177                                 fH2JetsJetAKT04_deta          (0x0),
178                                 fH2JetsJetAKT04_Aj            (0x0),
179                                 fH2JetsJetAKT04_pt            (0x0),
180                                 fH1JetMCAKT04_pt              (0x0),
181                                 fH1leadJetMCAKT04_pt          (0x0),
182                                 fH1leadJetMCAKT04_pt_dijet    (0x0),
183                                 fH1subJetMCAKT04_pt_dijet     (0x0),
184                                 fH2JetsJetMCAKT04_dphi        (0x0),
185                                 fH2JetsJetMCAKT04_deta        (0x0),
186                                 fH2JetsJetMCAKT04_Aj          (0x0),
187                                 fH2JetsJetMCAKT04_pt          (0x0)
188
189
190 {
191                                 if(IsMC){
192                                                                 for(int j=0;j<5;j++){
193                                                                                                 fH1AKT04_ndiJ_ediv[j]=0;
194                                                                                                 fH1leadJetMCAKT04_dphiResolution          [j]=0;
195                                                                                                 fH1subJetMCAKT04_dphiResolution           [j]=0;
196                                                                                                 for(int k=0;k<5;k++){
197                                                                                                                                 fH1JetHadronAKT04_dphi_ediv               [j][k]=0;
198                                                                                                                                 fH1JetHadronAKT04_dphi_tptweight_ediv     [j][k]=0;
199                                                                                                                                 fH1JetHadronAKT04_dphi_tJptweight_ediv    [j][k]=0;
200                                                                                                 }
201                                                                 }
202                                 }else{
203                                                                 for(int j=0;j<5;j++){
204                                                                                                 fH1AKT04_ndiJ_ediv[j]=0;
205                                                                                                 for(int k=0;k<5;k++){
206                                                                                                                                 fH1JetHadronAKT04_dphi_ediv             [j][k]=0;
207                                                                                                                                 fH1JetHadronAKT04_dphi_tptweight_ediv   [j][k]=0;
208                                                                                                                                 fH1JetHadronAKT04_dphi_tJptweight_ediv  [j][k]=0;
209                                                                                                 }
210                                                                 }
211                                 }
212
213                                 // Default constructor
214
215                                 // Constructor
216
217                                 // Define input and output slots here
218                                 // Input slot #0 works with a TChain
219                                 DefineInput(0, TChain::Class());
220                                 // Output slot #0 id reserved by the base class for AOD
221                                 // Output slot #1 writes into a TH1 container
222                                 DefineOutput(1, TList::Class());
223
224 }
225
226 //________________________________________________________________________
227 void AliAnalysisTaskJetHadronCorrelation::UserCreateOutputObjects()
228 {
229                                 // Create histograms
230                                 // Called once
231
232
233                                 fHistList = new TList();fHistList->SetOwner(kTRUE); cout<<"TList is created for output "<<endl;
234                                 //if (!fHistList){ fHistList = new TList();fHistList->SetOwner(kTRUE); cout<<"TList is created for output "<<endl;}
235
236                                 Bool_t oldStatus = TH1::AddDirectoryStatus();
237                                 TH1::AddDirectory(kFALSE);
238
239                                 Float_t pi=TMath::Pi();
240                                 //gStyle->SetPalette(1);
241
242
243                                 char *histname;
244                                 if(IsMC){
245                                                                 fH1Xsec                         = new TProfile("Xsec"               ,"Xsec"                   ,1,0,1);
246                                                                 fH1Trials                       = new TH1F    ("Trials"             ,"Trials"                 ,1,0,1);
247                                                                 fH1JetMCAKT04_pt                = new TH1F("JetMCAKT04_pt"          ,"JetMCAKT04_pt"          ,400,0,400);
248                                                                 fH1leadJetMCAKT04_pt            = new TH1F("leadJetMCAKT04_pt"      ,"leadJetMCAKT04_pt"      ,400,0,400);
249                                                                 fH1leadJetMCAKT04_pt_dijet      = new TH1F("leadJetMCAKT04_pt_dijet","leadJetMCAKT04_pt_dijet",400,0,400);
250                                                                 fH1subJetMCAKT04_pt_dijet       = new TH1F("subJetMCAKT04_pt_dijet" ,"subJetMCAKT04_pt_dijet" ,400,0,400);
251                                                                 fH1JetAKT04_pt                  = new TH1F("JetAKT04_pt"            ,"JetAKT04_pt"            ,400,0,400);
252                                                                 fH1leadJetAKT04_pt              = new TH1F("leadJetAKT04_pt"        ,"leadJetAKT04_pt"        ,400,0,400);
253                                                                 fH1leadJetAKT04_pt_dijet        = new TH1F("leadJetAKT04_pt_dijet"  ,"leadJetAKT04_pt_dijet"  ,400,0,400);
254                                                                 fH1subJetAKT04_pt_dijet         = new TH1F("subJetAKT04_pt_dijet"   ,"subJetAKT04_pt_dijet"   ,400,0,400);
255                                                                 histname = Form("JetsJetMCAKT04_dphi");
256                                                                 fH2JetsJetMCAKT04_dphi          = new TH2F(histname,histname,200,0,400,100,-2*pi,2*pi);
257                                                                 histname = Form("JetsJetMCAKT04_deta");
258                                                                 fH2JetsJetMCAKT04_deta          = new TH2F(histname,histname,200,0,400,100,-1.5,1.5);
259                                                                 histname = Form("JetsJetMCAKT04_Aj");
260                                                                 fH2JetsJetMCAKT04_Aj            = new TH2F(histname,histname,200,0,400,100,0,1.2);
261                                                                 histname = Form("JetsJetMCAKT04_pt");
262                                                                 fH2JetsJetMCAKT04_pt            = new TH2F(histname,histname,200,0,400,200,0,400);
263                                                                 histname = Form("JetsJetAKT04_dphi");
264                                                                 fH2JetsJetAKT04_dphi            = new TH2F(histname,histname,200,0,400,100,-2*pi,2*pi);
265                                                                 histname = Form("JetsJetAKT04_deta");
266                                                                 fH2JetsJetAKT04_deta            = new TH2F(histname,histname,200,0,400,100,-1.5,1.5);
267                                                                 histname = Form("JetsJetAKT04_Aj");
268                                                                 fH2JetsJetAKT04_Aj              = new TH2F(histname,histname,200,0,400,100,0,1.2);
269                                                                 histname = Form("JetsJetAKT04_pt");
270                                                                 fH2JetsJetAKT04_pt              = new TH2F(histname,histname,200,0,400,200,0,400);
271                                                                 for(int j=0;j<5;j++){
272                                                                                                 histname = Form("AKT04_ndiJ_ediv%d",j);
273                                                                                                 fH1AKT04_ndiJ_ediv[j]= new TH1F(histname,histname,1,1,2);
274                                                                                                 histname = Form("leadJetMCAKT04_dphiResolution%d",j);
275                                                                                                 fH1leadJetMCAKT04_dphiResolution[j] = new TH1F(histname,histname,200,-2*pi,2*pi);
276                                                                                                 histname = Form("subJetMCAKT04_dphiResolution%d",j);
277                                                                                                 fH1subJetMCAKT04_dphiResolution[j] = new TH1F(histname,histname,200,-2*pi,2*pi);
278                                                                                                 for(int k=0;k<5;k++){
279                                                                                                                                 histname = Form("JetHadronAKT04_dphi_ediv%d%d",j,k);
280                                                                                                                                 fH1JetHadronAKT04_dphi_ediv             [j][k]= new TH1F(histname,histname,200,-2*pi,2*pi);
281                                                                                                                                 histname = Form("JetHadronAKT04_dphi_tptweight_ediv%d%d",j,k);
282                                                                                                                                 fH1JetHadronAKT04_dphi_tptweight_ediv   [j][k]= new TH1F(histname,histname,200,-2*pi,2*pi);
283                                                                                                                                 histname = Form("JetHadronAKT04_dphi_tJptweight_ediv%d%d",j,k);
284                                                                                                                                 fH1JetHadronAKT04_dphi_tJptweight_ediv  [j][k]= new TH1F(histname,histname,200,-2*pi,2*pi);
285                                                                                                 }
286                                                                 }
287                                                                 fHistList->Add(fH1Xsec);
288                                                                 fHistList->Add(fH1Trials);
289                                                                 fHistList->Add(fH1JetMCAKT04_pt          );
290                                                                 fHistList->Add(fH1leadJetMCAKT04_pt      );
291                                                                 fHistList->Add(fH1leadJetMCAKT04_pt_dijet);
292                                                                 fHistList->Add(fH1subJetMCAKT04_pt_dijet );
293                                                                 fHistList->Add(fH1JetAKT04_pt            );
294                                                                 fHistList->Add(fH1leadJetAKT04_pt        );
295                                                                 fHistList->Add(fH1leadJetAKT04_pt_dijet  );
296                                                                 fHistList->Add(fH1subJetAKT04_pt_dijet   );
297                                                                 fHistList->Add(fH2JetsJetMCAKT04_dphi);
298                                                                 fHistList->Add(fH2JetsJetMCAKT04_deta);
299                                                                 fHistList->Add(fH2JetsJetMCAKT04_Aj  );
300                                                                 fHistList->Add(fH2JetsJetMCAKT04_pt  );
301                                                                 fHistList->Add(fH2JetsJetAKT04_dphi  );
302                                                                 fHistList->Add(fH2JetsJetAKT04_deta  );
303                                                                 fHistList->Add(fH2JetsJetAKT04_Aj    );
304                                                                 fHistList->Add(fH2JetsJetAKT04_pt    );
305                                                                 for(int j=0;j<5;j++){
306                                                                                                 fHistList->Add(fH1AKT04_ndiJ_ediv    [j]);
307                                                                                                 fHistList->Add(fH1leadJetMCAKT04_dphiResolution          [j]);
308                                                                                                 fHistList->Add(fH1subJetMCAKT04_dphiResolution           [j]);
309                                                                                                 for(int k=0;k<5;k++){
310                                                                                                                                 fHistList->Add(fH1JetHadronAKT04_dphi_ediv               [j][k]);
311                                                                                                                                 fHistList->Add(fH1JetHadronAKT04_dphi_tptweight_ediv     [j][k]);
312                                                                                                                                 fHistList->Add(fH1JetHadronAKT04_dphi_tJptweight_ediv    [j][k]);
313                                                                                                 }
314                                                                 }
315                                 }
316                                 else{
317                                                                 fH1Events                     = new TH1F("Events"                  ,"Events"                  ,1,0,1);
318                                                                 fH1JetAKT04_pt                = new TH1F("JetAKT04_pt"             ,"JetAKT04_pt"             ,400,0,400);
319                                                                 fH1leadJetAKT04_pt            = new TH1F("leadJetAKT04_pt"         ,"leadJetAKT04_pt"         ,400,0,400);
320                                                                 fH1leadJetAKT04_pt_dijet      = new TH1F("leadJetAKT04_pt_dijet"   ,"leadJetAKT04_pt_dijet"   ,400,0,400);
321                                                                 fH1subJetAKT04_pt_dijet       = new TH1F("subJetAKT04_pt_dijet"    ,"subJetAKT04_pt_dijet"    ,400,0,400);
322                                                                 histname = Form("JetsJetAKT04_dphi");
323                                                                 fH2JetsJetAKT04_dphi          = new TH2F(histname,histname,200,0,400,100,-2*pi,2*pi);
324                                                                 histname = Form("JetsJetAKT04_deta");
325                                                                 fH2JetsJetAKT04_deta          = new TH2F(histname,histname,200,0,400,100,-1.5,1.5);
326                                                                 histname = Form("JetsJetAKT04_Aj");
327                                                                 fH2JetsJetAKT04_Aj            = new TH2F(histname,histname,200,0,400,100,0,1.2);
328                                                                 histname = Form("JetsJetAKT04_pt");
329                                                                 fH2JetsJetAKT04_pt            = new TH2F(histname,histname,200,0,400,200,0,400);
330                                                                 for(int j=0;j<5;j++){
331                                                                                                 histname = Form("AKT04_ndiJ_ediv%d",j);
332                                                                                                 fH1AKT04_ndiJ_ediv[j]= new TH1F(histname,histname,1,1,2);
333                                                                                                 for(int k=0;k<5;k++){
334                                                                                                                                 histname = Form("JetHadronAKT04_dphi_ediv%d%d",j,k);
335                                                                                                                                 fH1JetHadronAKT04_dphi_ediv             [j][k]= new TH1F(histname,histname,200,-2*pi,2*pi);
336                                                                                                                                 histname = Form("JetHadronAKT04_dphi_tptweight_ediv%d%d",j,k);
337                                                                                                                                 fH1JetHadronAKT04_dphi_tptweight_ediv   [j][k]= new TH1F(histname,histname,200,-2*pi,2*pi);
338                                                                                                                                 histname = Form("JetHadronAKT04_dphi_tJptweight_ediv%d%d",j,k);
339                                                                                                                                 fH1JetHadronAKT04_dphi_tJptweight_ediv  [j][k]= new TH1F(histname,histname,200,-2*pi,2*pi);
340                                                                                                 }
341                                                                 }
342                                                                 fHistList->Add(fH1Events);
343                                                                 fHistList->Add(fH1JetAKT04_pt          );
344                                                                 fHistList->Add(fH1leadJetAKT04_pt      );
345                                                                 fHistList->Add(fH1leadJetAKT04_pt_dijet);
346                                                                 fHistList->Add(fH1subJetAKT04_pt_dijet );
347                                                                 fHistList->Add(fH2JetsJetAKT04_dphi  );
348                                                                 fHistList->Add(fH2JetsJetAKT04_deta  );
349                                                                 fHistList->Add(fH2JetsJetAKT04_Aj    );
350                                                                 fHistList->Add(fH2JetsJetAKT04_pt    );
351                                                                 for(int j=0;j<5;j++){
352                                                                                                 fHistList->Add(fH1AKT04_ndiJ_ediv    [j]);
353                                                                                                 for(int k=0;k<5;k++){
354                                                                                                                                 fHistList->Add(fH1JetHadronAKT04_dphi_ediv             [j][k]);
355                                                                                                                                 fHistList->Add(fH1JetHadronAKT04_dphi_tptweight_ediv   [j][k]);
356                                                                                                                                 fHistList->Add(fH1JetHadronAKT04_dphi_tJptweight_ediv  [j][k]);
357                                                                                                 }
358                                                                 }
359                                 }
360
361
362
363                                 // =========== Switch on Sumw2 for all histos ===========
364                                 for (Int_t i=0; i<fHistList->GetEntries(); ++i) 
365                                 {
366                                                                 TH1 *h1 = dynamic_cast<TH1*>(fHistList->At(i));
367                                                                 if (h1)
368                                                                 {
369                                                                                                 h1->Sumw2();
370                                                                                                 continue;
371                                                                 }
372                                                                 THnSparse *hn = dynamic_cast<THnSparse*>(fHistList->At(i));
373                                                                 if(hn)hn->Sumw2();
374                                 }
375                                 TH1::AddDirectory(oldStatus);
376
377
378
379
380                                 PostData(1,fHistList);
381
382 }
383
384 //----------------------------------------------------------------------                                                 
385 void AliAnalysisTaskJetHadronCorrelation::Init()
386 {
387                                 // Initialization                                                                                                    
388                                 if (fDebug) printf("AnalysisTaskJetHadronCorrelation::Init() \n");
389
390 }
391
392 Bool_t AliAnalysisTaskJetHadronCorrelation::Notify()
393 {
394
395
396                                 fIfiles++;
397                                 fAODIn = dynamic_cast<AliAODEvent*>(InputEvent());
398                                 fAODOut = AODEvent();
399                                 if(fNonStdFile.Length()!=0){
400                                                                 AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
401                                                                 fAODExtension = (aodH?aodH->GetExtension(fNonStdFile.Data()):0);
402                                                                 if(fAODExtension){
403                                                                                                 if(fDebug>1)Printf("AODExtension found for %s ",fNonStdFile.Data());
404                                                                 }
405                                 }
406
407                                 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
408                                 fxsec=0;
409                                 ftrial=1;
410
411                                 if(tree){
412                                                                 TFile *curfile = tree->GetCurrentFile();
413                                                                 if(!curfile){
414                                                                                                 Error("Notify","No current file");
415                                                                                                 return kFALSE;
416                                                                 }
417
418
419                                                                 if(IsMC){
420                                                                                                 AliPWG4HighPtQAMC::PythiaInfoFromFile(curfile->GetName(),fxsec,ftrial);
421                                                                                                 //cout<<" Xsec "<<fxsec<<" trial "<<ftrial<<endl;
422                                                                                                 fH1Xsec  ->Fill(0.,fxsec);
423                                                                                                 fH1Trials->Fill(0.,ftrial);
424                                                                 }
425                                                                 //else    fH1Events->Fill(0.,ftrial);
426
427                                 }
428
429                                 printf("Reading File %s ",fInputHandler->GetTree()->GetCurrentFile()->GetName());
430                                 return kTRUE;
431 }
432 void AliAnalysisTaskJetHadronCorrelation::FinishTaskOutput()
433 {
434 }
435
436
437
438 //________________________________________________________________________
439 void AliAnalysisTaskJetHadronCorrelation::UserExec(Option_t *) 
440 {
441
442
443                                 // Main loop (called each event)
444                          // Execute analysis for current event
445
446                                 AliAODEvent *fAOD;
447                                 TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
448                                 if( handler && handler->InheritsFrom("AliAODInputHandler") ) {
449                                                                 fAOD  =  ((AliAODInputHandler*)handler)->GetEvent();
450                                                                 if(fUseAODInput) fAODIn = fAOD;
451                                                                 if (fDebug > 1)  Printf("%s:%d AOD event from input", (char*)__FILE__,__LINE__);
452                                 }
453                                 else {
454                                                                 handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();
455                                                                 if( handler && handler->InheritsFrom("AliAODHandler") ) {
456                                                                                                 fAOD = ((AliAODHandler*)handler)->GetAOD();
457                                                                                                 fAODIn = fAOD;
458                                                                                                 if (fDebug > 1)  Printf("%s:%d AOD event from output", (char*)__FILE__,__LINE__);
459                                                                 }
460                                 }
461
462                                 if(!fAODIn && !fUseAODInput){ // case we have AOD in input & output and want jets from output
463                                                                 TObject* outHandler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();
464                                                                 if( outHandler && outHandler->InheritsFrom("AliAODHandler") ) {
465                                                                                                 fAODIn = ((AliAODHandler*)outHandler)->GetAOD();
466                                                                                                 if (fDebug > 1)  Printf("%s:%d jets from output AOD", (char*)__FILE__,__LINE__);
467                                                                 }
468                                 }
469
470                                 //if(fNonStdFile.Length()!=0){
471                                 //                              // case we have an AOD extension - fetch the jets from the extended output
472                                 //                              AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
473                                 //                              fAODExtension = (aodH?aodH->GetExtension(fNonStdFile.Data()):0);
474                                 //                              if(!fAODExtension){
475                                 //                                                              if(fDebug>1)Printf("AODExtension not found for %s",fNonStdFile.Data());
476                                 //                              }
477                                 //}
478                                 //fAODIn = dynamic_cast<AliAODEvent*>(InputEvent());
479                                 if (!fAODIn) {
480                                                                 Printf("ERROR %s : fAODIn not available",(char*)__FILE__);
481                                                                 return;
482                                 }
483
484                                   AliInputEventHandler* inputHandler = (AliInputEventHandler*)
485                                                                             ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
486                                 if(!(inputHandler->IsEventSelected() & AliVEvent::kMB)){
487                                                                 if (fDebug > 1 ) Printf(" Trigger Selection: event REJECTED ... ");
488                                                                 return;
489                                 }
490                                 if(!IsMC)fH1Events->Fill(0);
491
492                                 // start jet analysis
493
494                                 Double_t Jet_n  [20];
495                                 Double_t Jet_pt [20][1000];
496                                 Double_t Jet_eta[20][1000];
497                                 Double_t Jet_phi[20][1000];
498                                 Double_t subJet_n  [20];
499                                 Double_t subJet_pt [20][1000];
500                                 Double_t subJet_eta[20][1000];
501                                 Double_t subJet_phi[20][1000];
502                                 Double_t Track_n  ;
503                                 Double_t Track_pt [1000];
504                                 Double_t Track_eta[1000];
505                                 Double_t Track_phi[1000];
506
507                                 Track_n=0;
508                                 for(int i=0;i<20;i++){
509                                                                 Jet_n[i]=0;
510                                                                 subJet_n[i]=0;
511                                                                 for(int j=0;j<1000;j++){
512                                                                                                 Jet_pt[i][j]=0.;
513                                                                                                 Jet_phi[i][j]=999.;
514                                                                                                 Jet_eta[i][j]=999.;
515                                                                                                 subJet_pt[i][j]=0.;
516                                                                                                 subJet_phi[i][j]=999.;
517                                                                                                 subJet_eta[i][j]=999.;
518                                                                                                 Track_pt [j]=0.;
519                                                                                                 Track_phi[j]=999.;
520                                                                                                 Track_eta[j]=999.;
521                                                                 }
522                                 }
523
524                                 //////-----------------------------------------------------------------------------------
525
526
527                                 int nLJetAOD=999; double ptLJetAOD=0;double phiLJetAOD=999.;double etaLJetAOD=999.;int nsLJetAOD=900;double ptsLJetAOD=0;double phisLJetAOD=900.;double etasLJetAOD=900.;
528                                 int nLJetMC2=999; double ptLJetMC2=0;double phiLJetMC2=999.;double etaLJetMC2=999.;int nsLJetMC2=900;double ptsLJetMC2=0;double phisLJetMC2=900.;double etasLJetMC2=900.;
529                                 int nLJetMC =999; double ptLJetMC =0;double phiLJetMC =999.;double etaLJetMC =999.;int nsLJetMC =900;double ptsLJetMC =0;double phisLJetMC =900.;double etasLJetMC =900.;
530                                 bool findLJetAOD=false;bool findsLJetAOD=false;bool findsLJetAOD_temp=false;
531                                 bool findLJetMC2=false;bool findsLJetMC2=false;bool findsLJetMC2_temp=false;
532                                 bool findLJetMC =false;bool findsLJetMC =false;bool findsLJetMC_temp =false;
533                                 bool findsLJet=false;
534                                 int nLJet = 999;
535
536
537                                 TString cAdd = "";
538                                 cAdd += Form("%02d_",(int)((Radius+0.01)*10.));
539                                 cAdd += Form("B%d",(int)BackM);
540                                 cAdd += Form("_Filter%05d",Filtermask);
541                                 cAdd += Form("_Cut%05d",(int)(1000.*TrackPtcut));
542                                 cAdd += Form("_Skip%02d",SkipCone);
543                                 TString Branchname_gen,Branchname_gen2,Branchname_rec;
544                                 //Branchname_gen  = Form("clustersMCKINE_%s%s",JFAlg.Data(),cAdd.Data());
545                                 //Branchname_gen2 = Form("clustersMCKINE2_%s%s",JFAlg.Data(),cAdd.Data());
546                                 Branchname_gen  = Form("clustersAODMC_%s%s",JFAlg.Data(),cAdd.Data());
547                                 Branchname_gen2 = Form("clustersAODMC2_%s%s",JFAlg.Data(),cAdd.Data());
548                                 Branchname_rec  = Form("clustersAOD_%s%s",JFAlg.Data(),cAdd.Data());
549
550
551                                 for(int algorithm=0;algorithm<3;algorithm++){
552                                                                 //for LHC11a1  LHC11a2
553                                                                 if(algorithm==0)fJetBranch   = Branchname_rec.Data();
554                                                                 if(algorithm==1)fJetBranch   = Branchname_gen2.Data();
555                                                                 if(algorithm==2)fJetBranch   = Branchname_gen.Data();
556
557                                                                 if((!IsMC&&(algorithm==1||algorithm==2)))continue;
558
559                                                                 TClonesArray* jets = dynamic_cast <TClonesArray*> (fAODIn->FindListObject(fJetBranch.Data()));
560                                                                 if(!jets){
561                                                                                                 printf(" Tere are no Branch named %s \n",fJetBranch.Data());
562                                                                                                 continue;
563                                                                 }
564                                                                 Int_t nj = jets->GetEntriesFast();
565                                                                 if (fDebug) printf("There are %5d jets in the event \n", nj);
566                                                                 AliAODJet* jetsAOD;
567                                                                 Jet_n[algorithm] = nj;
568                                                                 int nLjet_in05_pthdiv[20][20];
569                                                                 int nsLjet_in05_pthdiv[20][20];
570                                                                 for(int i=0;i<20;i++){
571                                                                                                 for(int j=0;j<20;j++){
572                                                                                                                                 nLjet_in05_pthdiv [i][j]=0;
573                                                                                                                                 nsLjet_in05_pthdiv[i][j]=0;
574                                                                                                 }
575                                                                 }
576                                                                 //Find Leading Jet -------------------------------------------------------
577                                                                 for(int njet =0;njet<nj;njet++){
578                                                                                                 jetsAOD = (AliAODJet*) (jets->At(njet));
579                                                                                                 Jet_pt   [algorithm][njet] = jetsAOD->Pt();
580                                                                                                 Jet_phi  [algorithm][njet] = jetsAOD->Phi();  
581                                                                                                 Jet_eta  [algorithm][njet] = jetsAOD->Eta();
582                                                                                                 //TRefArray *reftracks = jetsAOD->GetRefTracks();
583                                                                                                 double eta_cut_Jet=0.5;
584                                                                                                 if((TMath::Abs(Jet_eta[algorithm][njet])<eta_cut_Jet)&&(Jet_pt[algorithm][njet]>10.)){
585                                                                                                                                 if(algorithm==0){
586                                                                                                                                                                  fH1JetAKT04_pt->Fill(Jet_pt[algorithm][njet]);  
587                                                                                                                                                                 if(Jet_pt[algorithm][njet]>ptLJetAOD){
588                                                                                                                                                                                                 findLJetAOD=true;
589                                                                                                                                                                                                 nLJetAOD=njet;ptLJetAOD=Jet_pt[algorithm][njet];phiLJetAOD=Jet_phi[algorithm][njet];etaLJetAOD=Jet_eta[algorithm][njet];
590                                                                                                                                                                 }
591                                                                                                                                 }
592                                                                                                                                 if(algorithm==1){
593                                                                                                                                                                  fH1JetMCAKT04_pt->Fill(Jet_pt[algorithm][njet]);  
594                                                                                                                                                                 if(Jet_pt[algorithm][njet]>ptLJetMC2){
595                                                                                                                                                                                                 findLJetMC2=true;
596                                                                                                                                                                                                 nLJetMC2=njet;ptLJetMC2=Jet_pt[algorithm][njet];phiLJetMC2=Jet_phi[algorithm][njet];etaLJetMC2=Jet_eta[algorithm][njet];
597                                                                                                                                                                 }
598                                                                                                                                 }
599                                                                                                                                 if(algorithm==2){
600                                                                                                                                                                 if(Jet_pt[algorithm][njet]>ptLJetMC){
601                                                                                                                                                                                                 findLJetMC=true;
602                                                                                                                                                                                                 nLJetMC=njet;ptLJetMC=Jet_pt[algorithm][njet];phiLJetMC=Jet_phi[algorithm][njet];etaLJetMC=Jet_eta[algorithm][njet];
603                                                                                                                                                                 }
604                                                                                                                                 }
605                                                                                                 }
606                                                                 }//njet loop
607                                                                 //Leading Jet -----------------------------------------------------------
608
609                                                                 if(algorithm==0){nLJet=nLJetAOD;fH1leadJetAKT04_pt->Fill(Jet_pt[algorithm][nLJet]);}
610                                                                 if(algorithm==1){nLJet=nLJetMC2;fH1leadJetMCAKT04_pt->Fill(Jet_pt[algorithm][nLJet]);}
611                                                                 if(algorithm==2){nLJet=nLJetMC2;}
612
613                                                                 if(nj<2)continue;
614                                                                 //Find Sub leading Jet ==================================================
615                                                                 for(int njet=0;njet<nj;njet++){
616                                                                                                 if(njet==nLJet)continue;
617                                                                                                 jetsAOD = (AliAODJet *)jets->At(njet);
618                                                                                                 subJet_pt [algorithm][njet] = jetsAOD->Pt();
619                                                                                                 subJet_phi[algorithm][njet] = jetsAOD->Phi();
620                                                                                                 subJet_eta[algorithm][njet] = jetsAOD->Eta();
621                                                                                                 double eta_cut_Jet=0.5;
622                                                                                                 if((TMath::Abs(subJet_eta[algorithm][njet])<eta_cut_Jet) && (subJet_pt[algorithm][njet]>10.)){
623                                                                                                                                 if(subJet_pt[algorithm][njet]>ptsLJetAOD&&algorithm==0){
624                                                                                                                                                                 findsLJetAOD_temp=true;
625                                                                                                                                                                 nsLJetAOD=njet;ptsLJetAOD=Jet_pt[algorithm][njet];phisLJetAOD=Jet_phi[algorithm][njet];etasLJetAOD=Jet_eta[algorithm][njet];
626                                                                                                                                 }
627                                                                                                                                 if(subJet_pt[algorithm][njet]>ptsLJetMC2 &&algorithm==1){
628                                                                                                                                                                 findsLJetMC2_temp=true;
629                                                                                                                                                                 nsLJetMC2=njet;ptsLJetMC2=Jet_pt[algorithm][njet];phisLJetMC2=Jet_phi[algorithm][njet];etasLJetMC2=Jet_eta[algorithm][njet];
630                                                                                                                                 }
631                                                                                                                                 if(subJet_pt[algorithm][njet]>ptsLJetMC &&algorithm==2){
632                                                                                                                                                                 findsLJetMC_temp=true;
633                                                                                                                                                                 nsLJetMC =njet;ptsLJetMC =Jet_pt[algorithm][njet];phisLJetMC =Jet_phi[algorithm][njet];etasLJetMC =Jet_eta[algorithm][njet];
634                                                                                                                                 }
635                                                                                                 }
636                                                                 }
637                                                                 ////Sub leading Jet ======================================================
638
639                                                                 double Leading_pt=0.;double Leading_phi=999.;double Leading_eta=999.;double sLeading_pt=0.;double sLeading_phi=999.;double sLeading_eta=999.;
640                                                                 if(algorithm==0){Leading_pt=ptLJetAOD;Leading_phi=phiLJetAOD;Leading_eta=etaLJetAOD;sLeading_pt=ptsLJetAOD;sLeading_phi=phisLJetAOD;sLeading_eta=etasLJetAOD;}
641                                                                 if(algorithm==1){Leading_pt=ptLJetMC2;Leading_phi=phiLJetMC2;Leading_eta=etaLJetMC2;sLeading_pt=ptsLJetMC2;sLeading_phi=phisLJetMC2;sLeading_eta=etasLJetMC2;}
642                                                                 if(algorithm==2){Leading_pt=ptLJetMC ;Leading_phi=phiLJetMC ;Leading_eta=etaLJetMC ;sLeading_pt=ptsLJetMC ;sLeading_phi=phisLJetMC ;sLeading_eta=etasLJetMC ;}
643
644                                                                 ////Di-Jet event trigger +++++++++++++++++++++++++++++++++++++++++++++++
645                                                                 double DPhi = DeltaPhi(Leading_phi,sLeading_phi);
646                                                                 double DEta = Leading_eta-sLeading_eta;
647                                                                 if(algorithm==0){
648                                                                                                 fH2JetsJetAKT04_dphi->Fill(Leading_pt,DPhi);
649                                                                                                 fH2JetsJetAKT04_deta->Fill(Leading_pt,DEta);
650                                                                 }
651                                                                 if(algorithm==1){
652                                                                                                 fH2JetsJetMCAKT04_dphi->Fill(Leading_pt,DPhi);
653                                                                                                 fH2JetsJetMCAKT04_deta->Fill(Leading_pt,DEta);
654                                                                 }
655                                                                 if((TMath::Cos(DPhi)<-0.5)&&(Leading_pt>10.)&&(sLeading_pt>10.)){
656                                                                                                 if(algorithm==0)findsLJetAOD=true;                                                         
657                                                                                                 if(algorithm==1)findsLJetMC=true;                                                         
658
659                                                                                                 double Aj = (Leading_pt-sLeading_pt)/(Leading_pt+sLeading_pt);
660                                                                                                 if(algorithm==0){
661                                                                                                                                 fH1leadJetAKT04_pt_dijet->Fill(Leading_pt);
662                                                                                                                                 fH1subJetAKT04_pt_dijet ->Fill(sLeading_pt);
663                                                                                                                                 fH2JetsJetAKT04_Aj->Fill(Leading_pt,Aj);
664                                                                                                                                 fH2JetsJetAKT04_pt->Fill(Leading_pt,sLeading_pt);
665                                                                                                 }
666                                                                                                 if(algorithm==1){
667                                                                                                                                 fH1leadJetMCAKT04_pt_dijet->Fill(Leading_pt);
668                                                                                                                                 fH1subJetMCAKT04_pt_dijet ->Fill(sLeading_pt);
669                                                                                                                                 fH2JetsJetMCAKT04_Aj->Fill(Leading_pt,Aj);
670                                                                                                                                 fH2JetsJetMCAKT04_pt->Fill(Leading_pt,sLeading_pt);
671                                                                                                 }
672
673                                                                                                 for(int eb=0;eb<5;eb++){//count number of Di-Jet in pt bin
674                                                                                                                                 if(TMath::Abs(Leading_pt -20.*(eb+1))<10.){
675                                                                                                                                                                 if(algorithm==0)fH1AKT04_ndiJ_ediv[eb]->Fill(1);
676                                                                                                                                 }
677                                                                                                 }
678                                                                 }
679                                                                 if(algorithm==0)findsLJet=findsLJetAOD;
680                                                                 if(algorithm==1)findsLJet=findsLJetMC2;
681                                                                 if(algorithm==2)findsLJet=findsLJetMC;
682                                                                 ////++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
683
684                                                                 if(algorithm>=2)continue;
685
686                                                                 if((findsLJet)&&(Leading_pt>10.)&&(sLeading_pt>10.)){
687                                                                                                 fJetBranch = "tracks";
688                                                                                                 TClonesArray* tracks = dynamic_cast <TClonesArray*> (fAODIn->FindListObject(fJetBranch.Data()));
689                                                                 
690                                                                                                 if(!tracks)continue;
691                                                                                                 Int_t nt = tracks->GetEntriesFast();
692                                                                                                 AliAODTrack* trackAOD;
693                                                                                                 Track_n = nt;
694                                                                                                 for(int njet=0;njet<Jet_n[algorithm];njet++){
695                                                                                                                                 if(njet!=nLJet)continue;
696                                                                                                                                 double eta_cut_Jet=0.5;
697                                                                                                                                 if(TMath::Abs(Jet_eta[algorithm][njet])<eta_cut_Jet){
698                                                                                                                                                                 for(int eb=0;eb<5;eb++){
699                                                                                                                                                                                                 if(TMath::Abs(Jet_pt[algorithm][njet] -20.*(eb+1))<10.){
700                                                                                                                                                                                                                                 for(int ntrack =0;ntrack<nt;ntrack++){
701                                                                                                                                                                                                                                                                 trackAOD = (AliAODTrack*) (tracks->At(ntrack));
702                                                                                                                                                                                                                                                                 if(trackAOD->TestFilterMask(Filtermask)){
703                                                                                                                                                                                                                                                                                                 Track_pt   [ntrack]      = trackAOD->Pt();
704                                                                                                                                                                                                                                                                                                 Track_phi  [ntrack]      = trackAOD->Phi();
705                                                                                                                                                                                                                                                                                                 Track_eta  [ntrack]      = trackAOD->Eta();
706                                                                                                                                                                                                                                                                                                 double DelPhi = DeltaPhi(Jet_phi[algorithm][njet],Track_phi[ntrack]);
707                                                                                                                                                                                                                                                                                                 if(TMath::Abs(Track_eta[ntrack])<0.9){
708                                                                                                                                                                                                                                                                                                                                 for(int teb=0;teb<5;teb++){
709                                                                                                                                                                                                                                                                                                                                                                 if(teb==0){if(!(Track_pt[ntrack]>0.15))continue;}
710                                                                                                                                                                                                                                                                                                                                                                 if(teb==1){if(!((Track_pt[ntrack]<1.5)&&(Track_pt[ntrack]>0.15)))continue;}
711                                                                                                                                                                                                                                                                                                                                                                 if(teb==2){if(!((Track_pt[ntrack]<3.0)&&(Track_pt[ntrack]>1.5)))continue;}
712                                                                                                                                                                                                                                                                                                                                                                 if(teb==3){if(!((Track_pt[ntrack]<4.5)&&(Track_pt[ntrack]>3.0)))continue;}
713                                                                                                                                                                                                                                                                                                                                                                 if(teb==4){if(!(Track_pt[ntrack]>4.5))continue;}
714                                                                                                                                                                                                                                                                                                                                                                 if(algorithm==0){
715                                                                                                                                                                                                                                                                                                                                                                                         fH1JetHadronAKT04_dphi_ediv                [eb][teb]->Fill(DelPhi); 
716                                                                                                                                                                                                                                                                                                                                                                                         fH1JetHadronAKT04_dphi_tptweight_ediv      [eb][teb]->Fill(DelPhi,Track_pt[ntrack]);
717                                                                                                                                                                                                                                                                                                                                                                                         fH1JetHadronAKT04_dphi_tJptweight_ediv     [eb][teb]->Fill(DelPhi,Track_pt[ntrack]/Jet_pt[algorithm][njet]);
718                                                                                                                                                                                                                                                                                                                                                                 }
719                                                                                                                                                                                                                                                                                                                                 }
720                                                                                                                                                                                                                                                                                                 }
721                                                                                                                                                                                                                                                                 }
722                                                                                                                                                                                                                                 }//Track Loop
723                                                                                                                                                                                                 }
724                                                                                                                                                                 }
725                                                                                                                                 }//eta cut
726                                                                                                 }//Jet Loop
727                                                                 }// Di-Jet
728                                 }// algorithm LOOP
729                                 if(IsMC){
730                                                                 for(int eb=0;eb<5;eb++){
731                                                                                                 double DPhi;
732                                                                                                 if(TMath::Abs(ptLJetAOD -20.*(eb+1))<10.){
733                                                                                                                                 DPhi = DeltaPhi(phiLJetMC,phiLJetAOD);
734                                                                                                                                 fH1leadJetMCAKT04_dphiResolution[eb]->Fill(DPhi);
735                                                                                                                                 DPhi = DeltaPhi(phisLJetMC,phisLJetAOD);
736                                                                                                                                 fH1subJetMCAKT04_dphiResolution[eb]->Fill(DPhi);
737                                                                                                 }
738                                                                 }
739                                 }
740
741
742
743
744
745                                 PostData(1, fHistList);
746                                 return;
747 }      
748
749 //________________________________________________________________________
750 void AliAnalysisTaskJetHadronCorrelation::Terminate(Option_t *) 
751 {
752                                 // Terminate analysis
753                                 if (fDebug) printf("AnalysisTaskPt: Terminate() \n");
754
755 }
756
757
758 Int_t  AliAnalysisTaskJetHadronCorrelation::GetListOfJets(TList *list,TClonesArray* jarray,Int_t type){
759
760                                 if(fDebug>2)Printf("%s:%d Selecting jets with cuts %d",(char*)__FILE__,__LINE__,type);
761                                 Int_t iCount = 0;
762
763                                 if(!jarray){
764                                                                 Printf("%s:%d no Jet array",(char*)__FILE__,__LINE__);
765                                                                 return iCount;
766                                 }
767
768
769                                 for(int ij=0;ij<jarray->GetEntries();ij++){
770                                                                 AliAODJet* jet = (AliAODJet*)jarray->At(ij);
771                                                                 if(!jet)continue;
772                                                                 if(type==0){
773                                                                                                 // No cut at all, main purpose here is sorting      
774                                                                                                 list->Add(jet);
775                                                                                                 iCount++;
776                                                                 }
777                                                                 else if(type == 1){
778                                                                                                 // eta cut
779                                                                                                 if(JetSelected(jet)){
780                                                                                                                                 list->Add(jet);
781                                                                                                                                 iCount++;
782                                                                                                 }
783                                                                 }
784                                 }
785
786                                 list->Sort();
787                                 return iCount;
788
789 }
790
791
792
793 Bool_t  AliAnalysisTaskJetHadronCorrelation::JetSelected(AliAODJet *jet){
794                                 Bool_t selected = false;
795
796                                 if(!jet)return selected;
797
798                                 if(fabs(jet->Eta())<fJetRecEtaWindow&&jet->Pt()>fMinJetPt){
799                                                                 selected = kTRUE;
800                                 }
801                                 return selected;
802
803 }
804
805
806 Double_t AliAnalysisTaskJetHadronCorrelation::DeltaPhi(Double_t phi1,Double_t phi2){
807                                 Float_t pi=TMath::Pi();
808                                 Double_t dphi = phi1-phi2;
809                                 if     (dphi<(-1./2*pi))dphi = dphi +2*pi;
810                                 else if(dphi>( 3./2*pi))dphi = dphi -2*pi;
811                                 return dphi;
812 }
813
814 //Float_t AliAnalysisTaskJetHadronCorrelation::GetTotalEvents(const char* currFile){
815 //                              Float_t totalevent;
816 //                              //TString file_es(currFile);
817 //                              //if(file_es.Contains("root_archive.zip#")){
818 //                              //                              Ssiz_t pos1 = file_es.Index("root_archive",12,TString::kExact);
819 //                              //                              Ssiz_t pos = file_es.Index("#",1,pos1,TString::kExact);
820 //                              //                              file_es.Replace(pos+1,20,"");
821 //                              //}
822 //                              //else {
823 //                              //                              // not an archive take the basename....
824 //                              //                              file_es.ReplaceAll(gSystem->BaseName(file_es.Data()),"");
825 //                              //}
826 //
827 //                              //TString cAdd = "";
828 //                              //cAdd += Form("%02d_",(int)((Radius+0.01)*10.));
829 //                              //cAdd += Form("B%d",(int)BackM);
830 //                              //cAdd += Form("_Filter%05d",Filtermask);
831 //                              //cAdd += Form("_Cut%05d",(int)(1000.*TrackPtcut));
832 //                              //cAdd += Form("_Skip%02d",SkipCone);
833 //                              //TString Dirname,Listname;
834 //                              //Dirname  = Form("PWG4_cluster_AOD__%s%s",JFAlg.Data(),cAdd.Data());
835 //                              //Listname = Form("pwg4cluster_AOD__%s%s",JFAlg.Data(),cAdd.Data());
836 //
837 //                              //TFile *feventstat = TFile::Open(Form("%s%s",file_es.Data(),"JetTasksOutput.root"));
838 //                              //gROOT->Cd(Dirname.Data());
839 //                              //TList *templist     = (TList*)gROOT->FindObject(Listname.Data());
840 //                              //TH1F* temphist = (TH1F*)templist->FindObject("fh1Trials");
841 //                              //totalevent = temphist->Integral();
842 //                              ////cout<<temphist->Integral()<<endl;
843 //                              //delete feventstat;
844 //                              return totalevent;
845 //
846 //}
847
848