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