AliPhysics  695988a (695988a)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskCRCZDC.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2008, 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 thce 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 /**********************************
17  * analysis task for CRC with ZDC *
18  * *
19  * author: Jacopo Margutti *
20  * (margutti@nikhef.nl) *
21  **********************************/
22 
23 #include "Riostream.h" //needed as include
24 #include "TChain.h"
25 #include "TList.h"
26 #include "TTree.h"
27 #include "TRandom3.h"
28 #include "TTimeStamp.h"
29 #include "TProfile.h"
30 #include <TList.h>
31 #include <TH1F.h>
32 #include <TH2F.h>
33 #include <TFile.h>
34 #include <TString.h>
35 #include <TCanvas.h>
36 #include <TParticle.h>
37 
38 #include "AliAnalysisManager.h"
39 #include "AliInputEventHandler.h"
40 #include "AliVEvent.h"
41 #include "AliESD.h"
42 #include "AliESDEvent.h"
43 #include "AliESDHeader.h"
44 #include "AliESDInputHandler.h"
45 #include "AliESDZDC.h"
46 #include "AliMultiplicity.h"
47 #include "AliAnalysisUtils.h"
48 #include "AliAODHandler.h"
49 #include "AliAODTrack.h"
50 #include "AliAODEvent.h"
51 #include "AliAODHeader.h"
52 #include "AliAODVertex.h"
53 #include "AliAODVZERO.h"
54 #include "AliAODZDC.h"
55 #include "AliAODMCHeader.h"
56 #include "AliMCEventHandler.h"
57 #include "AliMCEvent.h"
58 #include "AliHeader.h"
59 #include "AliVParticle.h"
60 #include "AliStack.h"
61 #include "AliAODMCParticle.h"
62 #include "AliAnalysisTaskSE.h"
63 #include "AliGenEventHeader.h"
64 #include "AliPhysicsSelectionTask.h"
65 #include "AliPhysicsSelection.h"
66 #include "AliBackgroundSelection.h"
67 #include "AliTriggerAnalysis.h"
68 #include "AliCentrality.h"
69 #include "AliAnalysisTaskCRCZDC.h"
70 
71 // ALICE Correction Framework
72 #include "AliCFManager.h"
73 
74 // Interface to Event generators to get Reaction Plane Angle
75 #include "AliGenCocktailEventHeader.h"
76 #include "AliGenPythiaEventHeader.h"
77 #include "AliGenHijingEventHeader.h"
78 #include "AliGenGeVSimEventHeader.h"
79 #include "AliGenEposEventHeader.h"
80 
81 // Interface to Load short life particles
82 #include "TObjArray.h"
83 #include "AliFlowCandidateTrack.h"
84 
85 // Interface to make the Flow Event Simple used in the flow analysis methods
86 #include "AliFlowEvent.h"
87 #include "AliFlowTrackCuts.h"
88 #include "AliFlowEventCuts.h"
89 #include "AliFlowCommonConstants.h"
90 
92 
93 //________________________________________________________________________
95 AliAnalysisTaskSE(""),
96 fAnalysisType("AUTOMATIC"),
97 fRPType(""),
98 fCFManager1(NULL),
99 fCFManager2(NULL),
100 fCutsEvent(NULL),
101 fCutsRP(NULL),
102 fCutsPOI(NULL),
103 fCutContainer(new TList()),
104 fQAList(NULL),
105 fMinMult(0),
106 fMaxMult(10000000),
107 fMinA(-1.0),
108 fMaxA(-0.01),
109 fMinB(0.01),
110 fMaxB(1.0),
111 fGenHeader(NULL),
112 fPythiaGenHeader(NULL),
113 fHijingGenHeader(NULL),
114 fFlowTrack(NULL),
115 fAnalysisUtil(NULL),
116 fQAon(kFALSE),
117 fLoadCandidates(kFALSE),
118 fNbinsMult(10000),
119 fNbinsPt(100),
120 fNbinsPhi(100),
121 fNbinsEta(200),
122 fNbinsQ(500),
123 fNbinsMass(1),
124 fMultMin(0.),
125 fMultMax(10000.),
126 fPtMin(0.),
127 fPtMax(10.),
128 fPhiMin(0.),
129 fPhiMax(TMath::TwoPi()),
130 fEtaMin(-5.),
131 fEtaMax(5.),
132 fQMin(0.),
133 fQMax(3.),
134 fMassMin(-1.),
135 fMassMax(0.),
136 fHistWeightvsPhiMin(0.),
137 fHistWeightvsPhiMax(3.),
138 fExcludedEtaMin(0.),
139 fExcludedEtaMax(0.),
140 fExcludedPhiMin(0.),
141 fExcludedPhiMax(0.),
142 fAfterburnerOn(kFALSE),
143 fNonFlowNumberOfTrackClones(0),
144 fV1(0.),
145 fV2(0.),
146 fV3(0.),
147 fV4(0.),
148 fV5(0.),
149 fDifferentialV2(0),
150 fFlowEvent(NULL),
151 fShuffleTracks(kFALSE),
152 fMyTRandom3(NULL),
153 fAnalysisInput(kAOD),
154 fIsMCInput(kFALSE),
155 fUseMCCen(kTRUE),
156 fRejectPileUp(kTRUE),
157 fCentrLowLim(0.),
158 fCentrUpLim(100.),
159 fCentrEstimator("V0M"),
160 fOutput(0x0),
161 fhZNCvsZNA(0x0),
162 fhZPCvsZPA(0x0),
163 fhZDCCvsZDCCA(0x0),
164 fhZNCvsZPC(0x0),
165 fhZNAvsZPA(0x0),
166 fhZNvsZP(0x0),
167 fhZNvsVZERO(0x0),
168 fhZDCvsVZERO(0x0),
169 fhZDCvsTracklets(0x0),
170 fhZDCvsNclu1(0x0),
171 fhDebunch(0x0),
172 fhZNCcentroid(0x0),
173 fhZNAcentroid(0x0),
174 fhAsymm(0x0),
175 fhZNAvsAsymm(0x0),
176 fhZNCvsAsymm(0x0),
177 fhZNCvscentrality(0x0),
178 fhZNAvscentrality(0x0),
179 fhZPCvscentrality(0x0),
180 fhZPAvscentrality(0x0),
181 fhZNCpmcvscentr(0x0),
182 fhZNApmcvscentr(0x0),
183 fhZPCpmcvscentr(0x0),
184 fhZPApmcvscentr(0x0),
185 fhZNCpmcLR(0x0),
186 fhZNApmcLR(0x0),
187 fhZPCpmcLR(0x0),
188 fhZPApmcLR(0x0),
189 fCRCnRun(0),
190 fZDCGainAlpha(0.395),
191 fDataSet("2010"),
192 fStack(0x0),
193 fCutTPC(kFALSE)
194 {
195  for(int i=0; i<5; i++){
196  fhZNCPM[i] = 0x0;
197  fhZNAPM[i] = 0x0;
198  fhZPCPM[i] = 0x0;
199  fhZPAPM[i] = 0x0;
200  fhZNCPMlg[i] = 0x0;
201  fhZNAPMlg[i] = 0x0;
202  fhZPCPMlg[i] = 0x0;
203  fhZPAPMlg[i] = 0x0;
204  }
205  for(int i=0; i<2; i++) fhZEM[i] = 0x0;
206  for(int i=0; i<6; i++){
207  fhTDCraw[i] = 0x0;
208  fhTDC[i] = 0x0;
209  }
210  for(int i=0; i<4; i++){
211  fhZNCPMQiPMC[i] = 0x0;
212  fhZNAPMQiPMC[i] = 0x0;
213  fhZPCPMQiPMC[i] = 0x0;
214  fhZPAPMQiPMC[i] = 0x0;
215  fhPMCvsPMQ[i] = 0x0;
216  }
217  for(Int_t r=0; r<fCRCMaxnRun; r++) {
218  fRunList[r] = 0;
219  }
220  this->InitializeRunArrays();
221  fMyTRandom3 = new TRandom3(1);
222  gRandom->SetSeed(fMyTRandom3->Integer(65539));
223  for(Int_t c=0; c<10; c++) {
224  fPtSpecGen[c] = NULL;
225  fPtSpecRec[c] = NULL;
226  }
227 }
228 
229 //________________________________________________________________________
230 AliAnalysisTaskCRCZDC::AliAnalysisTaskCRCZDC(const char *name, TString RPtype, Bool_t on, TString DataSet, UInt_t iseed, Bool_t bCandidates):
231 AliAnalysisTaskSE(name),
232 fAnalysisType("AUTOMATIC"),
233 fRPType(RPtype),
234 fCFManager1(NULL),
235 fCFManager2(NULL),
236 fCutsEvent(NULL),
237 fCutsRP(NULL),
238 fCutsPOI(NULL),
239 fCutContainer(new TList()),
240 fQAList(NULL),
241 fMinMult(0),
242 fMaxMult(10000000),
243 fMinA(-1.0),
244 fMaxA(-0.01),
245 fMinB(0.01),
246 fMaxB(1.0),
247 fQAon(on),
248 fLoadCandidates(bCandidates),
249 fNbinsMult(10000),
250 fNbinsPt(100),
251 fNbinsPhi(100),
252 fNbinsEta(200),
253 fNbinsQ(500),
254 fNbinsMass(1),
255 fMultMin(0.),
256 fMultMax(10000.),
257 fPtMin(0.),
258 fPtMax(10.),
259 fPhiMin(0.),
260 fPhiMax(TMath::TwoPi()),
261 fEtaMin(-5.),
262 fEtaMax(5.),
263 fQMin(0.),
264 fQMax(3.),
265 fMassMin(-1.),
266 fMassMax(0.),
267 fHistWeightvsPhiMin(0.),
268 fHistWeightvsPhiMax(3.),
269 fExcludedEtaMin(0.),
270 fExcludedEtaMax(0.),
271 fExcludedPhiMin(0.),
272 fExcludedPhiMax(0.),
273 fAfterburnerOn(kFALSE),
274 fNonFlowNumberOfTrackClones(0),
275 fV1(0.),
276 fV2(0.),
277 fV3(0.),
278 fV4(0.),
279 fV5(0.),
280 fDifferentialV2(0),
281 fFlowEvent(NULL),
282 fShuffleTracks(kFALSE),
283 fMyTRandom3(NULL),
284 fAnalysisInput(kAOD),
285 fIsMCInput(kFALSE),
286 fUseMCCen(kTRUE),
287 fRejectPileUp(kTRUE),
288 fCentrLowLim(0.),
289 fCentrUpLim(100.),
290 fCentrEstimator("V0M"),
291 fOutput(0x0),
292 fhZNCvsZNA(0x0),
293 fhZPCvsZPA(0x0),
294 fhZDCCvsZDCCA(0x0),
295 fhZNCvsZPC(0x0),
296 fhZNAvsZPA(0x0),
297 fhZNvsZP(0x0),
298 fhZNvsVZERO(0x0),
299 fhZDCvsVZERO(0x0),
300 fhZDCvsTracklets(0x0),
301 fhZDCvsNclu1(0x0),
302 fhDebunch(0x0),
303 fhZNCcentroid(0x0),
304 fhZNAcentroid(0x0),
305 fhAsymm(0x0),
306 fhZNAvsAsymm(0x0),
307 fhZNCvsAsymm(0x0),
308 fhZNCvscentrality(0x0),
309 fhZNAvscentrality(0x0),
310 fhZPCvscentrality(0x0),
311 fhZPAvscentrality(0x0),
312 fhZNCpmcvscentr(0x0),
313 fhZNApmcvscentr(0x0),
314 fhZPCpmcvscentr(0x0),
315 fhZPApmcvscentr(0x0),
316 fhZNCpmcLR(0x0),
317 fhZNApmcLR(0x0),
318 fhZPCpmcLR(0x0),
319 fhZPApmcLR(0x0),
320 fDataSet(DataSet),
321 fCRCnRun(0),
322 fZDCGainAlpha(0.395),
323 fGenHeader(NULL),
324 fPythiaGenHeader(NULL),
325 fHijingGenHeader(NULL),
326 fFlowTrack(NULL),
327 fAnalysisUtil(NULL),
328 fStack(0x0),
329 fCutTPC(kFALSE)
330 {
331 
332  for(int i=0; i<5; i++){
333  fhZNCPM[i] = 0x0;
334  fhZNAPM[i] = 0x0;
335  fhZPCPM[i] = 0x0;
336  fhZPAPM[i] = 0x0;
337  fhZNCPMlg[i] = 0x0;
338  fhZNAPMlg[i] = 0x0;
339  fhZPCPMlg[i] = 0x0;
340  fhZPAPMlg[i] = 0x0;
341  }
342  for(int i=0; i<2; i++) fhZEM[i] = 0x0;
343  for(int i=0; i<6; i++){
344  fhTDCraw[i] = 0x0;
345  fhTDC[i] = 0x0;
346  }
347  for(int i=0; i<4; i++){
348  fhZNCPMQiPMC[i] = 0x0;
349  fhZNAPMQiPMC[i] = 0x0;
350  fhZPCPMQiPMC[i] = 0x0;
351  fhZPAPMQiPMC[i] = 0x0;
352  fhPMCvsPMQ[i] = 0x0;
353  }
354  for(Int_t r=0; r<fCRCMaxnRun; r++) {
355  fRunList[r] = 0;
356  }
357  this->InitializeRunArrays();
358  fMyTRandom3 = new TRandom3(iseed);
359  gRandom->SetSeed(fMyTRandom3->Integer(65539));
360 
361  DefineInput(0, TChain::Class());
362  // Define output slots here
363  // Define here the flow event output
364  DefineOutput(1, AliFlowEventSimple::Class());
365  DefineOutput(2, TList::Class());
366 
367  for(Int_t c=0; c<10; c++) {
368  fPtSpecGen[c] = NULL;
369  fPtSpecRec[c] = NULL;
370  }
371 
372 }
373 
374 //________________________________________________________________________
376 {
377  // Destructor
378  if(fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
379  delete fOutput; fOutput=0;
380  }
381  delete fMyTRandom3;
382  delete fFlowEvent;
383  delete fFlowTrack;
384  delete fCutsEvent;
385  if (fAnalysisUtil) delete fAnalysisUtil;
386  if (fQAList) delete fQAList;
387  if (fCutContainer) fCutContainer->Delete(); delete fCutContainer;
388  if (fStack) delete fStack;
389 }
390 
391 //________________________________________________________________________
393 {
394  for(Int_t r=0;r<fCRCMaxnRun;r++) {
395  fCRCQVecListRun[r] = NULL;
396  for(Int_t i=0;i<fCRCnTow;i++) {
397  fhnTowerGain[r][i] = NULL;
398  }
399  }
400 }
401 
402 //________________________________________________________________________
404 {
405  // Create the output containers
406 
407  if (!(fAnalysisType == "AOD" || fAnalysisType == "MCkine" || fAnalysisType == "MCAOD" || fAnalysisType == "AUTOMATIC" || fAnalysisType == "MCESD"))
408  {
409  AliError("WRONG ANALYSIS TYPE! only MCESD, MCkine, MCAOD, AOD and AUTOMATIC are allowed.");
410  exit(1);
411  }
412 
413  //set the common constants
416  cc->SetNbinsPt(fNbinsPt);
417  cc->SetNbinsPhi(fNbinsPhi);
418  cc->SetNbinsEta(fNbinsEta);
419  cc->SetNbinsQ(fNbinsQ);
421  cc->SetMultMin(fMultMin);
422  cc->SetMultMax(fMultMax);
423  cc->SetPtMin(fPtMin);
424  cc->SetPtMax(fPtMax);
425  cc->SetPhiMin(fPhiMin);
426  cc->SetPhiMax(fPhiMax);
427  cc->SetEtaMin(fEtaMin);
428  cc->SetEtaMax(fEtaMax);
429  cc->SetQMin(fQMin);
430  cc->SetQMax(fQMax);
431  cc->SetMassMin(fMassMin);
432  cc->SetMassMax(fMassMax);
435 
436  fFlowEvent = new AliFlowEvent(20000);
437  fFlowTrack = new AliFlowTrack();
438 
439  //printf(" AliAnalysisTaskCRCZDC::UserCreateOutputObjects()\n\n");
440  fOutput = new TList();
441  fOutput->SetOwner(kTRUE);
442  //fOutput->SetName("output");
443 
444  if (fQAon) {
445  fQAList = new TList();
446  fQAList->SetOwner(kTRUE);
447  fQAList->SetName("AliFlowEventCuts QA");
448  if (fCutsEvent->GetQA()) fQAList->Add(fCutsEvent->GetQA()); //0
449  if (fCutsRP->GetQA()) fQAList->Add(fCutsRP->GetQA()); //1
450  if (fCutsPOI->GetQA())fQAList->Add(fCutsPOI->GetQA()); //2
451  fOutput->Add(fQAList);
452  }
453 
454  Float_t xmin[] = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.,1.2,1.4,1.6,1.8,2.,2.33,2.66,3.,3.5,4.,4.5,5.,6.,7.,8.};
455  for(Int_t c=0; c<10; c++) {
456  fPtSpecGen[c] = new TH1F(Form("fPtSpecGen[%d]",c), Form("fPtSpecGen[%d]",c), 24, xmin);
457  fOutput->Add(fPtSpecGen[c]);
458  fPtSpecRec[c] = new TH1F(Form("fPtSpecRec[%d]",c), Form("fPtSpecRec[%d]",c), 24, xmin);
459  fOutput->Add(fPtSpecRec[c]);
460  }
461 
462  fAnalysisUtil = new AliAnalysisUtils;
463 
464  for(int i=0; i<5; i++){
465  char hname[20];
466  sprintf(hname,"hZNCPM%d",i);
467  fhZNCPM[i] = new TH1F(hname, hname, 200, -50., 140000);
468  fOutput->Add(fhZNCPM[i]);
469  //
470  sprintf(hname,"hZNAPM%d",i);
471  fhZNAPM[i] = new TH1F(hname, hname, 200, -50., 140000);
472  fOutput->Add(fhZNAPM[i]);
473  //
474  sprintf(hname,"hZPCPM%d",i);
475  fhZPCPM[i] = new TH1F(hname, hname, 200, -50., 50000);
476  fOutput->Add(fhZPCPM[i]);
477  //
478  sprintf(hname,"hZPAPM%d",i);
479  fhZPAPM[i] = new TH1F(hname, hname, 200, -50., 50000);
480  fOutput->Add(fhZPAPM[i]);
481  //
482  sprintf(hname,"hZNCPMlg%d",i);
483  fhZNCPMlg[i] = new TH1F(hname, hname, 200, -50., 140000);
484  fOutput->Add(fhZNCPMlg[i]);
485  //
486  sprintf(hname,"hZNAPMlg%d",i);
487  fhZNAPMlg[i] = new TH1F(hname, hname, 200, -50., 140000);
488  fOutput->Add(fhZNAPMlg[i]);
489  //
490  sprintf(hname,"hZPCPMlg%d",i);
491  fhZPCPMlg[i] = new TH1F(hname, hname, 200, -50., 50000);
492  fOutput->Add(fhZPCPMlg[i]);
493  //
494  sprintf(hname,"hZPAPMlg%d",i);
495  fhZPAPMlg[i] = new TH1F(hname, hname, 200, -50., 50000);
496  fOutput->Add(fhZPAPMlg[i]);
497  //
498  if(i<4){
499  //
500  char hnamenc[20];
501  sprintf(hnamenc, "hZNCPMQ%dPMC",i+1);
502  fhZNCPMQiPMC[i] = new TH1F(hnamenc, hnamenc, 100, 0., 1.);
503  fOutput->Add(fhZNCPMQiPMC[i]);
504  //
505  char hnamena[20];
506  sprintf(hnamena, "hZNAPMQ%dPMC",i+1);
507  fhZNAPMQiPMC[i] = new TH1F(hnamena, hnamena, 100, 0., 1.);
508  fOutput->Add(fhZNAPMQiPMC[i]);
509  //
510  char hnamepc[20];
511  sprintf(hnamepc, "hZPCPMQ%dPMC",i+1);
512  fhZPCPMQiPMC[i] = new TH1F(hnamepc, hnamepc, 100, 0., 1.);
513  fOutput->Add(fhZPCPMQiPMC[i]);
514  //
515  char hnamepa[20];
516  sprintf(hnamepa, "hZPAPMQ%dPMC",i+1);
517  fhZPAPMQiPMC[i] = new TH1F(hnamepa, hnamepa, 100, 0., 1.);
518  fOutput->Add(fhZPAPMQiPMC[i]);
519  }
520  }
521  for(int i=0; i<6; i++){
522  if(i==0){
523  fhZEM[i] = new TH1F("hZEM1","hZEM1",200,-10.,1190.);
524  fhTDCraw[i] = new TH1F("hTDCZEM1raw", "hTDCZEM1raw", 200, -200., 0.);
525  fhTDC[i] = new TH1F("hTDCZEM1", "hTDCZEM1", 200, -150., 50.);
526  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZNC","hPMCvsPMQZNC",200,-10.,140000,200,-10.,140000);
527  //
528  fOutput->Add(fhZEM[i]);
529  fOutput->Add(fhPMCvsPMQ[i]);
530  }
531  else if(i==1){
532  fhZEM[i] = new TH1F("hZEM2","hZEM2",200,-10.,1190.);
533  fhTDCraw[i] = new TH1F("hTDCZEM2raw", "hTDCZEM2raw", 200, -200., 0.);
534  fhTDC[i] = new TH1F("hTDCZEM2", "hTDCZEM2", 200, -150., 50.);
535  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZPC","hPMCvsPMQZPC",200,-10.,50000,200,-10.,50000);
536  //
537  fOutput->Add(fhZEM[i]);
538  fOutput->Add(fhPMCvsPMQ[i]);
539  }
540  else if(i==2){
541  fhTDCraw[i] = new TH1F("hTDCZNCraw", "hTDCZNCraw", 200, -200., 0.);
542  fhTDC[i] = new TH1F("hTDCZNC", "hTDCZNC", 200, -150., 50.);
543  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZNA","hPMCvsPMQZNA",200,-10.,140000,200,-10.,140000);
544  //
545  fOutput->Add(fhPMCvsPMQ[i]);
546  }
547  else if(i==3){
548  fhTDCraw[i] = new TH1F("hTDCZPCraw", "hTDCZPCraw", 200, -200., 0.);
549  fhTDC[i] = new TH1F("hTDCZPC", "hTDCZPC", 200, -150., 50.);
550  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZPA","hPMCvsPMQZPA",200,-10.,50000,200,-10.,50000);
551  //
552  fOutput->Add(fhPMCvsPMQ[i]);
553  }
554  else if(i==4){
555  fhTDCraw[i] = new TH1F("hTDCZNAraw", "hTDCZNAraw", 200, -200., 0.);
556  fhTDC[i] = new TH1F("hTDCZNA", "hTDCZNA", 200, -150., 50.);
557  }
558  else if(i==5){
559  fhTDCraw[i] = new TH1F("hTDCZPAraw", "hTDCZPAraw", 200, -200., 0.);
560  fhTDC[i] = new TH1F("hTDCZPA", "hTDCZPA", 200, -150., 50.);
561  }
562  //
563  fOutput->Add(fhTDC[i]);
564  }
565 
566  fhZNCvsZNA = new TH2F("hZNCvsZNA","hZNCvsZNA",200,-50.,140000,200,-50.,140000);
567  fOutput->Add(fhZNCvsZNA);
568  fhZPCvsZPA = new TH2F("hZPCvsZPA","hZPCvsZPA",200,-50.,50000,200,-50.,50000);
569  fOutput->Add(fhZPCvsZPA);
570  fhZDCCvsZDCCA = new TH2F("hZDCCvsZDCCA","hZDCCvsZDCCA",200,0.,180000.,200,0.,200000.);
571  fOutput->Add(fhZDCCvsZDCCA);
572  fhZNCvsZPC = new TH2F("hZNCvsZPC","hZNCvsZPC",200,-50.,50000,200,-50.,140000);
573  fOutput->Add(fhZNCvsZPC);
574  fhZNAvsZPA = new TH2F("hZNAvsZPA","hZNAvsZPA",200,-50.,50000,200,-50.,140000);
575  fOutput->Add(fhZNAvsZPA);
576  fhZNvsZP = new TH2F("hZNvsZP","hZNvsZP",200,-50.,80000,200,-50.,200000);
577  fOutput->Add(fhZNvsZP);
578  fhZNvsVZERO = new TH2F("hZNvsVZERO","hZNvsVZERO",250,0.,25000.,200,0.,200000.);
579  fOutput->Add(fhZNvsVZERO);
580  fhZDCvsVZERO = new TH2F("hZDCvsVZERO","hZDCvsVZERO",250,0.,25000.,250,0.,250000.);
581  fOutput->Add(fhZDCvsVZERO);
582  fhZDCvsTracklets = new TH2F("hZDCvsTracklets","hZDCvsTracklets",200,0.,4000.,250,0.,250000.);
584  fhZDCvsNclu1 = new TH2F("hZDCvsNclu1", "hZDCvsNclu1", 200, 0.,8000.,200,0.,250000.);
585  fOutput->Add(fhZDCvsNclu1);
586  fhDebunch = new TH2F("hDebunch","hDebunch",240,-100.,-40.,240,-30.,30.);
587  fOutput->Add(fhDebunch);
588  fhZNCcentroid = new TH2F("hZNCcentroid","hZNCcentroid",100,-3.5,3.5,100,-3.5,3.5);
589  fOutput->Add(fhZNCcentroid);
590  fhZNAcentroid = new TH2F("hZNAcentroid","hZNAcentroid",100,-3.5,3.5,100,-3.5,3.5);
591  fOutput->Add(fhZNAcentroid);
592 
593  fhAsymm = new TH1F("hAsymm" , "Asimmetry ",200,-1.,1.);
594  fOutput->Add(fhAsymm);
595  fhZNAvsAsymm = new TH2F("hZNAvsAsymm","ZNA vs. asymm.",200,-1.,1.,200,0.,80.);
596  fOutput->Add(fhZNAvsAsymm);
597  fhZNCvsAsymm = new TH2F("hZNCvsAsymm","ZNC vs. asymm.",200,-1.,1.,200,0.,80.);
598  fOutput->Add(fhZNCvsAsymm);
599 
600  fhZNCvscentrality = new TH2F("hZNCvscentrality","ZNC vs. centrality",100,0.,100.,100,0.,100.);
602  fhZNAvscentrality = new TH2F("hZNAvscentrality","ZNA vs. centrality",100,0.,100.,100,0.,100.);
604  fhZPCvscentrality = new TH2F("hZPCvscentrality","ZPC vs. centrality",100,0.,100.,100,0.,100.);
606  fhZPAvscentrality = new TH2F("hZPAvscentrality","ZPA vs. centrality",100,0.,100.,100,0.,100.);
608 
609  fhZNCpmcvscentr = new TH2F("hZNCpmcvscentr","ZNC PMC vs. centrality",100,0.,100.,100,0.,100.);
610  fOutput->Add(fhZNCpmcvscentr);
611  fhZNApmcvscentr = new TH2F("hZNApmcvscentr","ZNA PMC vs. centrality",100,0.,100.,100,0.,100.);
612  fOutput->Add(fhZNApmcvscentr);
613  fhZPCpmcvscentr = new TH2F("hZPCpmcvscentr","ZPC PMC vs. centrality",100,0.,100.,100,0.,100.);
614  fOutput->Add(fhZPCpmcvscentr);
615  fhZPApmcvscentr = new TH2F("hZPApmcvscentr","ZPA PMC vs. centrality",100,0.,100.,100,0.,100.);
616  fOutput->Add(fhZPApmcvscentr);
617 
618  fhZNCpmcLR = new TH1F("hZNCpmcLR","ZNC PMC lr", 100, 0., 10.);
619  fOutput->Add(fhZNCpmcLR);
620  fhZNApmcLR = new TH1F("hZNApmcLR","ZNA PMC lr", 100, 0., 10.);
621  fOutput->Add(fhZNApmcLR);
622  fhZPCpmcLR = new TH1F("hZPCpmcLR","ZPC PMC lr", 100, 0., 10.);
623  fOutput->Add(fhZPCpmcLR);
624  fhZPApmcLR = new TH1F("hZPApmcLR","ZPA PMC lr", 100, 0., 10.);
625  fOutput->Add(fhZPApmcLR);
626 
627  //********************************************************************
628 
629  Int_t dRun10h[] = {139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137546, 137544, 137541, 137539, 137531, 137530, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137430, 137366, 137243, 137236, 137235, 137232, 137231, 137230, 137162, 137161};
630 
631  Int_t dRun11h[] = {167902, 167903, 167915, 167920, 167985, 167987, 167988, 168066, 168068, 168069, 168076, 168104, 168105, 168107, 168108, 168115, 168212, 168310, 168311, 168322, 168325, 168341, 168342, 168361, 168362, 168458, 168460, 168461, 168464, 168467, 168511, 168512, 168514, 168777, 168826, 168984, 168988, 168992, 169035, 169040, 169044, 169045, 169091, 169094, 169099, 169138, 169143, 169144, 169145, 169148, 169156, 169160, 169167, 169238, 169411, 169415, 169417, 169418, 169419, 169420, 169475, 169498, 169504, 169506, 169512, 169515, 169550, 169553, 169554, 169555, 169557, 169586, 169587, 169588, 169590, 169591, 169835, 169837, 169838, 169846, 169855, 169858, 169859, 169923, 169956, 169965, 170027, 170036,170040, 170081, 170083, 170084, 170085, 170088, 170089, 170091, 170155, 170159, 170163, 170193, 170203, 170204, 170207, 170228, 170230, 170268, 170269, 170270, 170306, 170308, 170309, 170311, 170312, 170313, 170315, 170387, 170388, 170572, 170593};
632 
633  Int_t dRun15h[] = {244917, 244918, 244975, 244980, 244982, 244983, 245061, 245064, 245066, 245068};
634 
635  if(fDataSet.EqualTo("2010")) {fCRCnRun=92;}
636  if(fDataSet.EqualTo("2011")) {fCRCnRun=119;}
637  if(fDataSet.EqualTo("2015")) {fCRCnRun=10;}
638  if(fDataSet.EqualTo("MCkine")) {fCRCnRun=1;}
639 
640  Int_t d=0;
641  for(Int_t r=0; r<fCRCnRun; r++) {
642  if(fDataSet.EqualTo("2010")) fRunList[d] = dRun10h[r];
643  if(fDataSet.EqualTo("2011")) fRunList[d] = dRun11h[r];
644  if(fDataSet.EqualTo("2015")) fRunList[d] = dRun15h[r];
645  if(fDataSet.EqualTo("MCkine")) fRunList[d] = 1;
646  d++;
647  }
648 
649  for(Int_t r=0;r<fCRCnRun;r++) {
650  fCRCQVecListRun[r] = new TList();
651  fCRCQVecListRun[r]->SetName(Form("Run %d",fRunList[r]));
652  fCRCQVecListRun[r]->SetOwner(kTRUE);
653  fOutput->Add(fCRCQVecListRun[r]);
654  for(Int_t i=0;i<fCRCnTow;i++) {
655  fhnTowerGain[r][i] = new TProfile(Form("fhnTowerGain[%d][%d]",fRunList[r],i),
656  Form("fhnTowerGain[%d][%d]",fRunList[r],i),20,0.,100.,"s");
657  fhnTowerGain[r][i]->Sumw2();
658  fCRCQVecListRun[r]->Add(fhnTowerGain[r][i]);
659  }
660  }
661 
662  PostData(2, fOutput);
663 }
664 
665 //________________________________________________________________________
666 void AliAnalysisTaskCRCZDC::UserExec(Option_t */*option*/)
667 {
668  // Execute analysis for current event:
669  AliMCEvent* McEvent = MCEvent();
670  AliAODEvent *aod = dynamic_cast<AliAODEvent*>(InputEvent());
671  AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
672 // AliMultiplicity* myTracklets = NULL;
673 // AliESDPmdTrack* pmdtracks = NULL;
674 // int availableINslot=1;
675 
676  if (!(fCutsRP&&fCutsPOI&&fCutsEvent)) {
677  AliError("cuts not set");
678  return;
679  }
680 
681  //DEFAULT - automatically takes care of everything
682  if (fAnalysisType == "AUTOMATIC") {
683 
684  //check event cuts
685  if (InputEvent()) {
686  if(!fCutsEvent->IsSelected(InputEvent(),MCEvent())) return;
687  if(fRejectPileUp && fAnalysisUtil->IsPileUpEvent(InputEvent())) return;
688  }
689 
690  //first attach all possible information to the cuts
691  fCutsRP->SetEvent( InputEvent(), MCEvent() ); //attach event
692  fCutsPOI->SetEvent( InputEvent(), MCEvent() );
693 
694  //then make the event
696 
698  fFlowEvent->SetCentrality(fCutsEvent->GetCentrality(InputEvent(),McEvent));
699 
700  fFlowEvent->SetCentralityCL1(((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL1"));
701  fFlowEvent->SetCentralityTRK(((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("TRK"));
702  fFlowEvent->SetNITSCL1(((AliVAODHeader*)aod->GetHeader())->GetNumberOfITSClusters(1));
703 
704  Double_t vtxpos[3]={0.,0.,0.};
705  vtxpos[0] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetX();
706  vtxpos[1] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetY();
707  vtxpos[2] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetZ();
708  fFlowEvent->SetVertexPosition(vtxpos);
709 
710  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
711 
712  }
713 
714  if (fAnalysisType == "MCAOD") {
715 
717  AliAODMCHeader *mcHeader;
718  TClonesArray* mcArray;
719 
720  mcArray = dynamic_cast<TClonesArray*>(aod->FindListObject(AliAODMCParticle::StdBranchName()));
721  if(!mcArray){
722  AliError("Array of MC particles not found");
723  return;
724  }
725  mcHeader = dynamic_cast<AliAODMCHeader*>(aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
726  if (!mcHeader) {
727  AliError("Could not find MC Header in AOD");
728  return;
729  }
730 
731  Double_t centr = fCutsEvent->GetCentrality(InputEvent(),McEvent);
732  if (centr<fCentrLowLim || centr>=fCentrUpLim ) return;
733  Int_t CenBin = -1;
734  if (centr>0. && centr<5.) CenBin=0;
735  if (centr>5. && centr<10.) CenBin=1;
736  if (centr>10. && centr<20.) CenBin=2;
737  if (centr>20. && centr<30.) CenBin=3;
738  if (centr>30. && centr<40.) CenBin=4;
739  if (centr>40. && centr<50.) CenBin=5;
740  if (centr>50. && centr<60.) CenBin=6;
741  if (centr>60. && centr<70.) CenBin=7;
742  if (centr>70. && centr<80.) CenBin=8;
743  if (centr>80. && centr<90.) CenBin=9;
744  if(CenBin==-1) return;
745 
746  // reconstructed ==> POIs
747  Int_t AODPOIs = 0, AODbads = 0;
748  for(Int_t jTracks = 0; jTracks<aod->GetNumberOfTracks(); jTracks++){
749  AliVParticle* AODPart = (AliVParticle*)aod->GetTrack(jTracks);
750  if (!AODPart) {
751  printf("ERROR: Could not receive AODPart %d\n", jTracks);
752  continue;
753  }
754  AliAODTrack *AODTrack = (AliAODTrack*)aod->GetTrack(jTracks);
755  if (!AODTrack) {
756  printf("ERROR: Could not receive AODTrack %d\n", jTracks);
757  continue;
758  }
759  if(!fCutsPOI->PassesAODcuts(AODTrack)) AODbads++;
760  if(!fCutsPOI->PassesAODcuts(AODTrack)) continue;
761  fFlowTrack->Set(AODPart);
763  fFlowTrack->SetForRPSelection(kFALSE);
767  AODPOIs++;
768  fPtSpecRec[CenBin]->Fill(AODPart->Pt());
769  }
770 
771  // generated (physical primaries) ==> RPs
772  Int_t MCPrims = 0, MCSecos = 0, SN=0;
773  for(Int_t jTracks = 0; jTracks<mcArray->GetEntries(); jTracks++) {
774  AliAODMCParticle *AODMCtrack = (AliAODMCParticle*)mcArray->At(jTracks);
775  if (!AODMCtrack) {
776  printf("ERROR: Could not receive MC track %d\n", jTracks);
777  continue;
778  }
779  if(!fCutsPOI->PassesCuts(AODMCtrack)) MCSecos++;
780  if(!fCutsPOI->PassesCuts(AODMCtrack)) continue;
781  if(AODMCtrack->IsPhysicalPrimary()) continue;
782  fFlowTrack->Set(AODMCtrack);
788  MCPrims++;
789  fPtSpecGen[CenBin]->Fill(AODMCtrack->Pt());
790  }
791  fGenHeader = McEvent->GenEventHeader();
792  if(fGenHeader) fPythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(fGenHeader);
793  // printf("#reconstructed : %d (rejected from cuts %d), #MC primaries : %d (rejected from cuts %d) \n",AODPOIs,AODbads,MCPrims,MCSecos);
794  fFlowEvent->SetReferenceMultiplicity(aod->GetNumberOfTracks());
795  fFlowEvent->SetCentrality(aod->GetCentrality()->GetCentralityPercentile("V0M"));
796  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
797  fFlowEvent->SetRun(aod->GetRunNumber());
798  // printf("Run : %d, RefMult : %d, Cent : %f \n",fFlowEvent->GetRun(),fFlowEvent->GetReferenceMultiplicity(),fFlowEvent->GetCentrality());
799  }
800 
801  if(fAnalysisType == "MCESD") {
802 
804 
805  if(!esd) {
806  AliError("ERROR: Could not retrieve ESDEvent");
807  return;
808  }
809  if(!McEvent) {
810  AliError("ERROR: Could not retrieve MCEvent");
811  return;
812  }
813  AliStack* fStack = fMCEvent->Stack();
814  if(!fStack) {
815  AliError("ERROR: Could not retrieve MCStack");
816  return;
817  }
818 
819  AliESDVertex *vertex = (AliESDVertex*) esd->GetPrimaryVertex();
820  if (!vertex) return;
821  if (TMath::Abs(vertex->GetZ()) > 10. ) return;
822  if (vertex->GetNContributors() < 1 ) return;
823  AliCentrality *centrality = esd->GetCentrality();
824  if (!centrality) return;
825  Double_t centr = centrality->GetCentralityPercentile("V0M");
826  if (centr<fCentrLowLim || centr>=fCentrUpLim ) return;
827  Int_t CenBin = -1;
828  if (centr>0. && centr<5.) CenBin=0;
829  if (centr>5. && centr<10.) CenBin=1;
830  if (centr>10. && centr<20.) CenBin=2;
831  if (centr>20. && centr<30.) CenBin=3;
832  if (centr>30. && centr<40.) CenBin=4;
833  if (centr>40. && centr<50.) CenBin=5;
834  if (centr>50. && centr<60.) CenBin=6;
835  if (centr>60. && centr<70.) CenBin=7;
836  if (centr>70. && centr<80.) CenBin=8;
837  if (centr>80. && centr<90.) CenBin=9;
838  if(CenBin==-1) return;
839 
840  //Generated
841  Int_t MCPrims = 0;
842  for ( Int_t i=0 ; i<fStack->GetNtrack() ; i++ ) {
843 
844  //Primaries Selection
845  TParticle *particle = (TParticle*)fStack->Particle(i);
846  if (!particle) continue;
847  if (!fStack->IsPhysicalPrimary(i)) continue;
848  if ( particle->GetPDG()->Charge() == 0.) continue;
849 
850  //Kinematic Cuts
851  if ( particle->Pt()<0.2 || particle->Pt()>10. ) continue;
852  if ( TMath::Abs(particle->Eta())>0.8 ) continue;
853 
854  fFlowTrack->SetPhi(particle->Phi());
855  fFlowTrack->SetEta(particle->Eta());
856  fFlowTrack->SetPt(particle->Pt());
862  MCPrims++;
863 
864  fPtSpecGen[CenBin]->Fill(particle->Pt());
865 
866  }
867 
868  //Reconstructed
869  Int_t ESDPrims = 0;
870  for (Int_t i=0 ; i<esd->GetNumberOfTracks() ; i++) {
871 
872  //Get reconstructed track
873  AliVTrack *vtrack = static_cast<AliVTrack*>(esd->GetTrack(i));
874  AliESDtrack *track = dynamic_cast<AliESDtrack*>(vtrack);
875  if (!track) continue;
876 
877  //Primaries selection
878  Int_t lp = TMath::Abs(track->GetLabel());
879  if (!fStack->IsPhysicalPrimary(lp)) continue;
880  TParticle *particle = (TParticle*)fStack->Particle(lp);
881  if (!particle) continue;
882  if (particle->GetPDG()->Charge() == 0.) continue;
883 
884 // if(!fCutsPOI->PassesESDcuts(track)) continue;
885 
886  Bool_t pass = kTRUE;
887 
888  if(fCutTPC) {
889 // printf("******* cutting TPC ******** \n");
890  UShort_t ntpccls = track->GetTPCNcls();
891  Double_t tpcchi2 = track->GetTPCchi2();
892  if (tpcchi2<0.2 || tpcchi2 >=4.) {
893 // printf("TPCchi2 : %e %e ",tpcchi2,track->GetTPCchi2Iter1());
894  pass=kFALSE;
895  }
896  if (ntpccls < 70) {
897 // printf("#TPCcluster : %u %u %u %u ",ntpccls,track->GetTPCNclsF(),track->GetTPCNclsFIter1(),track->GetTPCNclsIter1());
898  pass=kFALSE;
899  }
900  }
901 
902  Float_t dcaxy=0.0;
903  Float_t dcaz=0.0;
904  track->GetImpactParameters(dcaxy,dcaz);
905  if (dcaxy > 0.3 || dcaz > 0.3) {
906 // printf("DCA : %e %e ",dcaxy,dcaz);
907  pass=kFALSE;
908  }
909  if(!pass) continue;
910 
911  //Kinematic Cuts
912  if ( track->Pt()<0.2 || track->Pt()>10. ) continue;
913  if ( TMath::Abs(track->Eta())>0.8 ) continue;
914 
915  fFlowTrack->SetPhi(track->Phi());
916  fFlowTrack->SetEta(track->Eta());
917  fFlowTrack->SetPt(track->Pt());
919  fFlowTrack->SetForRPSelection(kFALSE);
923  ESDPrims++;
924 
925  fPtSpecRec[CenBin]->Fill(track->Pt());
926 
927  }
928 
929 // printf("#reconstructed : %d , #MC primaries : %d \n",ESDPrims,MCPrims);
930  fFlowEvent->SetReferenceMultiplicity(esd->GetNumberOfTracks());
931  fFlowEvent->SetCentrality(centr);
932  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
933  fFlowEvent->SetRun(esd->GetRunNumber());
934 // printf("Run : %d, RefMult : %d, Cent : %f \n",fFlowEvent->GetRun(),fFlowEvent->GetReferenceMultiplicity(),fFlowEvent->GetCentrality());
935 
936  } // end of if(fAnalysisType == "MCESD")
937 
938  if(fAnalysisType == "MCkine") {
939 
941 
942  AliInputEventHandler* McHandler = dynamic_cast<AliInputEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
943  if(!McHandler) {
944  AliError("ERROR: Could not retrieve MCtruthEventHandler");
945  return;
946  }
947  McEvent = McHandler->MCEvent();
948  if(!McEvent) {
949  AliError("ERROR: Could not retrieve MC event");
950  return;
951  }
952 
953  Int_t nTracks = McEvent->GetNumberOfTracks();
954 // Int_t nPrimTr = McEvent->GetNumberOfPrimaries();
955 
956  //loop over tracks
957  for (Int_t itrkN=0; itrkN<nTracks; itrkN++) {
958  //get input particle
959  AliMCParticle* pParticle = dynamic_cast<AliMCParticle*>(McEvent->GetTrack(itrkN));
960  if (!pParticle) continue;
961 
962  //check if track passes the cuts
963  if (McEvent->IsPhysicalPrimary(itrkN) && pParticle->Charge()!=0) {
964  fFlowTrack->Set(pParticle);
971  }
972  }// for all tracks
973 
974  // if monte carlo event get reaction plane from monte carlo (depends on generator)
975  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
976  // set reference multiplicity
977  fFlowEvent->SetReferenceMultiplicity(McEvent->GetNumberOfTracks());
978  // tag subevents
980  // set centrality from impact parameter
981  Double_t ImpPar=0., CenPer=0.;
982  fGenHeader = McEvent->GenEventHeader();
983  if(fGenHeader){
984  fPythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(fGenHeader);
985  if(fPythiaGenHeader) ImpPar = fPythiaGenHeader->GetImpactParameter();
986  fHijingGenHeader = dynamic_cast<AliGenHijingEventHeader*>(fGenHeader);
987  if(fHijingGenHeader) ImpPar = fHijingGenHeader->ImpactParameter();
988  if(ImpPar) CenPer = 0.3859796743103508*pow(ImpPar,2.);
989  if(CenPer>0. && CenPer<100.) fFlowEvent->SetCentrality(CenPer);
990  else return;
991  fFlowEvent->SetRun(1);
992  }
993 
994  } // end of if(fAnalysisType == "MCkine")
995 
996  if (!fFlowEvent) return; //shuts up coverity
997 
998  //check final event cuts
999  Int_t mult = fFlowEvent->NumberOfTracks();
1000  // AliInfo(Form("FlowEvent has %i tracks",mult));
1001  if (mult<fMinMult || mult>fMaxMult) {
1002  AliWarning("FlowEvent cut on multiplicity"); return;
1003  }
1004 
1005  //define dead zone
1007 
1010  if (fAfterburnerOn)
1011  {
1012  //if reaction plane not set from elsewhere randomize it before adding flow
1014  fFlowEvent->SetMCReactionPlaneAngle(gRandom->Uniform(0.0,TMath::TwoPi()));
1015 
1016  if(fDifferentialV2)
1018  else
1019  fFlowEvent->AddFlow(fV1,fV2,fV3,fV4,fV5); //add flow
1020  fFlowEvent->CloneTracks(fNonFlowNumberOfTrackClones); //add nonflow by cloning tracks
1021  }
1023 
1024  //tag subEvents
1026 
1027  //do we want to serve shullfed tracks to everybody?
1029 
1030  // associate the mother particles to their daughters in the flow event (if any)
1032 
1033  //fListHistos->Print();
1034  //fOutputFile->WriteObject(fFlowEvent,"myFlowEventSimple");
1035 
1036 // printf("event : ntr %d, cen %f **********************************************************************************************************\n"
1037 
1038  //********************************************************************************************************************************
1039 
1040  if(fAnalysisType == "MCkine") return;
1041 
1042  // PHYSICS SELECTION
1043  AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
1044  AliInputEventHandler *hdr = (AliInputEventHandler*)am->GetInputEventHandler();
1045 
1046  if(hdr->IsEventSelected() && AliVEvent::kAny) {
1047 
1048  AliCentrality* centrality = aod->GetCentrality();
1049  Float_t centrperc = centrality->GetCentralityPercentile(fCentrEstimator.Data());
1050 
1051  AliAODTracklets *trackl = aod->GetTracklets();
1052  Int_t nTracklets = trackl->GetNumberOfTracklets();
1053 
1054  AliAODVZERO *vzeroAOD = aod->GetVZEROData();
1055  Float_t multV0A = vzeroAOD->GetMTotV0A();
1056  Float_t multV0C = vzeroAOD->GetMTotV0C();
1057 
1058  AliAODZDC *aodZDC = aod->GetZDCData();
1059 
1060  Float_t energyZNC = (Float_t) (aodZDC->GetZNCEnergy());
1061  Float_t energyZPC = (Float_t) (aodZDC->GetZPCEnergy());
1062  Float_t energyZNA = (Float_t) (aodZDC->GetZNAEnergy());
1063  Float_t energyZPA = (Float_t) (aodZDC->GetZPAEnergy());
1064  Float_t energyZEM1 = (Float_t) (aodZDC->GetZEM1Energy());
1065  Float_t energyZEM2 = (Float_t) (aodZDC->GetZEM2Energy());
1066 
1067  const Double_t * towZNC = aodZDC->GetZNCTowerEnergy();
1068  const Double_t * towZPC = aodZDC->GetZPCTowerEnergy();
1069  const Double_t * towZNA = aodZDC->GetZNATowerEnergy();
1070  const Double_t * towZPA = aodZDC->GetZPATowerEnergy();
1071  //
1072  const Double_t * towZNClg = aodZDC->GetZNCTowerEnergyLR();
1073  const Double_t * towZNAlg = aodZDC->GetZNATowerEnergyLR();
1074  //
1075  Double_t towZPClg[5], towZPAlg[5]={0.};
1076  for(Int_t it=0; it<5; it++){
1077  towZPClg[it] = 8*towZPC[it];
1078  towZPAlg[it] = 8*towZNA[it];
1079  }
1080 
1081  // Get centroid from ZDCs *******************************************************
1082 
1083  Double_t xyZNC[2]={999.,999.}, xyZNA[2]={999.,999.};
1084  Float_t zncEnergy=0., znaEnergy=0.;
1085  for(Int_t i=0; i<5; i++){
1086  zncEnergy += towZNC[i];
1087  znaEnergy += towZNA[i];
1088  }
1089  fFlowEvent->SetZNCEnergy(towZNC[0]);
1090  fFlowEvent->SetZNAEnergy(towZNA[0]);
1091 
1092  if (fUseMCCen) {
1093  if(aod->GetRunNumber() < 209122) aodZDC->GetZNCentroidInPbPb(1380., xyZNC, xyZNA);
1094  else aodZDC->GetZNCentroidInPbPb(2510., xyZNC, xyZNA);
1095  } else {
1096  const Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
1097  const Float_t y[4] = {-1.75, -1.75, 1.75, 1.75};
1098  Float_t numXZNC=0., numYZNC=0., denZNC=0., wZNC;
1099  Float_t numXZNA=0., numYZNA=0., denZNA=0., wZNA;
1100  for(Int_t i=0; i<4; i++) {
1101  if(towZNC[i+1]>0.) {
1102  wZNC = TMath::Power(towZNC[i+1], fZDCGainAlpha);
1103  numXZNC += x[i]*wZNC;
1104  numYZNC += y[i]*wZNC;
1105  denZNC += wZNC;
1106  }
1107  if(towZNA[i+1]>0.) {
1108  wZNA = TMath::Power(towZNA[i+1], fZDCGainAlpha);
1109  numXZNA += x[i]*wZNA;
1110  numYZNA += y[i]*wZNA;
1111  denZNA += wZNA;
1112  }
1113  }
1114  if(denZNC!=0) {
1115  xyZNC[0] = numXZNC/denZNC;
1116  xyZNC[1] = numYZNC/denZNC;
1117  }
1118  else{
1119  xyZNC[0] = xyZNC[1] = 999.;
1120  zncEnergy = 0.;
1121  }
1122  if(denZNA!=0) {
1123  xyZNA[0] = numXZNA/denZNA;
1124  xyZNA[1] = numYZNA/denZNA;
1125  }
1126  else{
1127  xyZNA[0] = xyZNA[1] = 999.;
1128  znaEnergy = 0.;
1129  }
1130  }
1131 
1132  Float_t MulA=0., MulC=0.;
1133  for(Int_t i=0; i<4; i++) {
1134  if(towZNC[i+1]>0.) {
1135  MulC += TMath::Power(towZNC[i+1], fZDCGainAlpha);
1136  }
1137  if(towZNA[i+1]>0.) {
1138  MulA += TMath::Power(towZNA[i+1], fZDCGainAlpha);
1139  }
1140  }
1141 
1142  fhZNCcentroid->Fill(xyZNC[0], xyZNC[1]);
1143  fhZNAcentroid->Fill(xyZNA[0], xyZNA[1]);
1144  fFlowEvent->SetZDC2Qsub(xyZNC,MulC,xyZNA,MulA);
1145 
1146  Int_t RunBin=-1, bin=0, RunNum=fFlowEvent->GetRun();
1147  for(Int_t c=0;c<fCRCnRun;c++) {
1148  if(fRunList[c]==RunNum) RunBin=bin;
1149  else bin++;
1150  }
1151  if(fDataSet.EqualTo("MCkine")) RunBin=0;
1152  if(RunBin!=-1) {
1153  for(Int_t i=0; i<4; i++) {
1154  if(towZNC[i+1]>0.) {
1155  fhnTowerGain[RunBin][i]->Fill(centrperc,TMath::Power(towZNC[i+1], 0.395));
1156  }
1157  if(towZNA[i+1]>0.) {
1158  fhnTowerGain[RunBin][i+4]->Fill(centrperc,TMath::Power(towZNA[i+1], 0.395));
1159  }
1160  }
1161  }
1162 
1163  // ******************************************************************************
1164 
1165  Float_t tdcSum = aodZDC->GetZDCTimeSum();
1166  Float_t tdcDiff = aodZDC->GetZDCTimeDiff();
1167  fhDebunch->Fill(tdcDiff, tdcSum);
1168 
1169  for(int i=0; i<5; i++){
1170  fhZNCPM[i]->Fill(towZNC[i]);
1171  fhZNCPMlg[i]->Fill(towZNClg[i]);
1172  if((i<4) && (towZNC[0]>0.)) fhZNCPMQiPMC[i]->Fill(towZNC[i+1]/towZNC[0]);
1173  fhZNCpmcLR->Fill(towZNClg[0]/1000.);
1174  }
1175  fhPMCvsPMQ[0]->Fill(towZNC[1]+towZNC[2]+towZNC[3]+towZNC[4], towZNC[0]);
1176  for(int i=0; i<5; i++){
1177  fhZPCPM[i]->Fill(towZPC[i]);
1178  fhZPCPMlg[i]->Fill(towZPClg[i]);
1179  if(((i<4) && towZPC[0]>0.)) fhZPCPMQiPMC[i]->Fill(towZPC[i+1]/towZPC[0]);
1180  fhZPCpmcLR->Fill(towZPClg[0]/1000.);
1181  }
1182  fhPMCvsPMQ[1]->Fill(towZPC[1]+towZPC[2]+towZPC[3]+towZPC[4], towZPC[0]);
1183  for(int i=0; i<5; i++){
1184  fhZNAPM[i]->Fill(towZNA[i]);
1185  fhZNAPMlg[i]->Fill(towZNAlg[i]);
1186  if(((i<4) && towZNA[0]>0.)) fhZNAPMQiPMC[i]->Fill(towZNA[i+1]/towZNA[0]);
1187  fhZNApmcLR->Fill(towZNAlg[0]/1000.);
1188  }
1189  fhPMCvsPMQ[2]->Fill(towZNA[1]+towZNA[2]+towZNA[3]+towZNA[4], towZNA[0]);
1190  for(int i=0; i<5; i++){
1191  fhZPAPM[i]->Fill(towZPA[i]);
1192  fhZPAPMlg[i]->Fill(towZPAlg[i]);
1193  if(((i<4) && towZPA[0]>0.)) fhZPAPMQiPMC[i]->Fill(towZPA[i+1]/towZPA[0]);
1194  fhZPApmcLR->Fill(towZPAlg[0]/1000.);
1195  }
1196  fhPMCvsPMQ[3]->Fill(towZPA[1]+towZPA[2]+towZPA[3]+towZPA[4], towZPA[0]);
1197  fhZEM[0]->Fill(energyZEM1);
1198  fhZEM[1]->Fill(energyZEM2);
1199 
1200  fhZNCvsZNA->Fill(energyZNA, energyZNC);
1201  fhZPCvsZPA->Fill(energyZPA, energyZPC);
1202  fhZDCCvsZDCCA->Fill(energyZNA+energyZPA, energyZNC+energyZPC);
1203  fhZNCvsZPC->Fill(energyZPC, energyZNC);
1204  fhZNAvsZPA->Fill(energyZPA, energyZNA);
1205  fhZNvsZP->Fill(energyZPA+energyZPC, energyZNA+energyZNC);
1206  fhZNvsVZERO->Fill(multV0A+multV0C, energyZNC+energyZNA);
1207  fhZDCvsVZERO->Fill(multV0A+multV0C, energyZNA+energyZPA+energyZNC+energyZPC);
1208  fhZDCvsTracklets->Fill((Float_t) (nTracklets), energyZNA+energyZPA+energyZNC+energyZPC);
1209 
1210  Double_t asymmetry = -999.;
1211  if((energyZNC+energyZNA)>0.) asymmetry = (energyZNC-energyZNA)/(energyZNC+energyZNA);
1212  fhAsymm->Fill(asymmetry);
1213  fhZNAvsAsymm->Fill(asymmetry, energyZNA/1000.);
1214  fhZNCvsAsymm->Fill(asymmetry, energyZNC/1000.);
1215 
1216  fhZNCvscentrality->Fill(centrperc, energyZNC/1000.);
1217  fhZNAvscentrality->Fill(centrperc, energyZNA/1000.);
1218  fhZPCvscentrality->Fill(centrperc, energyZPC/1000.);
1219  fhZPAvscentrality->Fill(centrperc, energyZPA/1000.);
1220 
1221  fhZNCpmcvscentr->Fill(centrperc, towZNC[0]/1380.);
1222  fhZNApmcvscentr->Fill(centrperc, towZNA[0]/1380.);
1223  fhZPCpmcvscentr->Fill(centrperc, towZPC[0]/1380.);
1224  fhZPApmcvscentr->Fill(centrperc, towZPA[0]/1380.);
1225 
1226  } // PHYSICS SELECTION
1227 
1228  PostData(1, fFlowEvent);
1229 
1230  PostData(2, fOutput);
1231 
1232 }
1233 
1234 //________________________________________________________________________
1236  fCutContainer->AddAt(cutsRP,0); fCutsRP=cutsRP; cutsRP->SetPOItype(0);
1237 }
1238 
1239 //________________________________________________________________________
1241  fCutContainer->AddAt(cutsPOI,1); fCutsPOI=cutsPOI; cutsPOI->SetPOItype(1);
1242 }
1243 
1244 //________________________________________________________________________
1245 void AliAnalysisTaskCRCZDC::Terminate(Option_t */*option*/)
1246 {
1247  // Terminate analysis
1248  //
1249  /* if(fDebug > 1) printf(" **** AliAnalysisTaskCRCZDC::Terminate() \n");
1250 
1251  //fOutput = dynamic_cast<TList*> (GetOutputData(1));
1252  //if(!fOutput) printf("ERROR: fOutput not available\n");
1253  */
1254 }
TH1F * fhZPCpmcLR
ZNA PMC low res. chain.
TH2F * fhZDCCvsZDCCA
ZPC vs ZPA;.
TH2F * fhZNvsVZERO
ZNC+ZNA vs ZPC+ZPA;.
void FindDaughters(Bool_t keepDaughtersInRPselection=kFALSE)
Float_t GetCentrality(AliVEvent *event, AliMCEvent *mcEvent)
void SetEta(Double_t eta)
TH1F * fhZPCPMlg[5]
ZNA PM low res.
Int_t fRunList[fCRCMaxnRun]
TH2F * fhZNCpmcvscentr
ZPA vs. centrality.
TH2F * fhZDCvsTracklets
ZDC vs VZERO;.
static const Int_t fCRCnTow
TH1F * fhZNCPMQiPMC[4]
corrected TDC histos
TH2F * fhZNCvsZPC
ZDCC vs ZDCCA.
virtual void SetZDC2Qsub(Double_t *QVC, Double_t MC, Double_t *QVA, Double_t MA)
TH2F * fhZPCpmcvscentr
ZNA vs. centrality.
void AddFlow(Double_t v1, Double_t v2, Double_t v3, Double_t v4, Double_t v5)
Int_t GetReferenceMultiplicity(AliVEvent *event, AliMCEvent *mcEvent)
TH1F * fhZNApmcLR
ZPA PMC low res. chain.
centrality
void Set(const AliVParticle *p)
TH2F * fhZNCvsAsymm
ZNA vs asymmetry.
void SetMCReactionPlaneAngle(const AliMCEvent *mcEvent)
void SetCutsPOI(AliFlowTrackCuts *cutsPOI)
virtual void UserExec(Option_t *option)
void SetHistWeightvsPhiMax(Double_t d)
TH2F * fhZNCvscentrality
ZNC vs asymmetry.
void SetZNAEnergy(Double_t const en)
TH1F * fhZPCPMQiPMC[4]
PMQi/PMC for ZNA.
TH1F * fhZPCPM[5]
ZNA PM high res.
void SetReferenceMultiplicity(Int_t m)
void SetCutsRP(AliFlowTrackCuts *cutsRP)
TH2F * fhZPCvsZPA
ZNC vs ZNA;.
TRandom * gRandom
TH2F * fhZNCvsZNA
PMQi/PMC for ZPA.
TH2F * fhDebunch
ZDC vs N_cluster layer 1;.
TH1F * fhAsymm
PMC vs sum PMQi.
void SetCentralityCL1(Double_t c)
Bool_t PassesAODcuts(const AliAODTrack *track, Bool_t passFid=kTRUE)
virtual void SetVertexPosition(Double_t *pos)
void IncrementNumberOfPOIs(Int_t poiType=1)
TH1F * fhTDC[6]
raw TDC histos
TList * GetQA() const
void SetForRPSelection(Bool_t b=kTRUE)
TH1F * fhTDCraw[6]
ZPA PM low res.
TH2F * fhZNApmcvscentr
ZNC vs. centrality.
Bool_t PassesCuts(AliVParticle *track)
void Fill(AliFlowTrackCuts *rpCuts, AliFlowTrackCuts *poiCuts)
TH2F * fhZNAvsZPA
ZNC vs ZPC;.
TH1F * fhZNAPM[5]
ZNC PM high res.
void SetShuffleTracks(Bool_t b)
TH1F * fPtSpecRec[10]
PtSpecGen.
void SetNITSCL1(Double_t c)
virtual void UserCreateOutputObjects()
TH1F * fhZPAPMQiPMC[4]
PMQi/PMC for ZPC.
static AliFlowCommonConstants * GetMaster()
TH2F * fhZDCvsNclu1
ZDC vs N_tracklets;.
AliFlowEventCuts * fCutsEvent
TH1F * fhZPApmcLR
ZPC PMC low res. chain.
TProfile * fhnTowerGain[fCRCMaxnRun][fCRCnTow]
Run list.
ClassImp(AliAnalysisTaskCRCZDC) AliAnalysisTaskCRCZDC
AliStack * fStack
Q Vectors list per run.
void SetCentrality(Double_t c)
AliFlowTrackCuts * fCutsPOI
void SetRun(Int_t const run)
void SetSource(trackSource s)
Definition: AliFlowTrack.h:37
TH2F * fhZPAvscentrality
ZPC vs. centrality.
void SetPhi(Double_t phi)
void DefineDeadZone(Double_t etaMin, Double_t etaMax, Double_t phiMin, Double_t phiMax)
AliGenEventHeader * fGenHeader
void SetPt(Double_t pt)
TList * fCRCQVecListRun[fCRCMaxnRun]
towers gain
void SetZNCEnergy(Double_t const en)
virtual void Terminate(Option_t *option)
TH2F * fhZPApmcvscentr
ZPC vs. centrality.
void SetEvent(AliVEvent *event, AliMCEvent *mcEvent=NULL)
TH2F * fhZPCvscentrality
ZNA vs. centrality.
TH2F * fhZNAcentroid
ZNC centroid.
Bool_t IsSetMCReactionPlaneAngle() const
TList * GetQA() const
static const Int_t fCRCMaxnRun
ZPA PMC low res. chain.
void SetForPOISelection(Bool_t b=kTRUE)
void SetHistWeightvsPhiMin(Double_t d)
TH1F * fhZNAPMQiPMC[4]
PMQi/PMC for ZNC.
void AddV2(Double_t v2)
TH2F * fhZDCvsVZERO
ZN vs VZERO;.
void TagSubeventsInEta(Double_t etaMinA, Double_t etaMaxA, Double_t etaMinB, Double_t etaMaxB)
TH1F * fhZPAPMlg[5]
ZPC PM low res.
TH2F * fhZNAvsAsymm
ZN asymmetry.
TH2F * fhZNAvscentrality
ZNC vs. centrality.
virtual Bool_t IsSelected(TObject *obj, TObject *objmc)
TH1F * fhZPAPM[5]
ZPC PM high res.
TH1F * fhZNCPM[5]
list send on output slot 0
void SetCentralityTRK(Double_t c)
TH2F * fhPMCvsPMQ[4]
ZNA centroid.
TH1F * fhZNCpmcLR
ZPA vs. centrality.
TH1F * fhZNAPMlg[5]
ZNC PM low res.
TH1F * fhZEM[2]
ZPA PM high res.
AliFlowTrackCuts * fCutsRP
void InsertTrack(AliFlowTrack *)
virtual void ClearFast()
AliAnalysisUtils * fAnalysisUtil
Event selection.
TH2F * fhZNCcentroid
Debunch;.
TH2F * fhZNvsZP
ZNA vs ZPA;.
AliGenHijingEventHeader * fHijingGenHeader
TH1F * fhZNCPMlg[5]
ZEM PM high res.
AliGenPythiaEventHeader * fPythiaGenHeader
Int_t NumberOfTracks() const