AliPhysics  e59a9ba (e59a9ba)
 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 #include "AliMultSelection.h"
71 
72 // ALICE Correction Framework
73 #include "AliCFManager.h"
74 
75 // Interface to Event generators to get Reaction Plane Angle
76 #include "AliGenCocktailEventHeader.h"
77 #include "AliGenPythiaEventHeader.h"
78 #include "AliGenHijingEventHeader.h"
79 #include "AliGenGeVSimEventHeader.h"
80 #include "AliGenEposEventHeader.h"
81 
82 // Interface to Load short life particles
83 #include "TObjArray.h"
84 #include "AliFlowCandidateTrack.h"
85 
86 // Interface to make the Flow Event Simple used in the flow analysis methods
87 #include "AliFlowEvent.h"
88 #include "AliFlowTrackCuts.h"
89 #include "AliFlowEventCuts.h"
90 #include "AliFlowCommonConstants.h"
91 
93 
94 //________________________________________________________________________
96 AliAnalysisTaskSE(""),
97 fAnalysisType("AUTOMATIC"),
98 fRPType(""),
99 fCFManager1(NULL),
100 fCFManager2(NULL),
101 fCutsEvent(NULL),
102 fCutsRP(NULL),
103 fCutsPOI(NULL),
104 fCutContainer(new TList()),
105 fQAList(NULL),
106 fMinMult(0),
107 fMaxMult(10000000),
108 fMinA(-1.0),
109 fMaxA(-0.01),
110 fMinB(0.01),
111 fMaxB(1.0),
112 fGenHeader(NULL),
113 fPythiaGenHeader(NULL),
114 fHijingGenHeader(NULL),
115 fFlowTrack(NULL),
116 fAnalysisUtil(NULL),
117 fQAon(kFALSE),
118 fLoadCandidates(kFALSE),
119 fNbinsMult(10000),
120 fNbinsPt(100),
121 fNbinsPhi(100),
122 fNbinsEta(200),
123 fNbinsQ(500),
124 fNbinsMass(1),
125 fMultMin(0.),
126 fMultMax(10000.),
127 fPtMin(0.),
128 fPtMax(10.),
129 fPhiMin(0.),
130 fPhiMax(TMath::TwoPi()),
131 fEtaMin(-5.),
132 fEtaMax(5.),
133 fQMin(0.),
134 fQMax(3.),
135 fMassMin(-1.),
136 fMassMax(0.),
137 fHistWeightvsPhiMin(0.),
138 fHistWeightvsPhiMax(3.),
139 fExcludedEtaMin(0.),
140 fExcludedEtaMax(0.),
141 fExcludedPhiMin(0.),
142 fExcludedPhiMax(0.),
143 fAfterburnerOn(kFALSE),
144 fNonFlowNumberOfTrackClones(0),
145 fV1(0.),
146 fV2(0.),
147 fV3(0.),
148 fV4(0.),
149 fV5(0.),
150 fDifferentialV2(0),
151 fFlowEvent(NULL),
152 fShuffleTracks(kFALSE),
153 fMyTRandom3(NULL),
154 fAnalysisInput(kAOD),
155 fIsMCInput(kFALSE),
156 fUseMCCen(kTRUE),
157 fRejectPileUp(kTRUE),
158 fCentrLowLim(0.),
159 fCentrUpLim(100.),
160 fCentrEstimator("V0M"),
161 fOutput(0x0),
162 fhZNCvsZNA(0x0),
163 fhZPCvsZPA(0x0),
164 fhZDCCvsZDCCA(0x0),
165 fhZNCvsZPC(0x0),
166 fhZNAvsZPA(0x0),
167 fhZNvsZP(0x0),
168 fhZNvsVZERO(0x0),
169 fhZDCvsVZERO(0x0),
170 fhZDCvsTracklets(0x0),
171 fhZDCvsNclu1(0x0),
172 fhDebunch(0x0),
173 fhZNCcentroid(0x0),
174 fhZNAcentroid(0x0),
175 fhAsymm(0x0),
176 fhZNAvsAsymm(0x0),
177 fhZNCvsAsymm(0x0),
178 fhZNCvscentrality(0x0),
179 fhZNAvscentrality(0x0),
180 fhZPCvscentrality(0x0),
181 fhZPAvscentrality(0x0),
182 fhZNCpmcvscentr(0x0),
183 fhZNApmcvscentr(0x0),
184 fhZPCpmcvscentr(0x0),
185 fhZPApmcvscentr(0x0),
186 fhZNCpmcLR(0x0),
187 fhZNApmcLR(0x0),
188 fhZPCpmcLR(0x0),
189 fhZPApmcLR(0x0),
190 fCRCnRun(0),
191 fZDCGainAlpha(0.395),
192 fDataSet("2010"),
193 fStack(0x0),
194 fCutTPC(kFALSE),
195 fCenDis(0x0),
196 fMCStack(0x0)
197 {
198  for(int i=0; i<5; i++){
199  fhZNCPM[i] = 0x0;
200  fhZNAPM[i] = 0x0;
201  fhZPCPM[i] = 0x0;
202  fhZPAPM[i] = 0x0;
203  fhZNCPMlg[i] = 0x0;
204  fhZNAPMlg[i] = 0x0;
205  fhZPCPMlg[i] = 0x0;
206  fhZPAPMlg[i] = 0x0;
207  }
208  for(int i=0; i<2; i++) fhZEM[i] = 0x0;
209  for(int i=0; i<6; i++){
210  fhTDCraw[i] = 0x0;
211  fhTDC[i] = 0x0;
212  }
213  for(int i=0; i<4; i++){
214  fhZNCPMQiPMC[i] = 0x0;
215  fhZNAPMQiPMC[i] = 0x0;
216  fhZPCPMQiPMC[i] = 0x0;
217  fhZPAPMQiPMC[i] = 0x0;
218  fhPMCvsPMQ[i] = 0x0;
219  }
220  for(Int_t r=0; r<fCRCMaxnRun; r++) {
221  fRunList[r] = 0;
222  }
223  this->InitializeRunArrays();
224  fMyTRandom3 = new TRandom3(1);
225  gRandom->SetSeed(fMyTRandom3->Integer(65539));
226  for(Int_t c=0; c<10; c++) {
227  fPtSpecGen[c] = NULL;
228  fPtSpecFB32[c] = NULL;
229  fPtSpecFB96[c] = NULL;
230  fPtSpecFB128[c] = NULL;
231  fPtSpecFB768[c] = NULL;
232  }
233 }
234 
235 //________________________________________________________________________
236 AliAnalysisTaskCRCZDC::AliAnalysisTaskCRCZDC(const char *name, TString RPtype, Bool_t on, TString DataSet, UInt_t iseed, Bool_t bCandidates):
237 AliAnalysisTaskSE(name),
238 fAnalysisType("AUTOMATIC"),
239 fRPType(RPtype),
240 fCFManager1(NULL),
241 fCFManager2(NULL),
242 fCutsEvent(NULL),
243 fCutsRP(NULL),
244 fCutsPOI(NULL),
245 fCutContainer(new TList()),
246 fQAList(NULL),
247 fMinMult(0),
248 fMaxMult(10000000),
249 fMinA(-1.0),
250 fMaxA(-0.01),
251 fMinB(0.01),
252 fMaxB(1.0),
253 fQAon(on),
254 fLoadCandidates(bCandidates),
255 fNbinsMult(10000),
256 fNbinsPt(100),
257 fNbinsPhi(100),
258 fNbinsEta(200),
259 fNbinsQ(500),
260 fNbinsMass(1),
261 fMultMin(0.),
262 fMultMax(10000.),
263 fPtMin(0.),
264 fPtMax(10.),
265 fPhiMin(0.),
266 fPhiMax(TMath::TwoPi()),
267 fEtaMin(-5.),
268 fEtaMax(5.),
269 fQMin(0.),
270 fQMax(3.),
271 fMassMin(-1.),
272 fMassMax(0.),
273 fHistWeightvsPhiMin(0.),
274 fHistWeightvsPhiMax(3.),
275 fExcludedEtaMin(0.),
276 fExcludedEtaMax(0.),
277 fExcludedPhiMin(0.),
278 fExcludedPhiMax(0.),
279 fAfterburnerOn(kFALSE),
280 fNonFlowNumberOfTrackClones(0),
281 fV1(0.),
282 fV2(0.),
283 fV3(0.),
284 fV4(0.),
285 fV5(0.),
286 fDifferentialV2(0),
287 fFlowEvent(NULL),
288 fShuffleTracks(kFALSE),
289 fMyTRandom3(NULL),
290 fAnalysisInput(kAOD),
291 fIsMCInput(kFALSE),
292 fUseMCCen(kTRUE),
293 fRejectPileUp(kTRUE),
294 fCentrLowLim(0.),
295 fCentrUpLim(100.),
296 fCentrEstimator("V0M"),
297 fOutput(0x0),
298 fhZNCvsZNA(0x0),
299 fhZPCvsZPA(0x0),
300 fhZDCCvsZDCCA(0x0),
301 fhZNCvsZPC(0x0),
302 fhZNAvsZPA(0x0),
303 fhZNvsZP(0x0),
304 fhZNvsVZERO(0x0),
305 fhZDCvsVZERO(0x0),
306 fhZDCvsTracklets(0x0),
307 fhZDCvsNclu1(0x0),
308 fhDebunch(0x0),
309 fhZNCcentroid(0x0),
310 fhZNAcentroid(0x0),
311 fhAsymm(0x0),
312 fhZNAvsAsymm(0x0),
313 fhZNCvsAsymm(0x0),
314 fhZNCvscentrality(0x0),
315 fhZNAvscentrality(0x0),
316 fhZPCvscentrality(0x0),
317 fhZPAvscentrality(0x0),
318 fhZNCpmcvscentr(0x0),
319 fhZNApmcvscentr(0x0),
320 fhZPCpmcvscentr(0x0),
321 fhZPApmcvscentr(0x0),
322 fhZNCpmcLR(0x0),
323 fhZNApmcLR(0x0),
324 fhZPCpmcLR(0x0),
325 fhZPApmcLR(0x0),
326 fDataSet(DataSet),
327 fCRCnRun(0),
328 fZDCGainAlpha(0.395),
329 fGenHeader(NULL),
330 fPythiaGenHeader(NULL),
331 fHijingGenHeader(NULL),
332 fFlowTrack(NULL),
333 fAnalysisUtil(NULL),
334 fStack(0x0),
335 fCutTPC(kFALSE),
336 fCenDis(0x0),
337 fMCStack(0x0)
338 {
339 
340  for(int i=0; i<5; i++){
341  fhZNCPM[i] = 0x0;
342  fhZNAPM[i] = 0x0;
343  fhZPCPM[i] = 0x0;
344  fhZPAPM[i] = 0x0;
345  fhZNCPMlg[i] = 0x0;
346  fhZNAPMlg[i] = 0x0;
347  fhZPCPMlg[i] = 0x0;
348  fhZPAPMlg[i] = 0x0;
349  }
350  for(int i=0; i<2; i++) fhZEM[i] = 0x0;
351  for(int i=0; i<6; i++){
352  fhTDCraw[i] = 0x0;
353  fhTDC[i] = 0x0;
354  }
355  for(int i=0; i<4; i++){
356  fhZNCPMQiPMC[i] = 0x0;
357  fhZNAPMQiPMC[i] = 0x0;
358  fhZPCPMQiPMC[i] = 0x0;
359  fhZPAPMQiPMC[i] = 0x0;
360  fhPMCvsPMQ[i] = 0x0;
361  }
362  for(Int_t r=0; r<fCRCMaxnRun; r++) {
363  fRunList[r] = 0;
364  }
365  this->InitializeRunArrays();
366  fMyTRandom3 = new TRandom3(iseed);
367  gRandom->SetSeed(fMyTRandom3->Integer(65539));
368 
369  DefineInput(0, TChain::Class());
370  // Define output slots here
371  // Define here the flow event output
372  DefineOutput(1, AliFlowEventSimple::Class());
373  DefineOutput(2, TList::Class());
374 
375  for(Int_t c=0; c<10; c++) {
376  fPtSpecGen[c] = NULL;
377  fPtSpecFB32[c] = NULL;
378  fPtSpecFB96[c] = NULL;
379  fPtSpecFB128[c] = NULL;
380  fPtSpecFB768[c] = NULL;
381  }
382 
383 }
384 
385 //________________________________________________________________________
387 {
388  // Destructor
389  if(fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
390  delete fOutput; fOutput=0;
391  }
392  delete fMyTRandom3;
393  delete fFlowEvent;
394  delete fFlowTrack;
395  delete fCutsEvent;
396  if (fAnalysisUtil) delete fAnalysisUtil;
397  if (fQAList) delete fQAList;
398  if (fCutContainer) fCutContainer->Delete(); delete fCutContainer;
399  if (fStack) delete fStack;
400 }
401 
402 //________________________________________________________________________
404 {
405  for(Int_t r=0;r<fCRCMaxnRun;r++) {
406  fCRCQVecListRun[r] = NULL;
407  for(Int_t i=0;i<fCRCnTow;i++) {
408  fhnTowerGain[r][i] = NULL;
409  }
410  }
411 }
412 
413 //________________________________________________________________________
415 {
416  // Create the output containers
417 
418  if (!(fAnalysisType == "AOD" || fAnalysisType == "MCkine" || fAnalysisType == "MCAOD" || fAnalysisType == "AUTOMATIC" || fAnalysisType == "MCESD"))
419  {
420  AliError("WRONG ANALYSIS TYPE! only MCESD, MCkine, MCAOD, AOD and AUTOMATIC are allowed.");
421  exit(1);
422  }
423 
424  //set the common constants
427  cc->SetNbinsPt(fNbinsPt);
428  cc->SetNbinsPhi(fNbinsPhi);
429  cc->SetNbinsEta(fNbinsEta);
430  cc->SetNbinsQ(fNbinsQ);
432  cc->SetMultMin(fMultMin);
433  cc->SetMultMax(fMultMax);
434  cc->SetPtMin(fPtMin);
435  cc->SetPtMax(fPtMax);
436  cc->SetPhiMin(fPhiMin);
437  cc->SetPhiMax(fPhiMax);
438  cc->SetEtaMin(fEtaMin);
439  cc->SetEtaMax(fEtaMax);
440  cc->SetQMin(fQMin);
441  cc->SetQMax(fQMax);
442  cc->SetMassMin(fMassMin);
443  cc->SetMassMax(fMassMax);
446 
447  fFlowEvent = new AliFlowEvent(20000);
448  fFlowTrack = new AliFlowTrack();
449 
450  //printf(" AliAnalysisTaskCRCZDC::UserCreateOutputObjects()\n\n");
451  fOutput = new TList();
452  fOutput->SetOwner(kTRUE);
453  //fOutput->SetName("output");
454 
455  if (fQAon) {
456  fQAList = new TList();
457  fQAList->SetOwner(kTRUE);
458  fQAList->SetName("AliFlowEventCuts QA");
459  if (fCutsEvent->GetQA()) fQAList->Add(fCutsEvent->GetQA()); //0
460  if (fCutsRP->GetQA()) fQAList->Add(fCutsRP->GetQA()); //1
461  if (fCutsPOI->GetQA())fQAList->Add(fCutsPOI->GetQA()); //2
462  fOutput->Add(fQAList);
463  }
464 
465  fCenDis = new TH1F("fCenDis", "fCenDis", 100, 0., 100.);
466  fOutput->Add(fCenDis);
467 
468  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.};
469  for(Int_t c=0; c<10; c++) {
470  fPtSpecGen[c] = new TH1F(Form("fPtSpecGen[%d]",c), Form("fPtSpecGen[%d]",c), 24, xmin);
471  fOutput->Add(fPtSpecGen[c]);
472  fPtSpecFB32[c] = new TH1F(Form("fPtSpecFB32[%d]",c), Form("fPtSpecFB32[%d]",c), 24, xmin);
473  fOutput->Add(fPtSpecFB32[c]);
474  fPtSpecFB96[c] = new TH1F(Form("fPtSpecFB96[%d]",c), Form("fPtSpecFB96[%d]",c), 24, xmin);
475  fOutput->Add(fPtSpecFB96[c]);
476  fPtSpecFB128[c] = new TH1F(Form("fPtSpecFB128[%d]",c), Form("fPtSpecFB128[%d]",c), 24, xmin);
477  fOutput->Add(fPtSpecFB128[c]);
478  fPtSpecFB768[c] = new TH1F(Form("fPtSpecFB768[%d]",c), Form("fPtSpecFB768[%d]",c), 24, xmin);
479  fOutput->Add(fPtSpecFB768[c]);
480  }
481 
482  fAnalysisUtil = new AliAnalysisUtils();
483 
484  for(int i=0; i<5; i++){
485  char hname[20];
486  sprintf(hname,"hZNCPM%d",i);
487  fhZNCPM[i] = new TH1F(hname, hname, 200, -50., 140000);
488  fOutput->Add(fhZNCPM[i]);
489  //
490  sprintf(hname,"hZNAPM%d",i);
491  fhZNAPM[i] = new TH1F(hname, hname, 200, -50., 140000);
492  fOutput->Add(fhZNAPM[i]);
493  //
494  sprintf(hname,"hZPCPM%d",i);
495  fhZPCPM[i] = new TH1F(hname, hname, 200, -50., 50000);
496  fOutput->Add(fhZPCPM[i]);
497  //
498  sprintf(hname,"hZPAPM%d",i);
499  fhZPAPM[i] = new TH1F(hname, hname, 200, -50., 50000);
500  fOutput->Add(fhZPAPM[i]);
501  //
502  sprintf(hname,"hZNCPMlg%d",i);
503  fhZNCPMlg[i] = new TH1F(hname, hname, 200, -50., 140000);
504  fOutput->Add(fhZNCPMlg[i]);
505  //
506  sprintf(hname,"hZNAPMlg%d",i);
507  fhZNAPMlg[i] = new TH1F(hname, hname, 200, -50., 140000);
508  fOutput->Add(fhZNAPMlg[i]);
509  //
510  sprintf(hname,"hZPCPMlg%d",i);
511  fhZPCPMlg[i] = new TH1F(hname, hname, 200, -50., 50000);
512  fOutput->Add(fhZPCPMlg[i]);
513  //
514  sprintf(hname,"hZPAPMlg%d",i);
515  fhZPAPMlg[i] = new TH1F(hname, hname, 200, -50., 50000);
516  fOutput->Add(fhZPAPMlg[i]);
517  //
518  if(i<4){
519  //
520  char hnamenc[20];
521  sprintf(hnamenc, "hZNCPMQ%dPMC",i+1);
522  fhZNCPMQiPMC[i] = new TH1F(hnamenc, hnamenc, 100, 0., 1.);
523  fOutput->Add(fhZNCPMQiPMC[i]);
524  //
525  char hnamena[20];
526  sprintf(hnamena, "hZNAPMQ%dPMC",i+1);
527  fhZNAPMQiPMC[i] = new TH1F(hnamena, hnamena, 100, 0., 1.);
528  fOutput->Add(fhZNAPMQiPMC[i]);
529  //
530  char hnamepc[20];
531  sprintf(hnamepc, "hZPCPMQ%dPMC",i+1);
532  fhZPCPMQiPMC[i] = new TH1F(hnamepc, hnamepc, 100, 0., 1.);
533  fOutput->Add(fhZPCPMQiPMC[i]);
534  //
535  char hnamepa[20];
536  sprintf(hnamepa, "hZPAPMQ%dPMC",i+1);
537  fhZPAPMQiPMC[i] = new TH1F(hnamepa, hnamepa, 100, 0., 1.);
538  fOutput->Add(fhZPAPMQiPMC[i]);
539  }
540  }
541  for(int i=0; i<6; i++){
542  if(i==0){
543  fhZEM[i] = new TH1F("hZEM1","hZEM1",200,-10.,1190.);
544  fhTDCraw[i] = new TH1F("hTDCZEM1raw", "hTDCZEM1raw", 200, -200., 0.);
545  fhTDC[i] = new TH1F("hTDCZEM1", "hTDCZEM1", 200, -150., 50.);
546  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZNC","hPMCvsPMQZNC",200,-10.,140000,200,-10.,140000);
547  //
548  fOutput->Add(fhZEM[i]);
549  fOutput->Add(fhPMCvsPMQ[i]);
550  }
551  else if(i==1){
552  fhZEM[i] = new TH1F("hZEM2","hZEM2",200,-10.,1190.);
553  fhTDCraw[i] = new TH1F("hTDCZEM2raw", "hTDCZEM2raw", 200, -200., 0.);
554  fhTDC[i] = new TH1F("hTDCZEM2", "hTDCZEM2", 200, -150., 50.);
555  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZPC","hPMCvsPMQZPC",200,-10.,50000,200,-10.,50000);
556  //
557  fOutput->Add(fhZEM[i]);
558  fOutput->Add(fhPMCvsPMQ[i]);
559  }
560  else if(i==2){
561  fhTDCraw[i] = new TH1F("hTDCZNCraw", "hTDCZNCraw", 200, -200., 0.);
562  fhTDC[i] = new TH1F("hTDCZNC", "hTDCZNC", 200, -150., 50.);
563  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZNA","hPMCvsPMQZNA",200,-10.,140000,200,-10.,140000);
564  //
565  fOutput->Add(fhPMCvsPMQ[i]);
566  }
567  else if(i==3){
568  fhTDCraw[i] = new TH1F("hTDCZPCraw", "hTDCZPCraw", 200, -200., 0.);
569  fhTDC[i] = new TH1F("hTDCZPC", "hTDCZPC", 200, -150., 50.);
570  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZPA","hPMCvsPMQZPA",200,-10.,50000,200,-10.,50000);
571  //
572  fOutput->Add(fhPMCvsPMQ[i]);
573  }
574  else if(i==4){
575  fhTDCraw[i] = new TH1F("hTDCZNAraw", "hTDCZNAraw", 200, -200., 0.);
576  fhTDC[i] = new TH1F("hTDCZNA", "hTDCZNA", 200, -150., 50.);
577  }
578  else if(i==5){
579  fhTDCraw[i] = new TH1F("hTDCZPAraw", "hTDCZPAraw", 200, -200., 0.);
580  fhTDC[i] = new TH1F("hTDCZPA", "hTDCZPA", 200, -150., 50.);
581  }
582  //
583  fOutput->Add(fhTDC[i]);
584  }
585 
586  fhZNCvsZNA = new TH2F("hZNCvsZNA","hZNCvsZNA",200,-50.,140000,200,-50.,140000);
587  fOutput->Add(fhZNCvsZNA);
588  fhZPCvsZPA = new TH2F("hZPCvsZPA","hZPCvsZPA",200,-50.,50000,200,-50.,50000);
589  fOutput->Add(fhZPCvsZPA);
590  fhZDCCvsZDCCA = new TH2F("hZDCCvsZDCCA","hZDCCvsZDCCA",200,0.,180000.,200,0.,200000.);
591  fOutput->Add(fhZDCCvsZDCCA);
592  fhZNCvsZPC = new TH2F("hZNCvsZPC","hZNCvsZPC",200,-50.,50000,200,-50.,140000);
593  fOutput->Add(fhZNCvsZPC);
594  fhZNAvsZPA = new TH2F("hZNAvsZPA","hZNAvsZPA",200,-50.,50000,200,-50.,140000);
595  fOutput->Add(fhZNAvsZPA);
596  fhZNvsZP = new TH2F("hZNvsZP","hZNvsZP",200,-50.,80000,200,-50.,200000);
597  fOutput->Add(fhZNvsZP);
598  fhZNvsVZERO = new TH2F("hZNvsVZERO","hZNvsVZERO",250,0.,25000.,200,0.,200000.);
599  fOutput->Add(fhZNvsVZERO);
600  fhZDCvsVZERO = new TH2F("hZDCvsVZERO","hZDCvsVZERO",250,0.,25000.,250,0.,250000.);
601  fOutput->Add(fhZDCvsVZERO);
602  fhZDCvsTracklets = new TH2F("hZDCvsTracklets","hZDCvsTracklets",200,0.,4000.,250,0.,250000.);
604  fhZDCvsNclu1 = new TH2F("hZDCvsNclu1", "hZDCvsNclu1", 200, 0.,8000.,200,0.,250000.);
605  fOutput->Add(fhZDCvsNclu1);
606  fhDebunch = new TH2F("hDebunch","hDebunch",240,-100.,-40.,240,-30.,30.);
607  fOutput->Add(fhDebunch);
608  fhZNCcentroid = new TH2F("hZNCcentroid","hZNCcentroid",100,-3.5,3.5,100,-3.5,3.5);
609  fOutput->Add(fhZNCcentroid);
610  fhZNAcentroid = new TH2F("hZNAcentroid","hZNAcentroid",100,-3.5,3.5,100,-3.5,3.5);
611  fOutput->Add(fhZNAcentroid);
612 
613  fhAsymm = new TH1F("hAsymm" , "Asimmetry ",200,-1.,1.);
614  fOutput->Add(fhAsymm);
615  fhZNAvsAsymm = new TH2F("hZNAvsAsymm","ZNA vs. asymm.",200,-1.,1.,200,0.,80.);
616  fOutput->Add(fhZNAvsAsymm);
617  fhZNCvsAsymm = new TH2F("hZNCvsAsymm","ZNC vs. asymm.",200,-1.,1.,200,0.,80.);
618  fOutput->Add(fhZNCvsAsymm);
619 
620  fhZNCvscentrality = new TH2F("hZNCvscentrality","ZNC vs. centrality",100,0.,100.,100,0.,100.);
622  fhZNAvscentrality = new TH2F("hZNAvscentrality","ZNA vs. centrality",100,0.,100.,100,0.,100.);
624  fhZPCvscentrality = new TH2F("hZPCvscentrality","ZPC vs. centrality",100,0.,100.,100,0.,100.);
626  fhZPAvscentrality = new TH2F("hZPAvscentrality","ZPA vs. centrality",100,0.,100.,100,0.,100.);
628 
629  fhZNCpmcvscentr = new TH2F("hZNCpmcvscentr","ZNC PMC vs. centrality",100,0.,100.,100,0.,100.);
630  fOutput->Add(fhZNCpmcvscentr);
631  fhZNApmcvscentr = new TH2F("hZNApmcvscentr","ZNA PMC vs. centrality",100,0.,100.,100,0.,100.);
632  fOutput->Add(fhZNApmcvscentr);
633  fhZPCpmcvscentr = new TH2F("hZPCpmcvscentr","ZPC PMC vs. centrality",100,0.,100.,100,0.,100.);
634  fOutput->Add(fhZPCpmcvscentr);
635  fhZPApmcvscentr = new TH2F("hZPApmcvscentr","ZPA PMC vs. centrality",100,0.,100.,100,0.,100.);
636  fOutput->Add(fhZPApmcvscentr);
637 
638  fhZNCpmcLR = new TH1F("hZNCpmcLR","ZNC PMC lr", 100, 0., 10.);
639  fOutput->Add(fhZNCpmcLR);
640  fhZNApmcLR = new TH1F("hZNApmcLR","ZNA PMC lr", 100, 0., 10.);
641  fOutput->Add(fhZNApmcLR);
642  fhZPCpmcLR = new TH1F("hZPCpmcLR","ZPC PMC lr", 100, 0., 10.);
643  fOutput->Add(fhZPCpmcLR);
644  fhZPApmcLR = new TH1F("hZPApmcLR","ZPA PMC lr", 100, 0., 10.);
645  fOutput->Add(fhZPApmcLR);
646 
647  //********************************************************************
648 
649  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};
650 
651  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};
652 
653  Int_t dRun15h[] = {244917, 244918, 244975, 244980, 244982, 244983, 245061, 245064, 245066, 245068};
654 
655  if(fDataSet.EqualTo("2010")) {fCRCnRun=92;}
656  if(fDataSet.EqualTo("2011")) {fCRCnRun=119;}
657  if(fDataSet.EqualTo("2015")) {fCRCnRun=10;}
658  if(fDataSet.EqualTo("MCkine")) {fCRCnRun=1;}
659 
660  Int_t d=0;
661  for(Int_t r=0; r<fCRCnRun; r++) {
662  if(fDataSet.EqualTo("2010")) fRunList[d] = dRun10h[r];
663  if(fDataSet.EqualTo("2011")) fRunList[d] = dRun11h[r];
664  if(fDataSet.EqualTo("2015")) fRunList[d] = dRun15h[r];
665  if(fDataSet.EqualTo("MCkine")) fRunList[d] = 1;
666  d++;
667  }
668 
669  for(Int_t r=0;r<fCRCnRun;r++) {
670  fCRCQVecListRun[r] = new TList();
671  fCRCQVecListRun[r]->SetName(Form("Run %d",fRunList[r]));
672  fCRCQVecListRun[r]->SetOwner(kTRUE);
673  fOutput->Add(fCRCQVecListRun[r]);
674  for(Int_t i=0;i<fCRCnTow;i++) {
675  fhnTowerGain[r][i] = new TProfile(Form("fhnTowerGain[%d][%d]",fRunList[r],i),
676  Form("fhnTowerGain[%d][%d]",fRunList[r],i),20,0.,100.,"s");
677  fhnTowerGain[r][i]->Sumw2();
678  fCRCQVecListRun[r]->Add(fhnTowerGain[r][i]);
679  }
680  }
681 
682  PostData(2, fOutput);
683 }
684 
685 //________________________________________________________________________
686 void AliAnalysisTaskCRCZDC::UserExec(Option_t */*option*/)
687 {
688  // Execute analysis for current event:
689  AliMCEvent* McEvent = MCEvent();
690  AliAODEvent *aod = dynamic_cast<AliAODEvent*>(InputEvent());
691  AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
692 // AliMultiplicity* myTracklets = NULL;
693 // AliESDPmdTrack* pmdtracks = NULL;
694 // int availableINslot=1;
695 
696  if (!(fCutsRP&&fCutsPOI&&fCutsEvent)) {
697  AliError("cuts not set");
698  return;
699  }
700 
701  //DEFAULT - automatically takes care of everything
702  if (fAnalysisType == "AUTOMATIC") {
703 
704  //check event cuts
705  if (InputEvent()) {
706  if(!fCutsEvent->IsSelected(InputEvent(),MCEvent())) return;
707  if(fRejectPileUp && fAnalysisUtil->IsPileUpEvent(InputEvent())) return;
708  }
709 
710  //first attach all possible information to the cuts
711  fCutsRP->SetEvent( InputEvent(), MCEvent() ); //attach event
712  fCutsPOI->SetEvent( InputEvent(), MCEvent() );
713 
714  //then make the event
716 
718  fFlowEvent->SetCentrality(fCutsEvent->GetCentrality(InputEvent(),McEvent));
719 
720  fFlowEvent->SetCentralityCL1(((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL1"));
721  fFlowEvent->SetCentralityTRK(((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("TRK"));
722  fFlowEvent->SetNITSCL1(((AliVAODHeader*)aod->GetHeader())->GetNumberOfITSClusters(1));
723 
724  Double_t vtxpos[3]={0.,0.,0.};
725  vtxpos[0] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetX();
726  vtxpos[1] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetY();
727  vtxpos[2] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetZ();
728  fFlowEvent->SetVertexPosition(vtxpos);
729 
730  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
731 
732  }
733 
734  if (fAnalysisType == "MCAOD") {
735 
736  //check event cuts
737  if (InputEvent()) {
738  if(!fCutsEvent->IsSelected(InputEvent(),MCEvent())) return;
739  if(fRejectPileUp && fAnalysisUtil->IsPileUpEvent(InputEvent())) return;
740  }
741 
743 
744  if(!McEvent) {
745  AliError("ERROR: Could not retrieve MCEvent");
746  return;
747  }
748 
749  fMCStack = dynamic_cast<TClonesArray*>(aod->FindListObject(AliAODMCParticle::StdBranchName()));
750  if(!fMCStack){
751  AliError("ERROR: Could not retrieve MCStack");
752  return;
753  }
754  AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
755  if (!mcHeader) {
756  AliError("Could not find MC Header in AOD");
757  return;
758  }
759 
760  // get centrality (from MultSelection)
761  Float_t centr = 300;
762  if(fDataSet == "2015") {
763  AliMultSelection *MultSelection = 0x0;
764  MultSelection = (AliMultSelection * ) aod->FindListObject("MultSelection");
765  if( !MultSelection) {
766  //If you get this warning (and lPercentiles 300) please check that the AliMultSelectionTask actually ran (before your task)
767  AliWarning("AliMultSelection object not found!");
768  }else{
769  centr = MultSelection->GetMultiplicityPercentile("V0M");
770  }
771  } else {
772  AliCentrality* alicentr = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP();
773  centr = alicentr->GetCentralityPercentile("V0M");
774  }
775 
776  fCenDis->Fill(centr);
777 
778  // centrality bin
779  if (centr<fCentrLowLim || centr>=fCentrUpLim ) return;
780  Int_t CenBin = -1;
781  if (centr>0. && centr<5.) CenBin=0;
782  if (centr>5. && centr<10.) CenBin=1;
783  if (centr>10. && centr<20.) CenBin=2;
784  if (centr>20. && centr<30.) CenBin=3;
785  if (centr>30. && centr<40.) CenBin=4;
786  if (centr>40. && centr<50.) CenBin=5;
787  if (centr>50. && centr<60.) CenBin=6;
788  if (centr>60. && centr<70.) CenBin=7;
789  if (centr>70. && centr<80.) CenBin=8;
790  if (centr>80. && centr<90.) CenBin=9;
791  if(CenBin==-1) return;
792 
793  // reconstructed
794  Int_t AODPOIs = 0, AODbads = 0;
795  for(Int_t jTracks = 0; jTracks<aod->GetNumberOfTracks(); jTracks++){
796 
797  Bool_t FlagTPC=kFALSE, FlagGlob=kFALSE;
798 
799  AliAODTrack* track = dynamic_cast<AliAODTrack*>(aod->GetTrack(jTracks));
800  if(!track) continue;
801 
802  // select primaries
803  Int_t lp = TMath::Abs(track->GetLabel());
804  if (!((AliAODMCParticle*)fMCStack->At(lp))->IsPhysicalPrimary()) continue;
805 
806  // general kinematic & quality cuts
807  if (track->Pt() < .2 || track->Pt() > 8. || TMath::Abs(track->Eta()) > .8 || track->GetTPCNcls() < 70) continue;
808 
809  AODPOIs++;
810 
811  // test filter bits
812  if (track->TestFilterBit(32)) fPtSpecFB32[CenBin]->Fill(track->Pt());
813  if (track->TestFilterBit(96)) fPtSpecFB96[CenBin]->Fill(track->Pt());
814  if (track->TestFilterBit(128)) fPtSpecFB128[CenBin]->Fill(track->Pt());
815  if (track->TestFilterBit(768)) fPtSpecFB768[CenBin]->Fill(track->Pt());
816  }
817 
818  // generated (physical primaries)
819  Int_t MCPrims = 0, MCSecos = 0, SN=0;
820  for(Int_t jTracks = 0; jTracks<fMCStack->GetEntries(); jTracks++) {
821  AliAODMCParticle *MCpart = (AliAODMCParticle*)fMCStack->At(jTracks);
822  if (!MCpart) {
823  printf("ERROR: Could not receive MC track %d\n", jTracks);
824  continue;
825  }
826 
827  // select charged primaries
828  if ( MCpart->Charge() == 0. || !MCpart->IsPhysicalPrimary() ) continue;
829  // kinematic cuts
830  if ( MCpart->Pt() < 0.2 || MCpart->Pt() > 8. || TMath::Abs(MCpart->Eta()) > .8 ) continue;
831 
832  MCPrims++;
833 
834  fPtSpecGen[CenBin]->Fill(MCpart->Pt());
835  }
836 
837  fGenHeader = McEvent->GenEventHeader();
838  if(fGenHeader) fPythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(fGenHeader);
839  // printf("#reconstructed : %d (rejected from cuts %d), #MC primaries : %d (rejected from cuts %d) \n",AODPOIs,AODbads,MCPrims,MCSecos);
840  fFlowEvent->SetReferenceMultiplicity(aod->GetNumberOfTracks());
841  fFlowEvent->SetCentrality(aod->GetCentrality()->GetCentralityPercentile("V0M"));
842  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
843  fFlowEvent->SetRun(aod->GetRunNumber());
844  // printf("Run : %d, RefMult : %d, Cent : %f \n",fFlowEvent->GetRun(),fFlowEvent->GetReferenceMultiplicity(),fFlowEvent->GetCentrality());
845  }
846 
847  if(fAnalysisType == "MCESD") {
848 
850 
851  if(!esd) {
852  AliError("ERROR: Could not retrieve ESDEvent");
853  return;
854  }
855  if(!McEvent) {
856  AliError("ERROR: Could not retrieve MCEvent");
857  return;
858  }
859  AliStack* fStack = fMCEvent->Stack();
860  if(!fStack) {
861  AliError("ERROR: Could not retrieve MCStack");
862  return;
863  }
864 
865  AliESDVertex *vertex = (AliESDVertex*) esd->GetPrimaryVertex();
866  if (!vertex) return;
867  if (TMath::Abs(vertex->GetZ()) > 10. ) return;
868  if (vertex->GetNContributors() < 1 ) return;
869  AliCentrality *centrality = esd->GetCentrality();
870  if (!centrality) return;
871  Double_t centr = centrality->GetCentralityPercentile("V0M");
872  if (centr<fCentrLowLim || centr>=fCentrUpLim ) return;
873  Int_t CenBin = -1;
874  if (centr>0. && centr<5.) CenBin=0;
875  if (centr>5. && centr<10.) CenBin=1;
876  if (centr>10. && centr<20.) CenBin=2;
877  if (centr>20. && centr<30.) CenBin=3;
878  if (centr>30. && centr<40.) CenBin=4;
879  if (centr>40. && centr<50.) CenBin=5;
880  if (centr>50. && centr<60.) CenBin=6;
881  if (centr>60. && centr<70.) CenBin=7;
882  if (centr>70. && centr<80.) CenBin=8;
883  if (centr>80. && centr<90.) CenBin=9;
884  if(CenBin==-1) return;
885 
886  //Generated
887  Int_t MCPrims = 0;
888  for ( Int_t i=0 ; i<fStack->GetNtrack() ; i++ ) {
889 
890  //Primaries Selection
891  TParticle *particle = (TParticle*)fStack->Particle(i);
892  if (!particle) continue;
893  if (!fStack->IsPhysicalPrimary(i)) continue;
894  if ( particle->GetPDG()->Charge() == 0.) continue;
895 
896  //Kinematic Cuts
897  if ( particle->Pt()<0.2 || particle->Pt()>10. ) continue;
898  if ( TMath::Abs(particle->Eta())>0.8 ) continue;
899 
900  fFlowTrack->SetPhi(particle->Phi());
901  fFlowTrack->SetEta(particle->Eta());
902  fFlowTrack->SetPt(particle->Pt());
908  MCPrims++;
909 
910  fPtSpecGen[CenBin]->Fill(particle->Pt());
911 
912  }
913 
914  //Reconstructed
915  Int_t ESDPrims = 0;
916  for (Int_t i=0 ; i<esd->GetNumberOfTracks() ; i++) {
917 
918  //Get reconstructed track
919  AliVTrack *vtrack = static_cast<AliVTrack*>(esd->GetTrack(i));
920  AliESDtrack *track = dynamic_cast<AliESDtrack*>(vtrack);
921  if (!track) continue;
922 
923  //Primaries selection
924  Int_t lp = TMath::Abs(track->GetLabel());
925  if (!fStack->IsPhysicalPrimary(lp)) continue;
926  TParticle *particle = (TParticle*)fStack->Particle(lp);
927  if (!particle) continue;
928  if (particle->GetPDG()->Charge() == 0.) continue;
929 
930 // if(!fCutsPOI->PassesESDcuts(track)) continue;
931 
932  Bool_t pass = kTRUE;
933 
934  if(fCutTPC) {
935 // printf("******* cutting TPC ******** \n");
936  UShort_t ntpccls = track->GetTPCNcls();
937  Double_t tpcchi2 = track->GetTPCchi2();
938  if (tpcchi2<0.2 || tpcchi2 >=4.) {
939 // printf("TPCchi2 : %e %e ",tpcchi2,track->GetTPCchi2Iter1());
940  pass=kFALSE;
941  }
942  if (ntpccls < 70) {
943 // printf("#TPCcluster : %u %u %u %u ",ntpccls,track->GetTPCNclsF(),track->GetTPCNclsFIter1(),track->GetTPCNclsIter1());
944  pass=kFALSE;
945  }
946  }
947 
948  Float_t dcaxy=0.0;
949  Float_t dcaz=0.0;
950  track->GetImpactParameters(dcaxy,dcaz);
951  if (dcaxy > 0.3 || dcaz > 0.3) {
952 // printf("DCA : %e %e ",dcaxy,dcaz);
953  pass=kFALSE;
954  }
955  if(!pass) continue;
956 
957  //Kinematic Cuts
958  if ( track->Pt()<0.2 || track->Pt()>10. ) continue;
959  if ( TMath::Abs(track->Eta())>0.8 ) continue;
960 
961  fFlowTrack->SetPhi(track->Phi());
962  fFlowTrack->SetEta(track->Eta());
963  fFlowTrack->SetPt(track->Pt());
965  fFlowTrack->SetForRPSelection(kFALSE);
969  ESDPrims++;
970 
971  }
972 
973 // printf("#reconstructed : %d , #MC primaries : %d \n",ESDPrims,MCPrims);
974  fFlowEvent->SetReferenceMultiplicity(esd->GetNumberOfTracks());
975  fFlowEvent->SetCentrality(centr);
976  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
977  fFlowEvent->SetRun(esd->GetRunNumber());
978 // printf("Run : %d, RefMult : %d, Cent : %f \n",fFlowEvent->GetRun(),fFlowEvent->GetReferenceMultiplicity(),fFlowEvent->GetCentrality());
979 
980  } // end of if(fAnalysisType == "MCESD")
981 
982  if(fAnalysisType == "MCkine") {
983 
985 
986  AliInputEventHandler* McHandler = dynamic_cast<AliInputEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
987  if(!McHandler) {
988  AliError("ERROR: Could not retrieve MCtruthEventHandler");
989  return;
990  }
991  McEvent = McHandler->MCEvent();
992  if(!McEvent) {
993  AliError("ERROR: Could not retrieve MC event");
994  return;
995  }
996 
997  Int_t nTracks = McEvent->GetNumberOfTracks();
998 // Int_t nPrimTr = McEvent->GetNumberOfPrimaries();
999 
1000  //loop over tracks
1001  for (Int_t itrkN=0; itrkN<nTracks; itrkN++) {
1002  //get input particle
1003  AliMCParticle* pParticle = dynamic_cast<AliMCParticle*>(McEvent->GetTrack(itrkN));
1004  if (!pParticle) continue;
1005 
1006  //check if track passes the cuts
1007  if (McEvent->IsPhysicalPrimary(itrkN) && pParticle->Charge()!=0) {
1008  fFlowTrack->Set(pParticle);
1010  fFlowTrack->SetForRPSelection(kTRUE);
1015  }
1016  }// for all tracks
1017 
1018  // if monte carlo event get reaction plane from monte carlo (depends on generator)
1019  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
1020  // set reference multiplicity
1021  fFlowEvent->SetReferenceMultiplicity(McEvent->GetNumberOfTracks());
1022  // tag subevents
1024  // set centrality from impact parameter
1025  Double_t ImpPar=0., CenPer=0.;
1026  fGenHeader = McEvent->GenEventHeader();
1027  if(fGenHeader){
1028  fPythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(fGenHeader);
1029  if(fPythiaGenHeader) ImpPar = fPythiaGenHeader->GetImpactParameter();
1030  fHijingGenHeader = dynamic_cast<AliGenHijingEventHeader*>(fGenHeader);
1031  if(fHijingGenHeader) ImpPar = fHijingGenHeader->ImpactParameter();
1032  if(ImpPar) CenPer = 0.3859796743103508*pow(ImpPar,2.);
1033  if(CenPer>0. && CenPer<100.) fFlowEvent->SetCentrality(CenPer);
1034  else return;
1035  fFlowEvent->SetRun(1);
1036  }
1037 
1038  } // end of if(fAnalysisType == "MCkine")
1039 
1040  if (!fFlowEvent) return; //shuts up coverity
1041 
1042  //check final event cuts
1043  Int_t mult = fFlowEvent->NumberOfTracks();
1044  // AliInfo(Form("FlowEvent has %i tracks",mult));
1045  if (mult<fMinMult || mult>fMaxMult) {
1046  AliWarning("FlowEvent cut on multiplicity"); return;
1047  }
1048 
1049  //define dead zone
1051 
1054  if (fAfterburnerOn)
1055  {
1056  //if reaction plane not set from elsewhere randomize it before adding flow
1058  fFlowEvent->SetMCReactionPlaneAngle(gRandom->Uniform(0.0,TMath::TwoPi()));
1059 
1060  if(fDifferentialV2)
1062  else
1063  fFlowEvent->AddFlow(fV1,fV2,fV3,fV4,fV5); //add flow
1064  fFlowEvent->CloneTracks(fNonFlowNumberOfTrackClones); //add nonflow by cloning tracks
1065  }
1067 
1068  //tag subEvents
1070 
1071  //do we want to serve shullfed tracks to everybody?
1073 
1074  // associate the mother particles to their daughters in the flow event (if any)
1076 
1077  //fListHistos->Print();
1078  //fOutputFile->WriteObject(fFlowEvent,"myFlowEventSimple");
1079 
1080 // printf("event : ntr %d, cen %f **********************************************************************************************************\n"
1081 
1082  //********************************************************************************************************************************
1083 
1084  if(fAnalysisType == "MCkine") return;
1085 
1086  // PHYSICS SELECTION
1087  AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
1088  AliInputEventHandler *hdr = (AliInputEventHandler*)am->GetInputEventHandler();
1089 
1090  if(hdr->IsEventSelected() && AliVEvent::kAny) {
1091 
1092  AliCentrality* centrality = aod->GetCentrality();
1093  Float_t centrperc = centrality->GetCentralityPercentile(fCentrEstimator.Data());
1094 
1095  AliAODTracklets *trackl = aod->GetTracklets();
1096  Int_t nTracklets = trackl->GetNumberOfTracklets();
1097 
1098  AliAODVZERO *vzeroAOD = aod->GetVZEROData();
1099  Float_t multV0A = vzeroAOD->GetMTotV0A();
1100  Float_t multV0C = vzeroAOD->GetMTotV0C();
1101 
1102  AliAODZDC *aodZDC = aod->GetZDCData();
1103 
1104  Float_t energyZNC = (Float_t) (aodZDC->GetZNCEnergy());
1105  Float_t energyZPC = (Float_t) (aodZDC->GetZPCEnergy());
1106  Float_t energyZNA = (Float_t) (aodZDC->GetZNAEnergy());
1107  Float_t energyZPA = (Float_t) (aodZDC->GetZPAEnergy());
1108  Float_t energyZEM1 = (Float_t) (aodZDC->GetZEM1Energy());
1109  Float_t energyZEM2 = (Float_t) (aodZDC->GetZEM2Energy());
1110 
1111  const Double_t * towZNC = aodZDC->GetZNCTowerEnergy();
1112  const Double_t * towZPC = aodZDC->GetZPCTowerEnergy();
1113  const Double_t * towZNA = aodZDC->GetZNATowerEnergy();
1114  const Double_t * towZPA = aodZDC->GetZPATowerEnergy();
1115  //
1116  const Double_t * towZNClg = aodZDC->GetZNCTowerEnergyLR();
1117  const Double_t * towZNAlg = aodZDC->GetZNATowerEnergyLR();
1118  //
1119  Double_t towZPClg[5], towZPAlg[5]={0.};
1120  for(Int_t it=0; it<5; it++){
1121  towZPClg[it] = 8*towZPC[it];
1122  towZPAlg[it] = 8*towZNA[it];
1123  }
1124 
1125  // Get centroid from ZDCs *******************************************************
1126 
1127  Double_t xyZNC[2]={999.,999.}, xyZNA[2]={999.,999.};
1128  Float_t zncEnergy=0., znaEnergy=0.;
1129  for(Int_t i=0; i<5; i++){
1130  zncEnergy += towZNC[i];
1131  znaEnergy += towZNA[i];
1132  }
1133  fFlowEvent->SetZNCEnergy(towZNC[0]);
1134  fFlowEvent->SetZNAEnergy(towZNA[0]);
1135 
1136  if (fUseMCCen) {
1137  if(aod->GetRunNumber() < 209122) aodZDC->GetZNCentroidInPbPb(1380., xyZNC, xyZNA);
1138  else aodZDC->GetZNCentroidInPbPb(2510., xyZNC, xyZNA);
1139  } else {
1140  const Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
1141  const Float_t y[4] = {-1.75, -1.75, 1.75, 1.75};
1142  Float_t numXZNC=0., numYZNC=0., denZNC=0., wZNC;
1143  Float_t numXZNA=0., numYZNA=0., denZNA=0., wZNA;
1144  for(Int_t i=0; i<4; i++) {
1145  if(towZNC[i+1]>0.) {
1146  wZNC = TMath::Power(towZNC[i+1], fZDCGainAlpha);
1147  numXZNC += x[i]*wZNC;
1148  numYZNC += y[i]*wZNC;
1149  denZNC += wZNC;
1150  }
1151  if(towZNA[i+1]>0.) {
1152  wZNA = TMath::Power(towZNA[i+1], fZDCGainAlpha);
1153  numXZNA += x[i]*wZNA;
1154  numYZNA += y[i]*wZNA;
1155  denZNA += wZNA;
1156  }
1157  }
1158  if(denZNC!=0) {
1159  xyZNC[0] = numXZNC/denZNC;
1160  xyZNC[1] = numYZNC/denZNC;
1161  }
1162  else{
1163  xyZNC[0] = xyZNC[1] = 999.;
1164  zncEnergy = 0.;
1165  }
1166  if(denZNA!=0) {
1167  xyZNA[0] = numXZNA/denZNA;
1168  xyZNA[1] = numYZNA/denZNA;
1169  }
1170  else{
1171  xyZNA[0] = xyZNA[1] = 999.;
1172  znaEnergy = 0.;
1173  }
1174  }
1175 
1176  Float_t MulA=0., MulC=0.;
1177  for(Int_t i=0; i<4; i++) {
1178  if(towZNC[i+1]>0.) {
1179  MulC += TMath::Power(towZNC[i+1], fZDCGainAlpha);
1180  }
1181  if(towZNA[i+1]>0.) {
1182  MulA += TMath::Power(towZNA[i+1], fZDCGainAlpha);
1183  }
1184  }
1185 
1186  fhZNCcentroid->Fill(xyZNC[0], xyZNC[1]);
1187  fhZNAcentroid->Fill(xyZNA[0], xyZNA[1]);
1188  fFlowEvent->SetZDC2Qsub(xyZNC,MulC,xyZNA,MulA);
1189 
1190  Int_t RunBin=-1, bin=0, RunNum=fFlowEvent->GetRun();
1191  for(Int_t c=0;c<fCRCnRun;c++) {
1192  if(fRunList[c]==RunNum) RunBin=bin;
1193  else bin++;
1194  }
1195  if(fDataSet.EqualTo("MCkine")) RunBin=0;
1196  if(RunBin!=-1) {
1197  for(Int_t i=0; i<4; i++) {
1198  if(towZNC[i+1]>0.) {
1199  fhnTowerGain[RunBin][i]->Fill(centrperc,TMath::Power(towZNC[i+1], 0.395));
1200  }
1201  if(towZNA[i+1]>0.) {
1202  fhnTowerGain[RunBin][i+4]->Fill(centrperc,TMath::Power(towZNA[i+1], 0.395));
1203  }
1204  }
1205  }
1206 
1207  // ******************************************************************************
1208 
1209  Float_t tdcSum = aodZDC->GetZDCTimeSum();
1210  Float_t tdcDiff = aodZDC->GetZDCTimeDiff();
1211  fhDebunch->Fill(tdcDiff, tdcSum);
1212 
1213  for(int i=0; i<5; i++){
1214  fhZNCPM[i]->Fill(towZNC[i]);
1215  fhZNCPMlg[i]->Fill(towZNClg[i]);
1216  if((i<4) && (towZNC[0]>0.)) fhZNCPMQiPMC[i]->Fill(towZNC[i+1]/towZNC[0]);
1217  fhZNCpmcLR->Fill(towZNClg[0]/1000.);
1218  }
1219  fhPMCvsPMQ[0]->Fill(towZNC[1]+towZNC[2]+towZNC[3]+towZNC[4], towZNC[0]);
1220  for(int i=0; i<5; i++){
1221  fhZPCPM[i]->Fill(towZPC[i]);
1222  fhZPCPMlg[i]->Fill(towZPClg[i]);
1223  if(((i<4) && towZPC[0]>0.)) fhZPCPMQiPMC[i]->Fill(towZPC[i+1]/towZPC[0]);
1224  fhZPCpmcLR->Fill(towZPClg[0]/1000.);
1225  }
1226  fhPMCvsPMQ[1]->Fill(towZPC[1]+towZPC[2]+towZPC[3]+towZPC[4], towZPC[0]);
1227  for(int i=0; i<5; i++){
1228  fhZNAPM[i]->Fill(towZNA[i]);
1229  fhZNAPMlg[i]->Fill(towZNAlg[i]);
1230  if(((i<4) && towZNA[0]>0.)) fhZNAPMQiPMC[i]->Fill(towZNA[i+1]/towZNA[0]);
1231  fhZNApmcLR->Fill(towZNAlg[0]/1000.);
1232  }
1233  fhPMCvsPMQ[2]->Fill(towZNA[1]+towZNA[2]+towZNA[3]+towZNA[4], towZNA[0]);
1234  for(int i=0; i<5; i++){
1235  fhZPAPM[i]->Fill(towZPA[i]);
1236  fhZPAPMlg[i]->Fill(towZPAlg[i]);
1237  if(((i<4) && towZPA[0]>0.)) fhZPAPMQiPMC[i]->Fill(towZPA[i+1]/towZPA[0]);
1238  fhZPApmcLR->Fill(towZPAlg[0]/1000.);
1239  }
1240  fhPMCvsPMQ[3]->Fill(towZPA[1]+towZPA[2]+towZPA[3]+towZPA[4], towZPA[0]);
1241  fhZEM[0]->Fill(energyZEM1);
1242  fhZEM[1]->Fill(energyZEM2);
1243 
1244  fhZNCvsZNA->Fill(energyZNA, energyZNC);
1245  fhZPCvsZPA->Fill(energyZPA, energyZPC);
1246  fhZDCCvsZDCCA->Fill(energyZNA+energyZPA, energyZNC+energyZPC);
1247  fhZNCvsZPC->Fill(energyZPC, energyZNC);
1248  fhZNAvsZPA->Fill(energyZPA, energyZNA);
1249  fhZNvsZP->Fill(energyZPA+energyZPC, energyZNA+energyZNC);
1250  fhZNvsVZERO->Fill(multV0A+multV0C, energyZNC+energyZNA);
1251  fhZDCvsVZERO->Fill(multV0A+multV0C, energyZNA+energyZPA+energyZNC+energyZPC);
1252  fhZDCvsTracklets->Fill((Float_t) (nTracklets), energyZNA+energyZPA+energyZNC+energyZPC);
1253 
1254  Double_t asymmetry = -999.;
1255  if((energyZNC+energyZNA)>0.) asymmetry = (energyZNC-energyZNA)/(energyZNC+energyZNA);
1256  fhAsymm->Fill(asymmetry);
1257  fhZNAvsAsymm->Fill(asymmetry, energyZNA/1000.);
1258  fhZNCvsAsymm->Fill(asymmetry, energyZNC/1000.);
1259 
1260  fhZNCvscentrality->Fill(centrperc, energyZNC/1000.);
1261  fhZNAvscentrality->Fill(centrperc, energyZNA/1000.);
1262  fhZPCvscentrality->Fill(centrperc, energyZPC/1000.);
1263  fhZPAvscentrality->Fill(centrperc, energyZPA/1000.);
1264 
1265  fhZNCpmcvscentr->Fill(centrperc, towZNC[0]/1380.);
1266  fhZNApmcvscentr->Fill(centrperc, towZNA[0]/1380.);
1267  fhZPCpmcvscentr->Fill(centrperc, towZPC[0]/1380.);
1268  fhZPApmcvscentr->Fill(centrperc, towZPA[0]/1380.);
1269 
1270  } // PHYSICS SELECTION
1271 
1272  PostData(1, fFlowEvent);
1273 
1274  PostData(2, fOutput);
1275 
1276 }
1277 
1278 //________________________________________________________________________
1280  fCutContainer->AddAt(cutsRP,0); fCutsRP=cutsRP; cutsRP->SetPOItype(0);
1281 }
1282 
1283 //________________________________________________________________________
1285  fCutContainer->AddAt(cutsPOI,1); fCutsPOI=cutsPOI; cutsPOI->SetPOItype(1);
1286 }
1287 
1288 //________________________________________________________________________
1289 void AliAnalysisTaskCRCZDC::Terminate(Option_t */*option*/)
1290 {
1291  // Terminate analysis
1292  //
1293  /* if(fDebug > 1) printf(" **** AliAnalysisTaskCRCZDC::Terminate() \n");
1294 
1295  //fOutput = dynamic_cast<TList*> (GetOutputData(1));
1296  //if(!fOutput) printf("ERROR: fOutput not available\n");
1297  */
1298 }
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.
TH1F * fPtSpecFB32[10]
PtSpecGen.
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)
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.
void Fill(AliFlowTrackCuts *rpCuts, AliFlowTrackCuts *poiCuts)
TH2F * fhZNAvsZPA
ZNC vs ZPC;.
TH1F * fhZNAPM[5]
ZNC PM high res.
void SetShuffleTracks(Bool_t b)
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)
TH1F * fPtSpecFB128[10]
PtSpecRec FB96.
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
TClonesArray * fMCStack
centrality distribution
TList * GetQA() const
static const Int_t fCRCMaxnRun
ZPA PMC low res. chain.
void SetForPOISelection(Bool_t b=kTRUE)
TH1F * fPtSpecFB96[10]
PtSpecRec FB32.
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)
Bool_t fCutTPC
PtSpecRec FB768.
TH2F * fhPMCvsPMQ[4]
ZNA centroid.
TH1F * fhZNCpmcLR
ZPA vs. centrality.
TH1F * fPtSpecFB768[10]
PtSpecRec FB128.
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