AliPhysics  01c3411 (01c3411)
 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 "TStopwatch.h"
30 #include "TProfile.h"
31 #include <TList.h>
32 #include <TH1F.h>
33 #include <TH2F.h>
34 #include <TH3D.h>
35 #include <TFile.h>
36 #include <TString.h>
37 #include <TCanvas.h>
38 #include <TParticle.h>
39 #include "TProfile3D.h"
40 
41 #include "AliAnalysisManager.h"
42 #include "AliInputEventHandler.h"
43 #include "AliVEvent.h"
44 #include "AliESD.h"
45 #include "AliESDEvent.h"
46 #include "AliESDHeader.h"
47 #include "AliESDInputHandler.h"
48 #include "AliESDZDC.h"
49 #include "AliMultiplicity.h"
50 #include "AliAnalysisUtils.h"
51 #include "AliAODHandler.h"
52 #include "AliAODTrack.h"
53 #include "AliAODEvent.h"
54 #include "AliAODHeader.h"
55 #include "AliAODVertex.h"
56 #include "AliAODVZERO.h"
57 #include "AliAODZDC.h"
58 #include "AliAODMCHeader.h"
59 #include "AliMCEventHandler.h"
60 #include "AliMCEvent.h"
61 #include "AliHeader.h"
62 #include "AliVParticle.h"
63 #include "AliStack.h"
64 #include "AliAODMCParticle.h"
65 #include "AliAnalysisTaskSE.h"
66 #include "AliGenEventHeader.h"
67 #include "AliPhysicsSelectionTask.h"
68 #include "AliPhysicsSelection.h"
69 #include "AliBackgroundSelection.h"
70 #include "AliTriggerAnalysis.h"
71 #include "AliCentrality.h"
72 #include "AliAnalysisTaskCRCZDC.h"
73 #include "AliMultSelection.h"
74 #include "AliLumiTools.h"
75 
76 // ALICE Correction Framework
77 #include "AliCFManager.h"
78 
79 // Interface to Event generators to get Reaction Plane Angle
80 #include "AliGenCocktailEventHeader.h"
81 #include "AliGenPythiaEventHeader.h"
82 #include "AliGenHijingEventHeader.h"
83 #include "AliGenGeVSimEventHeader.h"
84 #include "AliGenEposEventHeader.h"
85 
86 // Interface to Load short life particles
87 #include "TObjArray.h"
88 #include "AliFlowCandidateTrack.h"
89 
90 // Interface to make the Flow Event Simple used in the flow analysis methods
91 #include "AliFlowEvent.h"
92 #include "AliFlowTrackCuts.h"
93 #include "AliFlowEventCuts.h"
94 #include "AliFlowCommonConstants.h"
95 
97 
98 //________________________________________________________________________
101 fAnalysisType("AUTOMATIC"),
102 fRPType(""),
103 fCFManager1(NULL),
104 fCFManager2(NULL),
105 fCutsEvent(NULL),
106 fCutsRP(NULL),
107 fCutsPOI(NULL),
108 fCutContainer(new TList()),
109 fQAList(NULL),
110 fMinMult(0),
111 fMaxMult(10000000),
112 fMinA(-1.0),
113 fMaxA(-0.01),
114 fMinB(0.01),
115 fMaxB(1.0),
116 fGenHeader(NULL),
117 fPythiaGenHeader(NULL),
118 fHijingGenHeader(NULL),
119 fFlowTrack(NULL),
120 fAnalysisUtil(NULL),
121 fQAon(kFALSE),
122 fLoadCandidates(kFALSE),
123 fNbinsMult(10000),
124 fNbinsPt(100),
125 fNbinsPhi(100),
126 fNbinsEta(200),
127 fNbinsQ(500),
128 fNbinsMass(1),
129 fMultMin(0.),
130 fMultMax(10000.),
131 fPtMin(0.),
132 fPtMax(10.),
133 fPhiMin(0.),
134 fPhiMax(TMath::TwoPi()),
135 fEtaMin(-5.),
136 fEtaMax(5.),
137 fQMin(0.),
138 fQMax(3.),
139 fMassMin(-1.),
140 fMassMax(0.),
141 fHistWeightvsPhiMin(0.),
142 fHistWeightvsPhiMax(3.),
143 fExcludedEtaMin(0.),
144 fExcludedEtaMax(0.),
145 fExcludedPhiMin(0.),
146 fExcludedPhiMax(0.),
147 fAfterburnerOn(kFALSE),
148 fNonFlowNumberOfTrackClones(0),
149 fV1(0.),
150 fV2(0.),
151 fV3(0.),
152 fV4(0.),
153 fV5(0.),
154 fDifferentialV2(0),
155 fFlowEvent(NULL),
156 fShuffleTracks(kFALSE),
157 fMyTRandom3(NULL),
158 fAnalysisInput(kAOD),
159 fIsMCInput(kFALSE),
160 fUseMCCen(kTRUE),
161 fRejectPileUp(kTRUE),
162 fCentrLowLim(0.),
163 fCentrUpLim(100.),
164 fCentrEstimator("V0M"),
165 fOutput(0x0),
166 fhZNCvsZNA(0x0),
167 fhZPCvsZPA(0x0),
168 fhZDCCvsZDCCA(0x0),
169 fhZNCvsZPC(0x0),
170 fhZNAvsZPA(0x0),
171 fhZNvsZP(0x0),
172 fhZNvsVZERO(0x0),
173 fhZDCvsVZERO(0x0),
174 fhZDCvsTracklets(0x0),
175 fhZDCvsNclu1(0x0),
176 fhDebunch(0x0),
177 fhZNCcentroid(0x0),
178 fhZNAcentroid(0x0),
179 fhAsymm(0x0),
180 fhZNAvsAsymm(0x0),
181 fhZNCvsAsymm(0x0),
182 fhZNCvscentrality(0x0),
183 fhZNAvscentrality(0x0),
184 fhZPCvscentrality(0x0),
185 fhZPAvscentrality(0x0),
186 fhZNCpmcvscentr(0x0),
187 fhZNApmcvscentr(0x0),
188 fhZPCpmcvscentr(0x0),
189 fhZPApmcvscentr(0x0),
190 fhZNCpmcLR(0x0),
191 fhZNApmcLR(0x0),
192 fhZPCpmcLR(0x0),
193 fhZPApmcLR(0x0),
194 fCRCnRun(0),
195 fZDCGainAlpha(0.395),
196 fDataSet(kAny),
197 fStack(0x0),
198 fCutTPC(kFALSE),
199 fCenDis(0x0),
200 fMultSelection(0x0),
201 fCentrality(0x0),
202 fTowerEqList(NULL),
203 fSpectraMCList(NULL),
204 fCachedRunNum(0)
205 {
206  for(int i=0; i<5; i++){
207  fhZNCPM[i] = 0x0;
208  fhZNAPM[i] = 0x0;
209  fhZPCPM[i] = 0x0;
210  fhZPAPM[i] = 0x0;
211  fhZNCPMlg[i] = 0x0;
212  fhZNAPMlg[i] = 0x0;
213  fhZPCPMlg[i] = 0x0;
214  fhZPAPMlg[i] = 0x0;
215  }
216  for(int i=0; i<2; i++) fhZEM[i] = 0x0;
217  for(int i=0; i<6; i++){
218  fhTDCraw[i] = 0x0;
219  fhTDC[i] = 0x0;
220  }
221  for(int i=0; i<4; i++){
222  fhZNCPMQiPMC[i] = 0x0;
223  fhZNAPMQiPMC[i] = 0x0;
224  fhZPCPMQiPMC[i] = 0x0;
225  fhZPAPMQiPMC[i] = 0x0;
226  fhPMCvsPMQ[i] = 0x0;
227  }
228  for(Int_t r=0; r<fCRCMaxnRun; r++) {
229  fRunList[r] = 0;
230  }
231 // for(Int_t c=0; c<fnCen; c++) {
232 // for(Int_t k=0; k<8; k++) {
233 // fTowerGainEq[c][k] = NULL;
234 // }
235 // }
236  this->InitializeRunArrays();
237  fMyTRandom3 = new TRandom3(1);
238  gRandom->SetSeed(fMyTRandom3->Integer(65539));
239  for(Int_t c=0; c<10; c++) {
240  fPtSpecGen[c] = NULL;
241  fPtSpecFB32[c] = NULL;
242  fPtSpecFB96[c] = NULL;
243  fPtSpecFB128[c] = NULL;
244  fPtSpecFB768[c] = NULL;
245  }
246 }
247 
248 //________________________________________________________________________
249 AliAnalysisTaskCRCZDC::AliAnalysisTaskCRCZDC(const char *name, TString RPtype, Bool_t on, UInt_t iseed, Bool_t bCandidates):
250 AliAnalysisTaskSE(name),
251 fAnalysisType("AUTOMATIC"),
252 fRPType(RPtype),
253 fCFManager1(NULL),
254 fCFManager2(NULL),
255 fCutsEvent(NULL),
256 fCutsRP(NULL),
257 fCutsPOI(NULL),
258 fCutContainer(new TList()),
259 fQAList(NULL),
260 fMinMult(0),
261 fMaxMult(10000000),
262 fMinA(-1.0),
263 fMaxA(-0.01),
264 fMinB(0.01),
265 fMaxB(1.0),
266 fQAon(on),
267 fLoadCandidates(bCandidates),
268 fNbinsMult(10000),
269 fNbinsPt(100),
270 fNbinsPhi(100),
271 fNbinsEta(200),
272 fNbinsQ(500),
273 fNbinsMass(1),
274 fMultMin(0.),
275 fMultMax(10000.),
276 fPtMin(0.),
277 fPtMax(10.),
278 fPhiMin(0.),
279 fPhiMax(TMath::TwoPi()),
280 fEtaMin(-5.),
281 fEtaMax(5.),
282 fQMin(0.),
283 fQMax(3.),
284 fMassMin(-1.),
285 fMassMax(0.),
286 fHistWeightvsPhiMin(0.),
287 fHistWeightvsPhiMax(3.),
288 fExcludedEtaMin(0.),
289 fExcludedEtaMax(0.),
290 fExcludedPhiMin(0.),
291 fExcludedPhiMax(0.),
292 fAfterburnerOn(kFALSE),
293 fNonFlowNumberOfTrackClones(0),
294 fV1(0.),
295 fV2(0.),
296 fV3(0.),
297 fV4(0.),
298 fV5(0.),
299 fDifferentialV2(0),
300 fFlowEvent(NULL),
301 fShuffleTracks(kFALSE),
302 fMyTRandom3(NULL),
303 fAnalysisInput(kAOD),
304 fIsMCInput(kFALSE),
305 fUseMCCen(kTRUE),
306 fRejectPileUp(kTRUE),
307 fCentrLowLim(0.),
308 fCentrUpLim(100.),
309 fCentrEstimator("V0M"),
310 fOutput(0x0),
311 fhZNCvsZNA(0x0),
312 fhZPCvsZPA(0x0),
313 fhZDCCvsZDCCA(0x0),
314 fhZNCvsZPC(0x0),
315 fhZNAvsZPA(0x0),
316 fhZNvsZP(0x0),
317 fhZNvsVZERO(0x0),
318 fhZDCvsVZERO(0x0),
319 fhZDCvsTracklets(0x0),
320 fhZDCvsNclu1(0x0),
321 fhDebunch(0x0),
322 fhZNCcentroid(0x0),
323 fhZNAcentroid(0x0),
324 fhAsymm(0x0),
325 fhZNAvsAsymm(0x0),
326 fhZNCvsAsymm(0x0),
327 fhZNCvscentrality(0x0),
328 fhZNAvscentrality(0x0),
329 fhZPCvscentrality(0x0),
330 fhZPAvscentrality(0x0),
331 fhZNCpmcvscentr(0x0),
332 fhZNApmcvscentr(0x0),
333 fhZPCpmcvscentr(0x0),
334 fhZPApmcvscentr(0x0),
335 fhZNCpmcLR(0x0),
336 fhZNApmcLR(0x0),
337 fhZPCpmcLR(0x0),
338 fhZPApmcLR(0x0),
339 fDataSet(kAny),
340 fCRCnRun(0),
341 fZDCGainAlpha(0.395),
342 fGenHeader(NULL),
343 fPythiaGenHeader(NULL),
344 fHijingGenHeader(NULL),
345 fFlowTrack(NULL),
346 fAnalysisUtil(NULL),
347 fStack(0x0),
348 fCutTPC(kFALSE),
349 fCenDis(0x0),
350 fMultSelection(0x0),
351 fCentrality(0x0),
352 fTowerEqList(NULL),
353 fCachedRunNum(0)
354 {
355 
356  for(int i=0; i<5; i++){
357  fhZNCPM[i] = 0x0;
358  fhZNAPM[i] = 0x0;
359  fhZPCPM[i] = 0x0;
360  fhZPAPM[i] = 0x0;
361  fhZNCPMlg[i] = 0x0;
362  fhZNAPMlg[i] = 0x0;
363  fhZPCPMlg[i] = 0x0;
364  fhZPAPMlg[i] = 0x0;
365  }
366  for(int i=0; i<2; i++) fhZEM[i] = 0x0;
367  for(int i=0; i<6; i++){
368  fhTDCraw[i] = 0x0;
369  fhTDC[i] = 0x0;
370  }
371  for(int i=0; i<4; i++){
372  fhZNCPMQiPMC[i] = 0x0;
373  fhZNAPMQiPMC[i] = 0x0;
374  fhZPCPMQiPMC[i] = 0x0;
375  fhZPAPMQiPMC[i] = 0x0;
376  fhPMCvsPMQ[i] = 0x0;
377  }
378  for(Int_t r=0; r<fCRCMaxnRun; r++) {
379  fRunList[r] = 0;
380  }
381 // for(Int_t c=0; c<fnCen; c++) {
382 // for(Int_t k=0; k<8; k++) {
383 // fTowerGainEq[c][k] = NULL;
384 // }
385 // }
386  this->InitializeRunArrays();
387  fMyTRandom3 = new TRandom3(iseed);
388  gRandom->SetSeed(fMyTRandom3->Integer(65539));
389 
390  DefineInput(0, TChain::Class());
391  // Define output slots here
392  // Define here the flow event output
393  DefineOutput(1, AliFlowEventSimple::Class());
394  DefineOutput(2, TList::Class());
395 
396  for(Int_t c=0; c<10; c++) {
397  fPtSpecGen[c] = NULL;
398  fPtSpecFB32[c] = NULL;
399  fPtSpecFB96[c] = NULL;
400  fPtSpecFB128[c] = NULL;
401  fPtSpecFB768[c] = NULL;
402  }
403 
404 }
405 
406 //________________________________________________________________________
408 {
409  // Destructor
410  if(fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
411  delete fOutput; fOutput=0;
412  }
413  delete fMyTRandom3;
414  delete fFlowEvent;
415  delete fFlowTrack;
416  delete fCutsEvent;
417 // delete fTowerEqList;
418  if (fAnalysisUtil) delete fAnalysisUtil;
419  if (fQAList) delete fQAList;
420  if (fCutContainer) fCutContainer->Delete(); delete fCutContainer;
421 }
422 
423 //________________________________________________________________________
425 {
426  for(Int_t r=0;r<fCRCMaxnRun;r++) {
427  fCRCQVecListRun[r] = NULL;
428  for(Int_t i=0;i<5;i++) {
429  fZNCTower[r][i] = NULL;
430  fZNATower[r][i] = NULL;
431  }
432  }
433 // for(Int_t k=0;k<fCRCnTow;k++) {
434 // fhnTowerGain[k] = NULL;
435 // for(Int_t i=0;i<fnCen;i++) {
436 // fhnTowerGainVtx[i][k] = NULL;
437 // }
438 // }
439 }
440 
441 //________________________________________________________________________
443 {
444  // Create the output containers
445 
446  if (!(fAnalysisType == "AOD" || fAnalysisType == "MCkine" || fAnalysisType == "MCAOD" || fAnalysisType == "AUTOMATIC" || fAnalysisType == "MCESD"))
447  {
448  AliError("WRONG ANALYSIS TYPE! only MCESD, MCkine, MCAOD, AOD and AUTOMATIC are allowed.");
449  exit(1);
450  }
451 
452  //set the common constants
455  cc->SetNbinsPt(fNbinsPt);
456  cc->SetNbinsPhi(fNbinsPhi);
457  cc->SetNbinsEta(fNbinsEta);
458  cc->SetNbinsQ(fNbinsQ);
460  cc->SetMultMin(fMultMin);
461  cc->SetMultMax(fMultMax);
462  cc->SetPtMin(fPtMin);
463  cc->SetPtMax(fPtMax);
464  cc->SetPhiMin(fPhiMin);
465  cc->SetPhiMax(fPhiMax);
466  cc->SetEtaMin(fEtaMin);
467  cc->SetEtaMax(fEtaMax);
468  cc->SetQMin(fQMin);
469  cc->SetQMax(fQMax);
470  cc->SetMassMin(fMassMin);
471  cc->SetMassMax(fMassMax);
474 
475  fFlowEvent = new AliFlowEvent(20000);
476  fFlowTrack = new AliFlowTrack();
477 
478  //printf(" AliAnalysisTaskCRCZDC::UserCreateOutputObjects()\n\n");
479  fOutput = new TList();
480  fOutput->SetOwner(kTRUE);
481  //fOutput->SetName("output");
482 
483  if (fQAon) {
484  fQAList = new TList();
485  fQAList->SetOwner(kTRUE);
486  fQAList->SetName("AliFlowEventCuts QA");
487  if (fCutsEvent->GetQA()) fQAList->Add(fCutsEvent->GetQA()); //0
488  if (fCutsRP->GetQA()) fQAList->Add(fCutsRP->GetQA()); //1
489  if (fCutsPOI->GetQA())fQAList->Add(fCutsPOI->GetQA()); //2
490  fOutput->Add(fQAList);
491  }
492 
493  fCenDis = new TH1F("fCenDis", "fCenDis", 100, 0., 100.);
494  fOutput->Add(fCenDis);
495 // for(Int_t c=0; c<fnCen; c++) {
496 // for(Int_t k=0; k<8; k++) {
497 // fTowerGainEq[c][k] = new TH3D();
498 // fOutput->Add(fTowerGainEq[c][k]);
499 // }
500 // }
501 
502  fSpectraMCList = new TList();
503  fSpectraMCList->SetOwner(kTRUE);
504  fSpectraMCList->SetName("Spectra");
505  fOutput->Add(fSpectraMCList);
506 
507  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.};
508  for(Int_t c=0; c<10; c++) {
509  fPtSpecGen[c] = new TH1F(Form("fPtSpecGen[%d]",c), Form("fPtSpecGen[%d]",c), 24, xmin);
510  fSpectraMCList->Add(fPtSpecGen[c]);
511  fPtSpecFB32[c] = new TH1F(Form("fPtSpecFB32[%d]",c), Form("fPtSpecFB32[%d]",c), 24, xmin);
512  fSpectraMCList->Add(fPtSpecFB32[c]);
513  fPtSpecFB96[c] = new TH1F(Form("fPtSpecFB96[%d]",c), Form("fPtSpecFB96[%d]",c), 24, xmin);
514  fSpectraMCList->Add(fPtSpecFB96[c]);
515  fPtSpecFB128[c] = new TH1F(Form("fPtSpecFB128[%d]",c), Form("fPtSpecFB128[%d]",c), 24, xmin);
516  fSpectraMCList->Add(fPtSpecFB128[c]);
517  fPtSpecFB768[c] = new TH1F(Form("fPtSpecFB768[%d]",c), Form("fPtSpecFB768[%d]",c), 24, xmin);
518  fSpectraMCList->Add(fPtSpecFB768[c]);
519  }
520 
521  fAnalysisUtil = new AliAnalysisUtils();
522 
523  for(int i=0; i<5; i++){
524  char hname[20];
525  sprintf(hname,"hZNCPM%d",i);
526  fhZNCPM[i] = new TH1F(hname, hname, 200, -50., 140000);
527  fOutput->Add(fhZNCPM[i]);
528  //
529  sprintf(hname,"hZNAPM%d",i);
530  fhZNAPM[i] = new TH1F(hname, hname, 200, -50., 140000);
531  fOutput->Add(fhZNAPM[i]);
532  //
533  sprintf(hname,"hZPCPM%d",i);
534  fhZPCPM[i] = new TH1F(hname, hname, 200, -50., 50000);
535  fOutput->Add(fhZPCPM[i]);
536  //
537  sprintf(hname,"hZPAPM%d",i);
538  fhZPAPM[i] = new TH1F(hname, hname, 200, -50., 50000);
539  fOutput->Add(fhZPAPM[i]);
540  //
541  sprintf(hname,"hZNCPMlg%d",i);
542  fhZNCPMlg[i] = new TH1F(hname, hname, 200, -50., 140000);
543  fOutput->Add(fhZNCPMlg[i]);
544  //
545  sprintf(hname,"hZNAPMlg%d",i);
546  fhZNAPMlg[i] = new TH1F(hname, hname, 200, -50., 140000);
547  fOutput->Add(fhZNAPMlg[i]);
548  //
549  sprintf(hname,"hZPCPMlg%d",i);
550  fhZPCPMlg[i] = new TH1F(hname, hname, 200, -50., 50000);
551  fOutput->Add(fhZPCPMlg[i]);
552  //
553  sprintf(hname,"hZPAPMlg%d",i);
554  fhZPAPMlg[i] = new TH1F(hname, hname, 200, -50., 50000);
555  fOutput->Add(fhZPAPMlg[i]);
556  //
557  if(i<4){
558  //
559  char hnamenc[20];
560  sprintf(hnamenc, "hZNCPMQ%dPMC",i+1);
561  fhZNCPMQiPMC[i] = new TH1F(hnamenc, hnamenc, 100, 0., 1.);
562  fOutput->Add(fhZNCPMQiPMC[i]);
563  //
564  char hnamena[20];
565  sprintf(hnamena, "hZNAPMQ%dPMC",i+1);
566  fhZNAPMQiPMC[i] = new TH1F(hnamena, hnamena, 100, 0., 1.);
567  fOutput->Add(fhZNAPMQiPMC[i]);
568  //
569  char hnamepc[20];
570  sprintf(hnamepc, "hZPCPMQ%dPMC",i+1);
571  fhZPCPMQiPMC[i] = new TH1F(hnamepc, hnamepc, 100, 0., 1.);
572  fOutput->Add(fhZPCPMQiPMC[i]);
573  //
574  char hnamepa[20];
575  sprintf(hnamepa, "hZPAPMQ%dPMC",i+1);
576  fhZPAPMQiPMC[i] = new TH1F(hnamepa, hnamepa, 100, 0., 1.);
577  fOutput->Add(fhZPAPMQiPMC[i]);
578  }
579  }
580  for(int i=0; i<6; i++){
581  if(i==0){
582  fhZEM[i] = new TH1F("hZEM1","hZEM1",200,-10.,1190.);
583  fhTDCraw[i] = new TH1F("hTDCZEM1raw", "hTDCZEM1raw", 200, -200., 0.);
584  fhTDC[i] = new TH1F("hTDCZEM1", "hTDCZEM1", 200, -150., 50.);
585  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZNC","hPMCvsPMQZNC",200,-10.,140000,200,-10.,140000);
586  //
587  fOutput->Add(fhZEM[i]);
588  fOutput->Add(fhPMCvsPMQ[i]);
589  }
590  else if(i==1){
591  fhZEM[i] = new TH1F("hZEM2","hZEM2",200,-10.,1190.);
592  fhTDCraw[i] = new TH1F("hTDCZEM2raw", "hTDCZEM2raw", 200, -200., 0.);
593  fhTDC[i] = new TH1F("hTDCZEM2", "hTDCZEM2", 200, -150., 50.);
594  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZPC","hPMCvsPMQZPC",200,-10.,50000,200,-10.,50000);
595  //
596  fOutput->Add(fhZEM[i]);
597  fOutput->Add(fhPMCvsPMQ[i]);
598  }
599  else if(i==2){
600  fhTDCraw[i] = new TH1F("hTDCZNCraw", "hTDCZNCraw", 200, -200., 0.);
601  fhTDC[i] = new TH1F("hTDCZNC", "hTDCZNC", 200, -150., 50.);
602  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZNA","hPMCvsPMQZNA",200,-10.,140000,200,-10.,140000);
603  //
604  fOutput->Add(fhPMCvsPMQ[i]);
605  }
606  else if(i==3){
607  fhTDCraw[i] = new TH1F("hTDCZPCraw", "hTDCZPCraw", 200, -200., 0.);
608  fhTDC[i] = new TH1F("hTDCZPC", "hTDCZPC", 200, -150., 50.);
609  fhPMCvsPMQ[i] = new TH2F("hPMCvsPMQZPA","hPMCvsPMQZPA",200,-10.,50000,200,-10.,50000);
610  //
611  fOutput->Add(fhPMCvsPMQ[i]);
612  }
613  else if(i==4){
614  fhTDCraw[i] = new TH1F("hTDCZNAraw", "hTDCZNAraw", 200, -200., 0.);
615  fhTDC[i] = new TH1F("hTDCZNA", "hTDCZNA", 200, -150., 50.);
616  }
617  else if(i==5){
618  fhTDCraw[i] = new TH1F("hTDCZPAraw", "hTDCZPAraw", 200, -200., 0.);
619  fhTDC[i] = new TH1F("hTDCZPA", "hTDCZPA", 200, -150., 50.);
620  }
621  //
622  fOutput->Add(fhTDC[i]);
623  }
624 
625  fhZNCvsZNA = new TH2F("hZNCvsZNA","hZNCvsZNA",200,-50.,140000,200,-50.,140000);
626  fOutput->Add(fhZNCvsZNA);
627  fhZPCvsZPA = new TH2F("hZPCvsZPA","hZPCvsZPA",200,-50.,50000,200,-50.,50000);
628  fOutput->Add(fhZPCvsZPA);
629  fhZDCCvsZDCCA = new TH2F("hZDCCvsZDCCA","hZDCCvsZDCCA",200,0.,180000.,200,0.,200000.);
630  fOutput->Add(fhZDCCvsZDCCA);
631  fhZNCvsZPC = new TH2F("hZNCvsZPC","hZNCvsZPC",200,-50.,50000,200,-50.,140000);
632  fOutput->Add(fhZNCvsZPC);
633  fhZNAvsZPA = new TH2F("hZNAvsZPA","hZNAvsZPA",200,-50.,50000,200,-50.,140000);
634  fOutput->Add(fhZNAvsZPA);
635  fhZNvsZP = new TH2F("hZNvsZP","hZNvsZP",200,-50.,80000,200,-50.,200000);
636  fOutput->Add(fhZNvsZP);
637  fhZNvsVZERO = new TH2F("hZNvsVZERO","hZNvsVZERO",250,0.,25000.,200,0.,200000.);
638  fOutput->Add(fhZNvsVZERO);
639  fhZDCvsVZERO = new TH2F("hZDCvsVZERO","hZDCvsVZERO",250,0.,25000.,250,0.,250000.);
640  fOutput->Add(fhZDCvsVZERO);
641  fhZDCvsTracklets = new TH2F("hZDCvsTracklets","hZDCvsTracklets",200,0.,4000.,250,0.,250000.);
643  fhZDCvsNclu1 = new TH2F("hZDCvsNclu1", "hZDCvsNclu1", 200, 0.,8000.,200,0.,250000.);
644  fOutput->Add(fhZDCvsNclu1);
645  fhDebunch = new TH2F("hDebunch","hDebunch",240,-100.,-40.,240,-30.,30.);
646  fOutput->Add(fhDebunch);
647  fhZNCcentroid = new TH2F("hZNCcentroid","hZNCcentroid",100,-3.5,3.5,100,-3.5,3.5);
648  fOutput->Add(fhZNCcentroid);
649  fhZNAcentroid = new TH2F("hZNAcentroid","hZNAcentroid",100,-3.5,3.5,100,-3.5,3.5);
650  fOutput->Add(fhZNAcentroid);
651 
652  fhAsymm = new TH1F("hAsymm" , "Asimmetry ",200,-1.,1.);
653  fOutput->Add(fhAsymm);
654  fhZNAvsAsymm = new TH2F("hZNAvsAsymm","ZNA vs. asymm.",200,-1.,1.,200,0.,80.);
655  fOutput->Add(fhZNAvsAsymm);
656  fhZNCvsAsymm = new TH2F("hZNCvsAsymm","ZNC vs. asymm.",200,-1.,1.,200,0.,80.);
657  fOutput->Add(fhZNCvsAsymm);
658 
659  fhZNCvscentrality = new TH2F("hZNCvscentrality","ZNC vs. centrality",100,0.,100.,100,0.,100.);
661  fhZNAvscentrality = new TH2F("hZNAvscentrality","ZNA vs. centrality",100,0.,100.,100,0.,100.);
663  fhZPCvscentrality = new TH2F("hZPCvscentrality","ZPC vs. centrality",100,0.,100.,100,0.,100.);
665  fhZPAvscentrality = new TH2F("hZPAvscentrality","ZPA vs. centrality",100,0.,100.,100,0.,100.);
667 
668  fhZNCpmcvscentr = new TH2F("hZNCpmcvscentr","ZNC PMC vs. centrality",100,0.,100.,100,0.,100.);
669  fOutput->Add(fhZNCpmcvscentr);
670  fhZNApmcvscentr = new TH2F("hZNApmcvscentr","ZNA PMC vs. centrality",100,0.,100.,100,0.,100.);
671  fOutput->Add(fhZNApmcvscentr);
672  fhZPCpmcvscentr = new TH2F("hZPCpmcvscentr","ZPC PMC vs. centrality",100,0.,100.,100,0.,100.);
673  fOutput->Add(fhZPCpmcvscentr);
674  fhZPApmcvscentr = new TH2F("hZPApmcvscentr","ZPA PMC vs. centrality",100,0.,100.,100,0.,100.);
675  fOutput->Add(fhZPApmcvscentr);
676 
677  fhZNCpmcLR = new TH1F("hZNCpmcLR","ZNC PMC lr", 100, 0., 10.);
678  fOutput->Add(fhZNCpmcLR);
679  fhZNApmcLR = new TH1F("hZNApmcLR","ZNA PMC lr", 100, 0., 10.);
680  fOutput->Add(fhZNApmcLR);
681  fhZPCpmcLR = new TH1F("hZPCpmcLR","ZPC PMC lr", 100, 0., 10.);
682  fOutput->Add(fhZPCpmcLR);
683  fhZPApmcLR = new TH1F("hZPApmcLR","ZPA PMC lr", 100, 0., 10.);
684  fOutput->Add(fhZPApmcLR);
685 
686  //********************************************************************
687 
688  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};
689 
690  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};
691 
692  // 12 low IR: 244917, 244918, 244975, 244980, 244982, 244983, 245064, 245066, 245068, 246390, 246391, 246392
693  // 80 high IR ("CentralBarrelTracking" good runs): 246994, 246991, 246989, 246984, 246982, 246980, 246948, 246945, 246928, 246871, 246870, 246867, 246865, 246864, 246859, 246858, 246851, 246847, 246846, 246845, 246844, 246810, 246809, 246808, 246807, 246805, 246804, 246766, 246765, 246763, 246760, 246759, 246758, 246757, 246751, 246750, 246676, 246675, 246540, 246495, 246493, 246488, 246487, 246434, 246431, 246428, 246424, 246276, 246275, 246272, 246271, 246225, 246222, 246217, 246185, 246182, 246181, 246180, 246178, 246153, 246152, 246151, 246115, 246113, 246089, 246087, 246053, 246052, 246049, 246048, 246042, 246037, 246036, 246012, 246003, 246001, 245954, 245952, 245949, 245923, 245833, 245831, 245829, 245705, 245702, 245700, 245692, 245683
694 
695  Int_t dRun15h[] = {244917, 244918, 244975, 244980, 244982, 244983, 245064, 245066, 245068, 246390, 246391, 246392, 246994, 246991, 246989, 246984, 246982, 246980, 246948, 246945, 246928, 246851, 246847, 246846, 246845, 246844, 246810, 246809, 246808, 246807, 246805, 246804, 246766, 246765, 246763, 246760, 246759, 246758, 246757, 246751, 246750, 246676, 246675, 246495, 246493, 246488, 246487, 246434, 246431, 246428, 246424, 246276, 246275, 246272, 246271, 246225, 246222, 246217, 246185, 246182, 246181, 246180, 246178, 246153, 246152, 246151, 246115, 246113, 246089, 246087, 246053, 246052, 246049, 246048, 246042, 246037, 246036, 246012, 246003, 246001, 245954, 245952, 245949, 245923, 245833, 245831, 245829, 245705, 245702, 245700, 245692, 245683};
696 
697  if(fDataSet==k2010) {fCRCnRun=92;}
698  if(fDataSet==k2011) {fCRCnRun=119;}
699  if(fDataSet==k2015) {fCRCnRun=92;}
700  if(fDataSet==kAny) {fCRCnRun=1;}
701 
702  Int_t d=0;
703  for(Int_t r=0; r<fCRCnRun; r++) {
704  if(fDataSet==k2010) fRunList[d] = dRun10h[r];
705  if(fDataSet==k2011) fRunList[d] = dRun11h[r];
706  if(fDataSet==k2015) fRunList[d] = dRun15h[r];
707  if(fDataSet==kAny) fRunList[d] = 1;
708  d++;
709  }
710 
711 // for(Int_t k=0;k<fCRCnTow;k++) {
712 // fhnTowerGain[k] = new TProfile(Form("fhnTowerGain[%d]",k),
713 // Form("fhnTowerGain[%d]",k),100,0.,100.,"s");
714 // fhnTowerGain[k]->Sumw2();
715 // fOutput->Add(fhnTowerGain[k]);
716 // }
717 // for(Int_t k=0;k<fCRCnTow;k++) {
718 // for(Int_t i=0;i<fnCen;i++) {
719 // fhnTowerGainVtx[i][k] = new TProfile3D(Form("fhnTowerGainVtx[%d][%d]",i,k),
720 // Form("fhnTowerGainVtx[%d][%d]",i,k),20,-0.035,0.015,20,0.145,0.220,10,-10.,10.,"s");
721 // fhnTowerGainVtx[i][k]->Sumw2();
722 // fOutput->Add(fhnTowerGainVtx[i][k]);
723 // }
724 // }
725 
726  Double_t ptmin[] = {0.2,0.4,0.6,0.8,1.,1.2,1.4,1.8,2.2,3.,4.,6.,8.,12.,20.};
727  Double_t phimin[] = {0.,TMath::Pi()/8.,2*TMath::Pi()/8.,3*TMath::Pi()/8.,4*TMath::Pi()/8.,5*TMath::Pi()/8.,6*TMath::Pi()/8.,7*TMath::Pi()/8.,8*TMath::Pi()/8.,9*TMath::Pi()/8.,10*TMath::Pi()/8.,11*TMath::Pi()/8.,12*TMath::Pi()/8.,13*TMath::Pi()/8.,14*TMath::Pi()/8.,15*TMath::Pi()/8.,16*TMath::Pi()/8.};
728  Double_t etamin[] = {-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1,0.,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8};
729  for(Int_t r=0;r<fCRCnRun;r++) {
730  fCRCQVecListRun[r] = new TList();
731  fCRCQVecListRun[r]->SetName(Form("Run %d",fRunList[r]));
732  fCRCQVecListRun[r]->SetOwner(kTRUE);
733  fOutput->Add(fCRCQVecListRun[r]);
734 
735  for(Int_t i=0;i<5;i++) {
736  fZNCTower[r][i] = new TProfile(Form("fZNCTower[%d][%d]",r,i),Form("fZNCTower[%d][%d]",r,i),100,0.,100.);
737  fCRCQVecListRun[r]->Add(fZNCTower[r][i]);
738  fZNATower[r][i] = new TProfile(Form("fZNATower[%d][%d]",r,i),Form("fZNATower[%d][%d]",r,i),100,0.,100.);
739  fCRCQVecListRun[r]->Add(fZNATower[r][i]);
740  }
741  }
742 
743  PostData(2, fOutput);
744 }
745 
746 //________________________________________________________________________
748 {
749  // Execute analysis for current event:
750  AliMCEvent* McEvent = MCEvent();
751  AliAODEvent *aod = dynamic_cast<AliAODEvent*>(InputEvent());
752  AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
753 // AliMultiplicity* myTracklets = NULL;
754 // AliESDPmdTrack* pmdtracks = NULL;
755 // int availableINslot=1;
756 
757  if (!(fCutsRP&&fCutsPOI&&fCutsEvent)) {
758  AliError("cuts not set");
759  return;
760  }
761 
762  Int_t RunBin=-1, bin=0;
763  Int_t RunNum = aod->GetRunNumber();
764  for(Int_t c=0;c<fCRCnRun;c++) {
765  if(fRunList[c]==RunNum) RunBin=bin;
766  else bin++;
767  }
768  if(fDataSet==kAny) RunBin=0;
769 
770  //DEFAULT - automatically takes care of everything
771  if (fAnalysisType == "AUTOMATIC") {
772 
773  // get centrality
774  Float_t centr=300, centrCL1=300;
775  if(fDataSet!=k2015) {
776  centr = fCutsEvent->GetCentrality(InputEvent(),McEvent);
777  } else {
778  fMultSelection = (AliMultSelection*) InputEvent()->FindListObject("MultSelection");
779  if(!fMultSelection) {
780  //If you get this warning (and lPercentiles 300) please check that the AliMultSelectionTask actually ran (before your task)
781  AliWarning("AliMultSelection object not found!");
782  }else{
783  centr = fMultSelection->GetMultiplicityPercentile("V0M");
784  centrCL1 = fMultSelection->GetMultiplicityPercentile("CL1");
785  }
786  }
787 
788  //check event cuts
789  if (InputEvent()) {
790  if(!fCutsEvent->IsSelected(InputEvent(),MCEvent())) return;
791  if(fRejectPileUp) {
792  if(fDataSet!=k2015) {
793  if (fAnalysisUtil->IsPileUpEvent(InputEvent())) return;
794  } else {
795  // pile-up a la Dobrin for LHC15o
796  if (plpMV(aod)) return;
797 
798  Short_t isPileup = aod->IsPileupFromSPD(3);
799  if (isPileup != 0) return;
800 
801  if (((AliAODHeader*)aod->GetHeader())->GetRefMultiplicityComb08() < 0) return;
802 
803  if (aod->IsIncompleteDAQ()) return;
804 
805  if(fabs(centr-centrCL1)>7.5) return;
806  }
807  }
808  }
809 
810  //first attach all possible information to the cuts
811  fCutsRP->SetEvent( InputEvent(), MCEvent() ); //attach event
812  fCutsPOI->SetEvent( InputEvent(), MCEvent() );
813 
814  //then make the event
816 
818  fFlowEvent->SetCentrality(centr);
819  fFlowEvent->SetCentralityCL1(((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL1"));
820  fFlowEvent->SetCentralityTRK(((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("TRK"));
821  fFlowEvent->SetNITSCL1(((AliVAODHeader*)aod->GetHeader())->GetNumberOfITSClusters(1));
822 
823  Double_t vtxpos[3]={0.,0.,0.};
824  vtxpos[0] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetX();
825  vtxpos[1] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetY();
826  vtxpos[2] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetZ();
827  fFlowEvent->SetVertexPosition(vtxpos);
828 
829  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
830 
831  // run-by-run QA
832  centr = fFlowEvent->GetCentrality();
833  Int_t CenBin = -1;
834  CenBin = GetCenBin(centr);
835  if(CenBin==-1) return;
836 
837 // for(Int_t jTracks = 0; jTracks<aod->GetNumberOfTracks(); jTracks++){
838 // AliAODTrack* track = (AliAODTrack*)aod->GetTrack(jTracks);
839 // if(!track) continue;
840 // // general kinematic & quality cuts
841 // if (track->Pt() < .2 || track->Pt() > 20. || TMath::Abs(track->Eta()) > .8 || track->GetTPCNcls() < 70) continue;
842 // if (track->TestFilterBit(128)) fPtPhiEtaRbRFB128[RunBin][CenBin]->Fill(track->Pt(),track->Phi(),track->Eta());
843 // if (track->TestFilterBit(768)) fPtPhiEtaRbRFB768[RunBin][CenBin]->Fill(track->Pt(),track->Phi(),track->Eta());
844 // }
845 
846  }
847 
848  if (fAnalysisType == "MCAOD") {
849 
850  //check event cuts
851  if (InputEvent()) {
852  if(!fCutsEvent->IsSelected(InputEvent(),MCEvent())) return;
853  if(fRejectPileUp && fAnalysisUtil->IsPileUpEvent(InputEvent())) return;
854  }
855 
857 
858  if(!McEvent) {
859  AliError("ERROR: Could not retrieve MCEvent");
860  return;
861  }
862  fStack = (TClonesArray*)aod->FindListObject(AliAODMCParticle::StdBranchName());
863  if(!fStack){
864  AliError("ERROR: Could not retrieve MCStack");
865  return;
866  }
867 
868  // get centrality (from AliMultSelection or AliCentrality)
869  Float_t centr = 300;
870  if(fDataSet==k2015) {
871  fMultSelection = (AliMultSelection*)aod->FindListObject("MultSelection");
872  if(!fMultSelection) {
873  //If you get this warning (and lPercentiles 300) please check that the AliMultSelectionTask actually ran (before your task)
874  AliWarning("AliMultSelection object not found!");
875  } else {
876  centr = fMultSelection->GetMultiplicityPercentile("V0M");
877  }
878  } else {
879  centr = (((AliVAODHeader*)aod->GetHeader())->GetCentralityP())->GetCentralityPercentile("V0M");
880  }
881  // centrality bin
882  if (centr<fCentrLowLim || centr>=fCentrUpLim ) return;
883  Int_t CenBin = -1;
884  CenBin = GetCenBin(centr);
885  if(CenBin==-1) return;
886 
887  // reconstructed
888  for(Int_t jTracks = 0; jTracks<aod->GetNumberOfTracks(); jTracks++){
889 
890  AliAODTrack* track = (AliAODTrack*)aod->GetTrack(jTracks);
891  if(!track) continue;
892 
893  // select primaries
894  Int_t lp = TMath::Abs(track->GetLabel());
895  if (!((AliAODMCParticle*)fStack->At(lp))->IsPhysicalPrimary()) continue;
896 
897  // general kinematic & quality cuts
898  if (track->Pt() < .2 || track->Pt() > 8. || TMath::Abs(track->Eta()) > .8 || track->GetTPCNcls() < 70) continue;
899 
900  // test filter bits
901  if (track->TestFilterBit(32)) fPtSpecFB32[CenBin]->Fill(track->Pt());
902  if (track->TestFilterBit(96)) fPtSpecFB96[CenBin]->Fill(track->Pt());
903  if (track->TestFilterBit(128)) fPtSpecFB128[CenBin]->Fill(track->Pt());
904  if (track->TestFilterBit(768)) fPtSpecFB768[CenBin]->Fill(track->Pt());
905  }
906 
907  // generated (physical primaries)xw
908 
909  for(Int_t jTracks = 0; jTracks<fStack->GetEntriesFast(); jTracks++) {
910  AliAODMCParticle *MCpart = (AliAODMCParticle*)fStack->At(jTracks);
911  if (!MCpart) {
912  printf("ERROR: Could not receive MC track %d\n", jTracks);
913  continue;
914  }
915  // kinematic cuts
916  if ( MCpart->Pt() < 0.2 || MCpart->Pt() > 8. || TMath::Abs(MCpart->Eta()) > .8 ) continue;
917  // select charged primaries
918  if ( MCpart->Charge() == 0. || !MCpart->IsPhysicalPrimary()) continue;
919 
920  fPtSpecGen[CenBin]->Fill(MCpart->Pt());
921  }
922 
923 // fGenHeader = McEvent->GenEventHeader();
924 // if(fGenHeader) fPythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(fGenHeader);
925  // printf("#reconstructed : %d (rejected from cuts %d), #MC primaries : %d (rejected from cuts %d) \n",AODPOIs,AODbads,MCPrims,MCSecos);
926  fFlowEvent->SetReferenceMultiplicity(aod->GetNumberOfTracks());
927  fFlowEvent->SetCentrality(centr);
928 // if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
929  fFlowEvent->SetRun(RunNum);
930  // printf("Run : %d, RefMult : %d, Cent : %f \n",fFlowEvent->GetRun(),fFlowEvent->GetReferenceMultiplicity(),fFlowEvent->GetCentrality());
931  }
932 
933  if(fAnalysisType == "MCESD") {
934 
936 
937  if(!esd) {
938  AliError("ERROR: Could not retrieve ESDEvent");
939  return;
940  }
941  if(!McEvent) {
942  AliError("ERROR: Could not retrieve MCEvent");
943  return;
944  }
945  AliStack* fStack = fMCEvent->Stack();
946  if(!fStack) {
947  AliError("ERROR: Could not retrieve MCStack");
948  return;
949  }
950 
951  AliESDVertex *vertex = (AliESDVertex*) esd->GetPrimaryVertex();
952  if (!vertex) return;
953  if (TMath::Abs(vertex->GetZ()) > 10. ) return;
954  if (vertex->GetNContributors() < 1 ) return;
955  AliCentrality *centrality = esd->GetCentrality();
956  if (!centrality) return;
957  Double_t centr = centrality->GetCentralityPercentile("V0M");
958  if (centr<fCentrLowLim || centr>=fCentrUpLim ) return;
959  Int_t CenBin = -1;
960  if (centr>0. && centr<5.) CenBin=0;
961  if (centr>5. && centr<10.) CenBin=1;
962  if (centr>10. && centr<20.) CenBin=2;
963  if (centr>20. && centr<30.) CenBin=3;
964  if (centr>30. && centr<40.) CenBin=4;
965  if (centr>40. && centr<50.) CenBin=5;
966  if (centr>50. && centr<60.) CenBin=6;
967  if (centr>60. && centr<70.) CenBin=7;
968  if (centr>70. && centr<80.) CenBin=8;
969  if (centr>80. && centr<90.) CenBin=9;
970  if(CenBin==-1) return;
971 
972  //Generated
973  Int_t MCPrims = 0;
974  for ( Int_t i=0 ; i<fStack->GetNtrack() ; i++ ) {
975 
976  //Primaries Selection
977  TParticle *particle = (TParticle*)fStack->Particle(i);
978  if (!particle) continue;
979  if (!fStack->IsPhysicalPrimary(i)) continue;
980  if ( particle->GetPDG()->Charge() == 0.) continue;
981 
982  //Kinematic Cuts
983  if ( particle->Pt()<0.2 || particle->Pt()>10. ) continue;
984  if ( TMath::Abs(particle->Eta())>0.8 ) continue;
985 
986  fFlowTrack->SetPhi(particle->Phi());
987  fFlowTrack->SetEta(particle->Eta());
988  fFlowTrack->SetPt(particle->Pt());
994  MCPrims++;
995 
996  fPtSpecGen[CenBin]->Fill(particle->Pt());
997 
998  }
999 
1000  //Reconstructed
1001  Int_t ESDPrims = 0;
1002  for (Int_t i=0 ; i<esd->GetNumberOfTracks() ; i++) {
1003 
1004  //Get reconstructed track
1005  AliVTrack *vtrack = static_cast<AliVTrack*>(esd->GetTrack(i));
1006  AliESDtrack *track = dynamic_cast<AliESDtrack*>(vtrack);
1007  if (!track) continue;
1008 
1009  //Primaries selection
1010  Int_t lp = TMath::Abs(track->GetLabel());
1011  if (!fStack->IsPhysicalPrimary(lp)) continue;
1012  TParticle *particle = (TParticle*)fStack->Particle(lp);
1013  if (!particle) continue;
1014  if (particle->GetPDG()->Charge() == 0.) continue;
1015 
1016 // if(!fCutsPOI->PassesESDcuts(track)) continue;
1017 
1018  Bool_t pass = kTRUE;
1019 
1020  if(fCutTPC) {
1021 // printf("******* cutting TPC ******** \n");
1022  UShort_t ntpccls = track->GetTPCNcls();
1023  Double_t tpcchi2 = track->GetTPCchi2();
1024  if (tpcchi2<0.2 || tpcchi2 >=4.) {
1025 // printf("TPCchi2 : %e %e ",tpcchi2,track->GetTPCchi2Iter1());
1026  pass=kFALSE;
1027  }
1028  if (ntpccls < 70) {
1029 // printf("#TPCcluster : %u %u %u %u ",ntpccls,track->GetTPCNclsF(),track->GetTPCNclsFIter1(),track->GetTPCNclsIter1());
1030  pass=kFALSE;
1031  }
1032  }
1033 
1034  Float_t dcaxy=0.0;
1035  Float_t dcaz=0.0;
1036  track->GetImpactParameters(dcaxy,dcaz);
1037  if (dcaxy > 0.3 || dcaz > 0.3) {
1038 // printf("DCA : %e %e ",dcaxy,dcaz);
1039  pass=kFALSE;
1040  }
1041  if(!pass) continue;
1042 
1043  //Kinematic Cuts
1044  if ( track->Pt()<0.2 || track->Pt()>10. ) continue;
1045  if ( TMath::Abs(track->Eta())>0.8 ) continue;
1046 
1047  fFlowTrack->SetPhi(track->Phi());
1048  fFlowTrack->SetEta(track->Eta());
1049  fFlowTrack->SetPt(track->Pt());
1051  fFlowTrack->SetForRPSelection(kFALSE);
1055  ESDPrims++;
1056 
1057  }
1058 
1059 // printf("#reconstructed : %d , #MC primaries : %d \n",ESDPrims,MCPrims);
1060  fFlowEvent->SetReferenceMultiplicity(esd->GetNumberOfTracks());
1061  fFlowEvent->SetCentrality(centr);
1062  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
1063  fFlowEvent->SetRun(esd->GetRunNumber());
1064 // printf("Run : %d, RefMult : %d, Cent : %f \n",fFlowEvent->GetRun(),fFlowEvent->GetReferenceMultiplicity(),fFlowEvent->GetCentrality());
1065 
1066  } // end of if(fAnalysisType == "MCESD")
1067 
1068  if(fAnalysisType == "MCkine") {
1069 
1070  fFlowEvent->ClearFast();
1071 
1072  AliInputEventHandler* McHandler = dynamic_cast<AliInputEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
1073  if(!McHandler) {
1074  AliError("ERROR: Could not retrieve MCtruthEventHandler");
1075  return;
1076  }
1077  McEvent = McHandler->MCEvent();
1078  if(!McEvent) {
1079  AliError("ERROR: Could not retrieve MC event");
1080  return;
1081  }
1082 
1083  Int_t nTracks = McEvent->GetNumberOfTracks();
1084 // Int_t nPrimTr = McEvent->GetNumberOfPrimaries();
1085 
1086  //loop over tracks
1087  for (Int_t itrkN=0; itrkN<nTracks; itrkN++) {
1088  //get input particle
1089  AliMCParticle* pParticle = dynamic_cast<AliMCParticle*>(McEvent->GetTrack(itrkN));
1090  if (!pParticle) continue;
1091 
1092  //check if track passes the cuts
1093  if (McEvent->IsPhysicalPrimary(itrkN) && pParticle->Charge()!=0) {
1094  fFlowTrack->Set(pParticle);
1096  fFlowTrack->SetForRPSelection(kTRUE);
1101  }
1102  }// for all tracks
1103 
1104  // if monte carlo event get reaction plane from monte carlo (depends on generator)
1105  if (McEvent && McEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(McEvent);
1106  // set reference multiplicity
1107  fFlowEvent->SetReferenceMultiplicity(McEvent->GetNumberOfTracks());
1108  // tag subevents
1110  // set centrality from impact parameter
1111  Double_t ImpPar=0., CenPer=0.;
1112  fGenHeader = McEvent->GenEventHeader();
1113  if(fGenHeader){
1114  fPythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(fGenHeader);
1115  if(fPythiaGenHeader) ImpPar = fPythiaGenHeader->GetImpactParameter();
1116  fHijingGenHeader = dynamic_cast<AliGenHijingEventHeader*>(fGenHeader);
1117  if(fHijingGenHeader) ImpPar = fHijingGenHeader->ImpactParameter();
1118  if(ImpPar) CenPer = 0.3859796743103508*pow(ImpPar,2.);
1119  if(CenPer>0. && CenPer<100.) fFlowEvent->SetCentrality(CenPer);
1120  else return;
1121  fFlowEvent->SetRun(1);
1122  }
1123 
1124  } // end of if(fAnalysisType == "MCkine")
1125 
1126  if (!fFlowEvent) return; //shuts up coverity
1127 
1128  //check final event cuts
1129  Int_t mult = fFlowEvent->NumberOfTracks();
1130  // AliInfo(Form("FlowEvent has %i tracks",mult));
1131  if (mult<fMinMult || mult>fMaxMult) {
1132  AliWarning("FlowEvent cut on multiplicity"); return;
1133  }
1134 
1135  //define dead zone
1137 
1140  if (fAfterburnerOn)
1141  {
1142  //if reaction plane not set from elsewhere randomize it before adding flow
1144  fFlowEvent->SetMCReactionPlaneAngle(gRandom->Uniform(0.0,TMath::TwoPi()));
1145 
1146  if(fDifferentialV2)
1148  else
1149  fFlowEvent->AddFlow(fV1,fV2,fV3,fV4,fV5); //add flow
1150  fFlowEvent->CloneTracks(fNonFlowNumberOfTrackClones); //add nonflow by cloning tracks
1151  }
1153 
1154  //tag subEvents
1156 
1157  //do we want to serve shullfed tracks to everybody?
1159 
1160  // associate the mother particles to their daughters in the flow event (if any)
1162 
1163  //fListHistos->Print();
1164  //fOutputFile->WriteObject(fFlowEvent,"myFlowEventSimple");
1165 
1166  //********************************************************************************************************************************
1167 
1168  if(fAnalysisType == "AOD" || fAnalysisType == "AUTOMATIC") {
1169 
1170  // PHYSICS SELECTION
1171  AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
1172  AliInputEventHandler *hdr = (AliInputEventHandler*)am->GetInputEventHandler();
1173 
1174  if(hdr->IsEventSelected() && AliVEvent::kAny) {
1175 
1176  Float_t centrperc = fFlowEvent->GetCentrality();
1177 
1178  AliAODTracklets *trackl = aod->GetTracklets();
1179  Int_t nTracklets = trackl->GetNumberOfTracklets();
1180 
1181  AliAODVZERO *vzeroAOD = aod->GetVZEROData();
1182  Float_t multV0A = vzeroAOD->GetMTotV0A();
1183  Float_t multV0C = vzeroAOD->GetMTotV0C();
1184 
1185  AliAODZDC *aodZDC = aod->GetZDCData();
1186 
1187  Float_t energyZNC = (Float_t) (aodZDC->GetZNCEnergy());
1188  Float_t energyZPC = (Float_t) (aodZDC->GetZPCEnergy());
1189  Float_t energyZNA = (Float_t) (aodZDC->GetZNAEnergy());
1190  Float_t energyZPA = (Float_t) (aodZDC->GetZPAEnergy());
1191  Float_t energyZEM1 = (Float_t) (aodZDC->GetZEM1Energy());
1192  Float_t energyZEM2 = (Float_t) (aodZDC->GetZEM2Energy());
1193 
1194  const Double_t * towZNC = aodZDC->GetZNCTowerEnergy();
1195  const Double_t * towZPC = aodZDC->GetZPCTowerEnergy();
1196  const Double_t * towZNA = aodZDC->GetZNATowerEnergy();
1197  const Double_t * towZPA = aodZDC->GetZPATowerEnergy();
1198  //
1199  const Double_t * towZNClg = aodZDC->GetZNCTowerEnergyLR();
1200  const Double_t * towZNAlg = aodZDC->GetZNATowerEnergyLR();
1201  //
1202  Double_t towZPClg[5], towZPAlg[5]={0.};
1203  for(Int_t it=0; it<5; it++){
1204  towZPClg[it] = 8*towZPC[it];
1205  towZPAlg[it] = 8*towZNA[it];
1206  }
1207 
1208  // Get centroid from ZDCs *******************************************************
1209 
1210  Double_t Enucl = (RunNum < 209122 ? 1380. : 2510.);
1211  Double_t xyZNC[2]={999.,999.}, xyZNA[2]={999.,999.};
1212  Float_t zncEnergy=0., znaEnergy=0.;
1213  for(Int_t i=0; i<5; i++){
1214  zncEnergy += towZNC[i];
1215  znaEnergy += towZNA[i];
1216  if(fZNCTower[RunBin][i]) fZNCTower[RunBin][i]->Fill(centrperc,towZNC[i]/1000.);
1217  if(fZNATower[RunBin][i]) fZNATower[RunBin][i]->Fill(centrperc,towZNA[i]/1000.);
1218  }
1219  fFlowEvent->SetZNCEnergy(towZNC[0]);
1220  fFlowEvent->SetZNAEnergy(towZNA[0]);
1221 
1222  Int_t CenBin = GetCenBin(centrperc);
1223  if(CenBin==-1) return;
1224  Double_t zvtxpos[3]={0.,0.,0.};
1225  fFlowEvent->GetVertexPosition(zvtxpos);
1226 
1227  Int_t RunNum=fFlowEvent->GetRun();
1228 // if(fTowerEqList) {
1229 // if(RunNum!=fCachedRunNum) {
1230 // for(Int_t c=0; c<fnCen; c++) {
1231 // for(Int_t i=0; i<8; i++) {
1232 // fTowerGainEq[c][i] = (TH3D*)(fTowerEqList->FindObject(Form("fhnTowerGainEqFactor[%d][%d]",c,i)));
1233 // }
1234 // }
1235 // }
1236 // }
1237  Double_t AvTowerGain[8] = {1., 1., 1., 1., 1., 1., 1., 1.};
1238 
1239  if (fUseMCCen) {
1240  aodZDC->GetZNCentroidInPbPb(Enucl, xyZNC, xyZNA);
1241  } else {
1242  // set tower gain equalization, if available
1243 // if(fTowerEqList) {
1244 // for(Int_t i=0; i<8; i++) {
1245 // if(fTowerGainEq[CenBin][i]) AvTowerGain[i] = fTowerGainEq[CenBin][i]->GetBinContent(fTowerGainEq[CenBin][i]->FindBin(zvtxpos[0],zvtxpos[1],zvtxpos[2]));
1246 // }
1247 // }
1248  const Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
1249  const Float_t y[4] = {-1.75, -1.75, 1.75, 1.75};
1250  Float_t numXZNC=0., numYZNC=0., denZNC=0., wZNC;
1251  Float_t numXZNA=0., numYZNA=0., denZNA=0., wZNA;
1252  for(Int_t i=0; i<4; i++) {
1253  if(towZNC[i+1]>0.) {
1254  wZNC = TMath::Power(towZNC[i+1], fZDCGainAlpha)*AvTowerGain[i];
1255  numXZNC += x[i]*wZNC;
1256  numYZNC += y[i]*wZNC;
1257  denZNC += wZNC;
1258  }
1259  if(towZNA[i+1]>0.) {
1260  wZNA = TMath::Power(towZNA[i+1], fZDCGainAlpha)*AvTowerGain[i+4];
1261  numXZNA += x[i]*wZNA;
1262  numYZNA += y[i]*wZNA;
1263  denZNA += wZNA;
1264  }
1265  }
1266  if(denZNC!=0) {
1267  xyZNC[0] = numXZNC/denZNC;
1268  xyZNC[1] = numYZNC/denZNC;
1269  }
1270  else{
1271  xyZNC[0] = xyZNC[1] = 999.;
1272  zncEnergy = 0.;
1273  }
1274  if(denZNA!=0) {
1275  xyZNA[0] = numXZNA/denZNA;
1276  xyZNA[1] = numYZNA/denZNA;
1277  }
1278  else{
1279  xyZNA[0] = xyZNA[1] = 999.;
1280  znaEnergy = 0.;
1281  }
1282  }
1283 
1284  Float_t MulA=0., MulC=0.;
1285  for(Int_t i=0; i<4; i++) {
1286  if(towZNC[i+1]>0.) {
1287  MulC += TMath::Power(towZNC[i+1], fZDCGainAlpha)*AvTowerGain[i];
1288  }
1289  if(towZNA[i+1]>0.) {
1290  MulA += TMath::Power(towZNA[i+1], fZDCGainAlpha)*AvTowerGain[i+4];
1291  }
1292  }
1293 
1294  fhZNCcentroid->Fill(xyZNC[0], xyZNC[1]);
1295  fhZNAcentroid->Fill(xyZNA[0], xyZNA[1]);
1296  fFlowEvent->SetZDC2Qsub(xyZNC,MulC,xyZNA,MulA);
1297 
1298 // for(Int_t i=0; i<4; i++) {
1299 // if(towZNC[i+1]>0.) {
1300 // fhnTowerGainVtx[CenBin][i]->Fill(zvtxpos[0],zvtxpos[1],zvtxpos[2],TMath::Power(towZNC[i+1], fZDCGainAlpha)*AvTowerGain[i]);
1301 // fhnTowerGain[i]->Fill(centrperc,TMath::Power(towZNC[i+1], fZDCGainAlpha)*AvTowerGain[i]);
1302 // }
1303 // if(towZNA[i+1]>0.) {
1304 // fhnTowerGainVtx[CenBin][i+4]->Fill(zvtxpos[0],zvtxpos[1],zvtxpos[2],TMath::Power(towZNA[i+1], fZDCGainAlpha)*AvTowerGain[i+4]);
1305 // fhnTowerGain[i+4]->Fill(centrperc,TMath::Power(towZNA[i+1], fZDCGainAlpha)*AvTowerGain[i+4]);
1306 // }
1307 // }
1308 
1309  // ******************************************************************************
1310 
1311  Float_t tdcSum = aodZDC->GetZDCTimeSum();
1312  Float_t tdcDiff = aodZDC->GetZDCTimeDiff();
1313  fhDebunch->Fill(tdcDiff, tdcSum);
1314 
1315  for(int i=0; i<5; i++){
1316  fhZNCPM[i]->Fill(towZNC[i]);
1317  fhZNCPMlg[i]->Fill(towZNClg[i]);
1318  if((i<4) && (towZNC[0]>0.)) fhZNCPMQiPMC[i]->Fill(towZNC[i+1]/towZNC[0]);
1319  fhZNCpmcLR->Fill(towZNClg[0]/1000.);
1320  }
1321  fhPMCvsPMQ[0]->Fill(towZNC[1]+towZNC[2]+towZNC[3]+towZNC[4], towZNC[0]);
1322  for(int i=0; i<5; i++){
1323  fhZPCPM[i]->Fill(towZPC[i]);
1324  fhZPCPMlg[i]->Fill(towZPClg[i]);
1325  if(((i<4) && towZPC[0]>0.)) fhZPCPMQiPMC[i]->Fill(towZPC[i+1]/towZPC[0]);
1326  fhZPCpmcLR->Fill(towZPClg[0]/1000.);
1327  }
1328  fhPMCvsPMQ[1]->Fill(towZPC[1]+towZPC[2]+towZPC[3]+towZPC[4], towZPC[0]);
1329  for(int i=0; i<5; i++){
1330  fhZNAPM[i]->Fill(towZNA[i]);
1331  fhZNAPMlg[i]->Fill(towZNAlg[i]);
1332  if(((i<4) && towZNA[0]>0.)) fhZNAPMQiPMC[i]->Fill(towZNA[i+1]/towZNA[0]);
1333  fhZNApmcLR->Fill(towZNAlg[0]/1000.);
1334  }
1335  fhPMCvsPMQ[2]->Fill(towZNA[1]+towZNA[2]+towZNA[3]+towZNA[4], towZNA[0]);
1336  for(int i=0; i<5; i++){
1337  fhZPAPM[i]->Fill(towZPA[i]);
1338  fhZPAPMlg[i]->Fill(towZPAlg[i]);
1339  if(((i<4) && towZPA[0]>0.)) fhZPAPMQiPMC[i]->Fill(towZPA[i+1]/towZPA[0]);
1340  fhZPApmcLR->Fill(towZPAlg[0]/1000.);
1341  }
1342  fhPMCvsPMQ[3]->Fill(towZPA[1]+towZPA[2]+towZPA[3]+towZPA[4], towZPA[0]);
1343  fhZEM[0]->Fill(energyZEM1);
1344  fhZEM[1]->Fill(energyZEM2);
1345 
1346  fhZNCvsZNA->Fill(energyZNA, energyZNC);
1347  fhZPCvsZPA->Fill(energyZPA, energyZPC);
1348  fhZDCCvsZDCCA->Fill(energyZNA+energyZPA, energyZNC+energyZPC);
1349  fhZNCvsZPC->Fill(energyZPC, energyZNC);
1350  fhZNAvsZPA->Fill(energyZPA, energyZNA);
1351  fhZNvsZP->Fill(energyZPA+energyZPC, energyZNA+energyZNC);
1352  fhZNvsVZERO->Fill(multV0A+multV0C, energyZNC+energyZNA);
1353  fhZDCvsVZERO->Fill(multV0A+multV0C, energyZNA+energyZPA+energyZNC+energyZPC);
1354  fhZDCvsTracklets->Fill((Float_t) (nTracklets), energyZNA+energyZPA+energyZNC+energyZPC);
1355 
1356  Double_t asymmetry = -999.;
1357  if((energyZNC+energyZNA)>0.) asymmetry = (energyZNC-energyZNA)/(energyZNC+energyZNA);
1358  fhAsymm->Fill(asymmetry);
1359  fhZNAvsAsymm->Fill(asymmetry, energyZNA/1000.);
1360  fhZNCvsAsymm->Fill(asymmetry, energyZNC/1000.);
1361 
1362  fhZNCvscentrality->Fill(centrperc, energyZNC/1000.);
1363  fhZNAvscentrality->Fill(centrperc, energyZNA/1000.);
1364  fhZPCvscentrality->Fill(centrperc, energyZPC/1000.);
1365  fhZPAvscentrality->Fill(centrperc, energyZPA/1000.);
1366 
1367  fhZNCpmcvscentr->Fill(centrperc, towZNC[0]/1380.);
1368  fhZNApmcvscentr->Fill(centrperc, towZNA[0]/1380.);
1369  fhZPCpmcvscentr->Fill(centrperc, towZPC[0]/1380.);
1370  fhZPApmcvscentr->Fill(centrperc, towZPA[0]/1380.);
1371 
1372  } // PHYSICS SELECTION
1373 
1374  }
1375 
1376  // p) cache run number
1378 
1379 // printf("debug: NoRPs %e, NoPOIs %e, RunNum %d, Cen %e \n",fFlowEvent->GetNumberOfRPs(),fFlowEvent->GetNumberOfPOIs(),fCachedRunNum,fFlowEvent->GetCentrality());
1380 
1381  PostData(1, fFlowEvent);
1382 
1383  PostData(2, fOutput);
1384 }
1385 //________________________________________________________________________
1386 
1388 {
1389  Int_t CenBin=-1;
1390  if (Centrality>0. && Centrality<5.) CenBin=0;
1391  if (Centrality>5. && Centrality<10.) CenBin=1;
1392  if (Centrality>10. && Centrality<20.) CenBin=2;
1393  if (Centrality>20. && Centrality<30.) CenBin=3;
1394  if (Centrality>30. && Centrality<40.) CenBin=4;
1395  if (Centrality>40. && Centrality<50.) CenBin=5;
1396  if (Centrality>50. && Centrality<60.) CenBin=6;
1397  if (Centrality>60. && Centrality<70.) CenBin=7;
1398  if (Centrality>70. && Centrality<80.) CenBin=8;
1399  if (Centrality>80. && Centrality<90.) CenBin=9;
1400  if (CenBin>=fnCen) CenBin=-1;
1401  if (fnCen==1) CenBin=0;
1402  return CenBin;
1403 } // end of AliFlowAnalysisCRC::GetCRCCenBin(Double_t Centrality)
1404 //_____________________________________________________________________________
1405 
1406 Double_t AliAnalysisTaskCRCZDC::GetWDist(const AliVVertex* v0, const AliVVertex* v1)
1407 {
1408  // calculate sqrt of weighted distance to other vertex
1409  if (!v0 || !v1) {
1410  printf("One of vertices is not valid\n");
1411  return 0;
1412  }
1413  static TMatrixDSym vVb(3);
1414  double dist = -1;
1415  double dx = v0->GetX()-v1->GetX();
1416  double dy = v0->GetY()-v1->GetY();
1417  double dz = v0->GetZ()-v1->GetZ();
1418  double cov0[6],cov1[6];
1419  v0->GetCovarianceMatrix(cov0);
1420  v1->GetCovarianceMatrix(cov1);
1421 
1422  vVb(1,1) = cov0[2]+cov1[2];
1423  vVb(2,2) = cov0[5]+cov1[5];
1424  vVb(1,0) = vVb(0,1) = cov0[1]+cov1[1];
1425  vVb(0,2) = vVb(1,2) = vVb(2,0) = vVb(2,1) = 0.;
1426  vVb.InvertFast();
1427  if (!vVb.IsValid()) {printf("Singular Matrix\n"); return dist;}
1428  dist = vVb(0,0)*dx*dx + vVb(1,1)*dy*dy + vVb(2,2)*dz*dz
1429  + 2*vVb(0,1)*dx*dy + 2*vVb(0,2)*dx*dz + 2*vVb(1,2)*dy*dz;
1430  return dist>0 ? TMath::Sqrt(dist) : -1;
1431 
1432 }
1433 //________________________________________________________________________
1434 
1436 {
1437  // check for multi-vertexer pile-up
1438 
1439  const int kMinPlpContrib = 5;
1440  const double kMaxPlpChi2 = 5.0;
1441  const double kMinWDist = 15;
1442 
1443  const AliVVertex* vtPrm = 0;
1444  const AliVVertex* vtPlp = 0;
1445  int nPlp = 0;
1446 
1447  if ( !(nPlp=aod->GetNumberOfPileupVerticesTracks()) ) return kFALSE;
1448  vtPrm = aod->GetPrimaryVertex();
1449  if (vtPrm == aod->GetPrimaryVertexSPD()) return kTRUE; // there are pile-up vertices but no primary
1450 
1451  //int bcPrim = vtPrm->GetBC();
1452 
1453  for (int ipl=0;ipl<nPlp;ipl++) {
1454  vtPlp = (const AliVVertex*)aod->GetPileupVertexTracks(ipl);
1455  //
1456  if (vtPlp->GetNContributors() < kMinPlpContrib) continue;
1457  if (vtPlp->GetChi2perNDF() > kMaxPlpChi2) continue;
1458  // int bcPlp = vtPlp->GetBC();
1459  // if (bcPlp!=AliVTrack::kTOFBCNA && TMath::Abs(bcPlp-bcPrim)>2) return kTRUE; // pile-up from other BC
1460  //
1461  double wDst = GetWDist(vtPrm,vtPlp);
1462  if (wDst<kMinWDist) continue;
1463  //
1464  return kTRUE; // pile-up: well separated vertices
1465  }
1466 
1467  return kFALSE;
1468 }
1469 
1470 //________________________________________________________________________
1472  fCutContainer->AddAt(cutsRP,0); fCutsRP=cutsRP; cutsRP->SetPOItype(0);
1473 }
1474 
1475 //________________________________________________________________________
1477  fCutContainer->AddAt(cutsPOI,1); fCutsPOI=cutsPOI; cutsPOI->SetPOItype(1);
1478 }
1479 
1480 //________________________________________________________________________
1482 {
1483  // Terminate analysis
1484  //
1485  /* if(fDebug > 1) printf(" **** AliAnalysisTaskCRCZDC::Terminate() \n");
1486 
1487  //fOutput = dynamic_cast<TList*> (GetOutputData(1));
1488  //if(!fOutput) printf("ERROR: fOutput not available\n");
1489  */
1490 }
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)
const Color_t cc[]
Definition: DrawKs.C:1
Float_t GetCentrality(AliVEvent *event, AliMCEvent *mcEvent)
double Double_t
Definition: External.C:58
void SetEta(Double_t eta)
TH1F * fhZPCPMlg[5]
ZNA PM low res.
Int_t fRunList[fCRCMaxnRun]
TH2F * fhZNCpmcvscentr
ZPA vs. centrality.
Definition: External.C:236
TH2F * fhZDCvsTracklets
ZDC vs VZERO;.
TH1F * fhZNCPMQiPMC[4]
corrected TDC histos
TH1F * fPtSpecGen[10]
list with pt spectra
TH2F * fhZNCvsZPC
ZDCC vs ZDCCA.
virtual void GetVertexPosition(Double_t *pos)
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)
TCanvas * c
Definition: TestFitELoss.C:172
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)
virtual Int_t GetCenBin(Double_t Centrality)
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)
const Double_t etamin
TH1F * fhTDCraw[6]
ZPA PM low res.
TH2F * fhZNApmcvscentr
ZNC vs. centrality.
void Fill(AliFlowTrackCuts *rpCuts, AliFlowTrackCuts *poiCuts)
TH2F * fhZNAvsZPA
ZNC vs ZPC;.
int Int_t
Definition: External.C:63
TH1F * fhZNAPM[5]
ZNC PM high res.
unsigned int UInt_t
Definition: External.C:33
void SetShuffleTracks(Bool_t b)
float Float_t
Definition: External.C:68
AliMultSelection * fMultSelection
centrality distribution
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
const Double_t ptmin
TH1F * fhZPApmcLR
ZPC PMC low res. chain.
TProfile * fZNATower[fCRCMaxnRun][5]
ZNC tower spectra.
Double_t GetCentrality() const
ClassImp(AliAnalysisTaskCRCZDC) AliAnalysisTaskCRCZDC
Bool_t plpMV(const AliAODEvent *aod)
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)
short Short_t
Definition: External.C:23
void DefineDeadZone(Double_t etaMin, Double_t etaMax, Double_t phiMin, Double_t phiMax)
AliGenEventHeader * fGenHeader
void SetPt(Double_t pt)
TList * fCRCQVecListRun[fCRCMaxnRun]
Run list.
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 * fStack
ZNA tower spectra.
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)
unsigned short UShort_t
Definition: External.C:28
TH1F * fhZPAPMlg[5]
ZPC PM low res.
const char Option_t
Definition: External.C:48
TH2F * fhZNAvsAsymm
ZN asymmetry.
TH2F * fhZNAvscentrality
ZNC vs. centrality.
bool Bool_t
Definition: External.C:53
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)
Double_t GetWDist(const AliVVertex *v0, const AliVVertex *v1)
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;.
TProfile * fZNCTower[fCRCMaxnRun][5]
Q Vectors list per run.
TH2F * fhZNvsZP
ZNA vs ZPA;.
AliGenHijingEventHeader * fHijingGenHeader
const Double_t phimin
TH1F * fhZNCPMlg[5]
ZEM PM high res.
AliGenPythiaEventHeader * fPythiaGenHeader
Int_t NumberOfTracks() const