AliPhysics  db95e02 (db95e02)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskJetV3.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 the 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  * Jet V3 task
18  *
19  * author: Redmer Alexander Bertens
20  * rbertens@cern.ch
21  */
22 
23 // root includes
24 #include <TGrid.h>
25 #include <TStyle.h>
26 #include <TRandom3.h>
27 #include <TChain.h>
28 #include <TMath.h>
29 #include <TF1.h>
30 #include <TF2.h>
31 #include <TH1F.h>
32 #include <TH2F.h>
33 #include <TH3F.h>
34 #include <TProfile.h>
35 #include <TFile.h>
36 // aliroot includes
37 #include <AliAnalysisTask.h>
38 #include <AliAnalysisManager.h>
39 #include <AliCentrality.h>
40 #include <AliVVertex.h>
41 #include <AliVTrack.h>
42 #include <AliVVZERO.h>
43 #include <AliESDEvent.h>
44 #include <AliAODEvent.h>
45 #include <AliAODTrack.h>
46 #include <AliOADBContainer.h>
47 #include <AliMultSelection.h>
48 #include <AliInputEventHandler.h>
49 // emcal jet framework includes
50 #include <AliEmcalJet.h>
51 #include <AliRhoParameter.h>
52 #include <AliLocalRhoParameter.h>
53 #include <AliAnalysisTaskJetV3.h>
54 #include <AliClusterContainer.h>
55 
57 using namespace std;
58 
60 
62  fRunToyMC(kFALSE), fLocalInit(0), fAttachToEvent(kTRUE), fFillHistograms(kTRUE), fFillQAHistograms(kTRUE), fReduceBinsXByFactor(-1.), fReduceBinsYByFactor(-1.), fNoEventWeightsForQC(kTRUE), fCentralityClasses(0), fExpectedRuns(0), fExpectedSemiGoodRuns(0), fUserSuppliedV2(0), fUserSuppliedV3(0), fUserSuppliedR2(0), fUserSuppliedR3(0), fAcceptanceWeights(kFALSE), fEventPlaneWeight(1.), fTracksCont(0), fClusterCont(0), fJetsCont(0), fLeadingJet(0), fLeadingJetAfterSub(0), fNAcceptedTracks(0), fNAcceptedTracksQCn(0), fFitModulationType(kNoFit), fFitGoodnessTest(kChi2Poisson), fQCRecovery(kTryFit), fUsePtWeight(kTRUE), fUsePtWeightErrorPropagation(kTRUE), fUse2DIntegration(kFALSE), fDetectorType(kVZEROComb), fAnalysisType(kCharged), fFitModulationOptions("QWLI"), fRunModeType(kGrid), fDataType(kESD), fCollisionType(kPbPb), fRandom(0), fRunNumber(-1), fRunNumberCaliInfo(-1), fMappedRunNumber(0), fInCentralitySelection(-1), fFitModulation(0), fFitControl(0), fMinPvalue(0.01), fMaxPvalue(1), fNameSmallRho(""), fCachedRho(0), fSoftTrackMinPt(0.15), fSoftTrackMaxPt(5.), fSemiGoodJetMinPhi(0.), fSemiGoodJetMaxPhi(4.), fSemiGoodTrackMinPhi(0.), fSemiGoodTrackMaxPhi(4.), fHistCentrality(0), fHistCentralityPercIn(0), fHistCentralityPercOut(0), fHistCentralityPercLost(0), fHistVertexz(0), fHistMultCorAfterCuts(0), fHistMultvsCentr(0), fHistRunnumbersPhi(0), fHistRunnumbersEta(0), fHistRunnumbersCaliInfo(0), fHistPvalueCDFROOT(0), fHistPvalueCDFROOTCent(0), fHistChi2ROOTCent(0), fHistPChi2Root(0), fHistPvalueCDF(0), fHistPvalueCDFCent(0), fHistChi2Cent(0), fHistPChi2(0), fHistKolmogorovTest(0), fHistKolmogorovTestCent(0), fHistPKolmogorov(0), fHistRhoStatusCent(0), fHistUndeterminedRunQA(0), fMinDisanceRCtoLJ(0), fMaxCones(-1), fExcludeLeadingJetsFromFit(1.), fExcludeJetsWithTrackPt(9999.), fRebinSwapHistoOnTheFly(kTRUE), fPercentageOfFits(10.), fOutputList(0), fOutputListGood(0), fOutputListBad(0), fHistAnalysisSummary(0), fHistSwap(0), fProfV2(0), fProfV2Cumulant(0), fProfV3(0), fProfV3Cumulant(0), fHistPsiVZEROAV0M(0), fHistPsiVZEROCV0M(0), fHistPsiVZEROVV0M(0), fHistPsiTPCV0M(0), fHistPsiVZEROATRK(0), fHistPsiVZEROCTRK(0), fHistPsiVZEROTRK(0), fHistPsiTPCTRK(0), fHistRhoVsMult(0), fHistRhoVsCent(0), fHistRhoAVsMult(0), fHistRhoAVsCent(0), fVZEROgainEqualization(0x0), fVZEROApol(0), fVZEROCpol(0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0), fSigma2A(0x0), fSigma2C(0x0), fSigma3A(0x0), fSigma3C(0x0), fWeightForVZERO(kChi), fOADB(0x0), fHistQxV0aBC(0x0), fHistQyV0aBC(0x0), fHistQxV0cBC(0x0), fHistQyV0cBC(0x0), fHistQxV0a(0x0), fHistQyV0a(0x0), fHistQxV0c(0x0), fHistQyV0c(0x0), fHistMultVsCellBC(0x0), fHistMultVsCell(0x0), fHistEPBC(0x0), fHistEP(0x0)
63 {
64  for(Int_t i(0); i < 10; i++) {
65  fEventPlaneWeights[i] = 0;
66  fProfV2Resolution[i] = 0;
67  fProfV3Resolution[i] = 0;
68  fHistPicoTrackPt[i] = 0;
69  fHistPicoTrackMult[i] = 0;
70  fHistPicoCat1[i] = 0;
71  fHistPicoCat2[i] = 0;
72  fHistPicoCat3[i] = 0;
73  fHistClusterPt[i] = 0;
74  fHistClusterEtaPhi[i] = 0;
76  fHistTriggerQAIn[i] = 0;
77  fHistTriggerQAOut[i] = 0;
78  fHistEPCorrelations[i] = 0;
79  fHistEPCorrAvChi[i] = 0;
80  fHistEPCorrAvSigma[i] = 0;
81  fHistEPCorrChiSigma[i] = 0;
84  fHistPsiTPCLeadingJet[i] = 0;
88  fHistPsi3Correlation[i] = 0;
90  fHistRhoPackage[i] = 0;
91  fHistRho[i] = 0;
92  fHistRhoEtaBC[i] = 0;
93  fHistRCPhiEta[i] = 0;
94  fHistRhoVsRCPt[i] = 0;
95  fHistRCPt[i] = 0;
96  fHistDeltaPtDeltaPhi3[i] = 0;
98  fHistRCPhiEtaExLJ[i] = 0;
99  fHistRhoVsRCPtExLJ[i] = 0;
100  fHistRCPtExLJ[i] = 0;
103  fHistJetPtRaw[i] = 0;
104  fHistJetPt[i] = 0;
105  fHistJetPtBC[i] = 0;
106  fHistJetEtaPhi[i] = 0;
107  fHistJetEtaPhiBC[i] = 0;
108  fHistJetPtArea[i] = 0;
109  fHistJetPtAreaBC[i] = 0;
110  fHistJetPtEta[i] = 0;
111  fHistJetPtConstituents[i] = 0;
112  fHistJetEtaRho[i] = 0;
113  fHistJetPsi3Pt[i] = 0;
114  fHistJetLJPsi3Pt[i] = 0;
115  fHistJetLJPsi3PtRatio[i] = 0;
116  fHistJetPsi3PtRho0[i] = 0;
117  }
118  for(Int_t i(0); i < 9; i++) {
119  for(Int_t j(0); j < 2; j++) {
120  for(Int_t k(0); k < 2; k++) {
121  fMeanQ[i][j][k] = 0.;
122  fWidthQ[i][j][k] = 0.;
123  fMeanQv3[i][j][k] = 0.;
124  fWidthQv3[i][j][k] = 0.;
125  fMQ[j][k][0] = 0;
126  fWQ[j][k][0] = 0;
127  fMQ[j][k][1] = 0;
128  fWQ[j][k][1] = 0;
129  }
130  }
131  }
132  // default constructor
133 }
134 //_____________________________________________________________________________
135 AliAnalysisTaskJetV3::AliAnalysisTaskJetV3(const char* name, runModeType type, Bool_t baseClassHistos) : AliAnalysisTaskEmcalJet(name, baseClassHistos),
136  fRunToyMC(kFALSE), fLocalInit(0), fAttachToEvent(kTRUE), fFillHistograms(kTRUE), fFillQAHistograms(kTRUE), fReduceBinsXByFactor(-1.), fReduceBinsYByFactor(-1.), fNoEventWeightsForQC(kTRUE), fCentralityClasses(0), fExpectedRuns(0), fExpectedSemiGoodRuns(0), fUserSuppliedV2(0), fUserSuppliedV3(0), fUserSuppliedR2(0), fUserSuppliedR3(0), fAcceptanceWeights(kFALSE), fEventPlaneWeight(1.), fTracksCont(0), fClusterCont(0), fJetsCont(0), fLeadingJet(0), fLeadingJetAfterSub(0), fNAcceptedTracks(0), fNAcceptedTracksQCn(0), fFitModulationType(kNoFit), fFitGoodnessTest(kChi2Poisson), fQCRecovery(kTryFit), fUsePtWeight(kTRUE), fUsePtWeightErrorPropagation(kTRUE), fUse2DIntegration(kFALSE), fDetectorType(kVZEROComb), fAnalysisType(kCharged), fFitModulationOptions("QWLI"), fRunModeType(type), fDataType(kESD), fCollisionType(kPbPb), fRandom(0), fRunNumber(-1), fRunNumberCaliInfo(-1), fMappedRunNumber(0), fInCentralitySelection(-1), fFitModulation(0), fFitControl(0), fMinPvalue(0.01), fMaxPvalue(1), fNameSmallRho(""), fCachedRho(0), fSoftTrackMinPt(0.15), fSoftTrackMaxPt(5.), fSemiGoodJetMinPhi(0.), fSemiGoodJetMaxPhi(4.), fSemiGoodTrackMinPhi(0.), fSemiGoodTrackMaxPhi(4.), fHistCentrality(0), fHistCentralityPercIn(0), fHistCentralityPercOut(0), fHistCentralityPercLost(0), fHistVertexz(0), fHistMultCorAfterCuts(0), fHistMultvsCentr(0), fHistRunnumbersPhi(0), fHistRunnumbersEta(0), fHistRunnumbersCaliInfo(0), fHistPvalueCDFROOT(0), fHistPvalueCDFROOTCent(0), fHistChi2ROOTCent(0), fHistPChi2Root(0), fHistPvalueCDF(0), fHistPvalueCDFCent(0), fHistChi2Cent(0), fHistPChi2(0), fHistKolmogorovTest(0), fHistKolmogorovTestCent(0), fHistPKolmogorov(0), fHistRhoStatusCent(0), fHistUndeterminedRunQA(0), fMinDisanceRCtoLJ(0), fMaxCones(-1), fExcludeLeadingJetsFromFit(1.), fExcludeJetsWithTrackPt(9999), fRebinSwapHistoOnTheFly(kTRUE), fPercentageOfFits(10.), fOutputList(0), fOutputListGood(0), fOutputListBad(0), fHistAnalysisSummary(0), fHistSwap(0), fProfV2(0), fProfV2Cumulant(0), fProfV3(0), fProfV3Cumulant(0), fHistPsiVZEROAV0M(0), fHistPsiVZEROCV0M(0), fHistPsiVZEROVV0M(0), fHistPsiTPCV0M(0), fHistPsiVZEROATRK(0), fHistPsiVZEROCTRK(0), fHistPsiVZEROTRK(0), fHistPsiTPCTRK(0), fHistRhoVsMult(0), fHistRhoVsCent(0), fHistRhoAVsMult(0), fHistRhoAVsCent(0), fVZEROgainEqualization(0x0), fVZEROApol(0), fVZEROCpol(0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0), fSigma2A(0x0), fSigma2C(0x0), fSigma3A(0x0), fSigma3C(0x0), fWeightForVZERO(kChi), fOADB(0x0), fHistQxV0aBC(0x0), fHistQyV0aBC(0x0), fHistQxV0cBC(0x0), fHistQyV0cBC(0x0), fHistQxV0a(0x0), fHistQyV0a(0x0), fHistQxV0c(0x0), fHistQyV0c(0x0), fHistMultVsCellBC(0x0), fHistMultVsCell(0x0), fHistEPBC(0x0), fHistEP(0x0)
137 {
138  for(Int_t i(0); i < 10; i++) {
139  fEventPlaneWeights[i] = 0;
140  fProfV2Resolution[i] = 0;
141  fProfV3Resolution[i] = 0;
142  fHistPicoTrackPt[i] = 0;
143  fHistPicoTrackMult[i] = 0;
144  fHistPicoCat1[i] = 0;
145  fHistPicoCat2[i] = 0;
146  fHistPicoCat3[i] = 0;
147  fHistClusterPt[i] = 0;
148  fHistClusterEtaPhi[i] = 0;
150  fHistTriggerQAIn[i] = 0;
151  fHistTriggerQAOut[i] = 0;
152  fHistEPCorrelations[i] = 0;
153  fHistEPCorrAvChi[i] = 0;
154  fHistEPCorrAvSigma[i] = 0;
155  fHistEPCorrChiSigma[i] = 0;
158  fHistPsiTPCLeadingJet[i] = 0;
159  fHistPsiVZEROALeadingJet[i] = 0;
162  fHistPsi3Correlation[i] = 0;
164  fHistRhoPackage[i] = 0;
165  fHistRho[i] = 0;
166  fHistRhoEtaBC[i] = 0;
167  fHistRCPhiEta[i] = 0;
168  fHistRhoVsRCPt[i] = 0;
169  fHistRCPt[i] = 0;
170  fHistDeltaPtDeltaPhi3[i] = 0;
172  fHistRCPhiEtaExLJ[i] = 0;
173  fHistRhoVsRCPtExLJ[i] = 0;
174  fHistRCPtExLJ[i] = 0;
177  fHistJetPtRaw[i] = 0;
178  fHistJetPt[i] = 0;
179  fHistJetPtBC[i] = 0;
180  fHistJetEtaPhi[i] = 0;
181  fHistJetEtaPhiBC[i] = 0;
182  fHistJetPtArea[i] = 0;
183  fHistJetPtAreaBC[i] = 0;
184  fHistJetPtEta[i] = 0;
185  fHistJetPtConstituents[i] = 0;
186  fHistJetEtaRho[i] = 0;
187  fHistJetPsi3Pt[i] = 0;
188  fHistJetLJPsi3Pt[i] = 0;
189  fHistJetLJPsi3PtRatio[i] = 0;
190  fHistJetPsi3PtRho0[i] = 0;
191  }
192  for(Int_t i(0); i < 9; i++) {
193  for(Int_t j(0); j < 2; j++) {
194  for(Int_t k(0); k < 2; k++) {
195  fMeanQ[i][j][k] = 0.;
196  fWidthQ[i][j][k] = 0.;
197  fMeanQv3[i][j][k] = 0.;
198  fWidthQv3[i][j][k] = 0.;
199  fMQ[j][k][0] = 0;
200  fWQ[j][k][0] = 0;
201  fMQ[j][k][1] = 0;
202  fWQ[j][k][1] = 0;
203  }
204  }
205  }
206 
207  // constructor
208  DefineInput(0, TChain::Class());
209  Int_t startAt(1);
210  if(fCreateHisto) startAt++;
211  DefineOutput(startAt, TList::Class());
212  switch (fRunModeType) {
213  case kLocal : {
214  gStyle->SetOptFit(1);
215  DefineOutput(startAt+1, TList::Class());
216  DefineOutput(startAt+2, TList::Class());
217  } break;
218  default: break;
219  }
220  switch (fCollisionType) {
221  case kPythia : {
223  } break;
224  default : break;
225  }
226  if(fLocalRhoName=="") fLocalRhoName = Form("LocalRhoFrom_%s", GetName());
227  SetMakeGeneralHistograms(baseClassHistos);
228 }
229 //_____________________________________________________________________________
231 {
232  // destructor
233  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
234  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
235  #endif
236 
237  if(fOutputList) {delete fOutputList; fOutputList = 0x0;}
238  if(fOutputListGood) {delete fOutputListGood; fOutputListGood = 0x0;}
239  if(fOutputListBad) {delete fOutputListBad; fOutputListBad = 0x0;}
240  if(fFitModulation) {delete fFitModulation; fFitModulation = 0x0;}
241  if(fHistSwap) {delete fHistSwap; fHistSwap = 0x0;}
243  if(fExpectedRuns) {delete fExpectedRuns; fExpectedRuns = 0x0;}
245  if(fFitControl) {delete fFitControl; fFitControl = 0x0;}
247  if(fChi2A) {delete fChi2A; fChi2A = 0x0;}
248  if(fChi2C) {delete fChi2C; fChi2C = 0x0;}
249  if(fChi3A) {delete fChi3A; fChi3A = 0x0;}
250  if(fChi3C) {delete fChi3C; fChi3C = 0x0;}
251  if(fSigma2A) {delete fSigma2A; fSigma2A = 0x0;}
252  if(fSigma2C) {delete fSigma2C; fSigma2C = 0x0;}
253  if(fSigma3A) {delete fSigma3A; fSigma3A = 0x0;}
254  if(fSigma3C) {delete fSigma3C; fSigma3C = 0x0;}
255  if(fOADB && !fOADB->IsZombie()) {
256  fOADB->Close(); fOADB = 0x0;
257  } else if (fOADB) fOADB = 0x0;
258 }
259 //_____________________________________________________________________________
261 {
262  // Init the analysis
263  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
264  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
265  #endif
266  if(!fLocalRho) {
267  fLocalRho = new AliLocalRhoParameter(fLocalRhoName.Data(), 0);
268  if(fAttachToEvent) {
269  if(!(InputEvent()->FindListObject(fLocalRho->GetName()))) {
270  InputEvent()->AddObject(fLocalRho);
271  } else {
272  AliFatal(Form("%s: Container with name %s already present. Aborting", GetName(), fLocalRho->GetName()));
273  }
274  }
275  }
276  AliAnalysisTaskEmcalJet::ExecOnce(); // init the base class
277  if(!GetJetContainer()) AliFatal(Form("%s: Couldn't find jet container. Aborting !", GetName()));
278 }
279 //_____________________________________________________________________________
281 {
282  // determine the run number to see if the track and jet cuts should be refreshed for semi-good TPC runs
283  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
284  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
285  #endif
286  if(fRunNumber != InputEvent()->GetRunNumber()) {
287  fRunNumber = InputEvent()->GetRunNumber(); // set the current run number
288  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
289  printf("__FUNC__ %s > NEW RUNNUMBER DETECTED \n ", __func__);
290  #endif
291  // check if this is 10h or 11h data
292  switch (fCollisionType) {
293  case kPbPb10h : {
294  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
295  printf(" LHC10h data, assuming full acceptance, reading VZERO calibration DB \n ");
296  #endif
297  // for 10h data the vzero event plane calibration needs to be cached
299  // no need to change rho or acceptance for 10h, so we're done
300  return kTRUE;
301  } break;
302  case kJetFlowMC : {
303  return kTRUE;
304  } break;
305  case kPbPb15o : {
307  return kTRUE;
308  } break;
309  default : {
310  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
311  printf(" checking runnumber to adjust acceptance on the fly \n");
312  #endif
314  } break;
315  }
316  // reset the cuts. should be a pointless operation except for the case where the run number changes
317  // from semi-good back to good on one node, which is not a likely scenario (unless trains will
318  // run as one masterjob)
319  switch (fAnalysisType) {
320  case kCharged: {
322  } break;
323  case kFull: {
325  } break;
326  default: {
328  } break;
329  }
330  if(fCachedRho) { // if there's a cached rho, it's the default, so switch back
331  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
332  printf("__FUNC__ %s > replacing rho with cached rho \n ", __func__);
333  #endif
334  fRho = fCachedRho; // reset rho back to cached value. again, should be pointless
335  }
336  Bool_t flaggedAsSemiGood(kFALSE); // not flagged as anything
337  for(Int_t i(0); i < fExpectedSemiGoodRuns->GetSize(); i++) {
338  if(fExpectedSemiGoodRuns->At(i) == fRunNumber) { // run is semi-good
339  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
340  printf("__FUNC__ %s > semi-good tpc run detected, adjusting acceptance \n ", __func__);
341  #endif
342  flaggedAsSemiGood = kTRUE;
343  switch (fAnalysisType) {
344  // for full jets the jet acceptance does not have to be changed as emcal does not
345  // cover the tpc low voltage readout strips
346  case kCharged: {
347  AliAnalysisTaskEmcalJet::SetJetPhiLimits(fSemiGoodJetMinPhi, fSemiGoodJetMaxPhi); // just an acceptance cut, jets are obtained from full azimuth, so no edge effects
348  } break;
349  default: break;
350  }
351  AliAnalysisTaskEmcal::SetTrackPhiLimits(fSemiGoodTrackMinPhi, fSemiGoodTrackMaxPhi); // only affects vn extraction, NOT jet finding
352  // for semi-good runs, also try to get the 'small rho' estimate, if it is available
353  AliRhoParameter* tempRho(dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fNameSmallRho.Data())));
354  if(tempRho) {
355  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
356  printf("__FUNC__ %s > switching to small rho, caching normal rho \n ", __func__);
357  #endif
358  fHistAnalysisSummary->SetBinContent(54, 1.); // bookkeep the fact that small rho is used
359  fCachedRho = fRho; // cache the original rho ...
360  fRho = tempRho; // ... and use the small rho
361  }
362  }
363  }
364  if(!flaggedAsSemiGood) {
365  // in case the run is not a semi-good run, check if it is recognized as another run
366  // only done to catch unexpected runs
367  for(Int_t i(0); i < fExpectedRuns->GetSize(); i++) {
368  if(fExpectedRuns->At(i) == fRunNumber) break; // run is known, break the loop else store the number in a random bin
369  fHistUndeterminedRunQA->SetBinContent(TMath::Nint(10.*gRandom->Uniform(0.,.9))+1, fRunNumber);
370  }
371  fHistAnalysisSummary->SetBinContent(53, 1.); // bookkeep which rho estimate is used
372  }
373  }
374  return kTRUE;
375 }
376 //_____________________________________________________________________________
378 {
379  // initialize the anaysis
380  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
381  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
382  #endif
383  // if not set, estimate the number of cones that would fit into the selected acceptance
384  if(fMaxCones <= 0) fMaxCones = TMath::CeilNint((TMath::Abs(GetJetContainer()->GetJetEtaMax()-GetJetContainer()->GetJetEtaMin())*TMath::Abs(GetJetContainer()->GetJetPhiMax()-GetJetContainer()->GetJetPhiMin()))/(TMath::Pi()*GetJetRadius()*GetJetRadius()));
385  // manually 'override' the default acceptance cuts of the emcal framework (use with caution)
387  if(dynamic_cast<AliAODEvent*>(InputEvent())) fDataType = kAOD; // determine the datatype
388  else if(dynamic_cast<AliESDEvent*>(InputEvent())) fDataType = kESD;
389  fHistAnalysisSummary->SetBinContent(36, (int)fDataType);
390  if(!fRandom) fRandom = new TRandom3(0); // set randomizer and random seed
391  switch (fFitModulationType) {
392  case kNoFit : { SetModulationFit(new TF1("fix_kNoFit", "[0]", 0, TMath::TwoPi())); } break;
393  case kV2 : {
394  SetModulationFit(new TF1("fit_kV2", "[0]*([1]+[2]*[3]*TMath::Cos([2]*(x-[4])))", 0, TMath::TwoPi()));
395  fFitModulation->SetParameter(0, 0.); // normalization
396  fFitModulation->SetParameter(3, 0.2); // v2
397  fFitModulation->FixParameter(1, 1.); // constant
398  fFitModulation->FixParameter(2, 2.); // constant
399  } break;
400  case kV3: {
401  SetModulationFit(new TF1("fit_kV3", "[0]*([1]+[2]*[3]*TMath::Cos([2]*(x-[4])))", 0, TMath::TwoPi()));
402  fFitModulation->SetParameter(0, 0.); // normalization
403  fFitModulation->SetParameter(3, 0.2); // v3
404  fFitModulation->FixParameter(1, 1.); // constant
405  fFitModulation->FixParameter(2, 3.); // constant
406  } break;
407  default : { // for the combined fit, the 'direct fourier series' or the user supplied vn values we use v2 and v3
408  SetModulationFit(new TF1("fit_kCombined", "[0]*([1]+[2]*([3]*TMath::Cos([2]*(x-[4]))+[7]*TMath::Cos([5]*(x-[6]))))", 0, TMath::TwoPi()));
409  fFitModulation->SetParameter(0, 0.); // normalization
410  fFitModulation->SetParameter(3, 0.2); // v2
411  fFitModulation->FixParameter(1, 1.); // constant
412  fFitModulation->FixParameter(2, 2.); // constant
413  fFitModulation->FixParameter(5, 3.); // constant
414  fFitModulation->SetParameter(7, 0.2); // v3
415  } break;
416  }
417  switch (fRunModeType) {
418  case kGrid : { fFitModulationOptions += "N0"; } break;
419  default : break;
420  }
422  return kTRUE;
423 }
424 //_____________________________________________________________________________
425 TH1F* AliAnalysisTaskJetV3::BookTH1F(const char* name, const char* x, Int_t bins, Double_t min, Double_t max, Int_t c, Bool_t append)
426 {
427  // book a TH1F and connect it to the output container
428  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
429  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
430  #endif
431  if(fReduceBinsXByFactor > 0 ) bins = TMath::Nint(bins/fReduceBinsXByFactor);
432  if(append && !fOutputList) return 0x0;
433  TString title(name);
434  if(c!=-1) { // format centrality dependent histograms accordingly
435  name = Form("%s_%i", name, c);
436  title += Form("_%i-%i", (int)(fCentralityClasses->At(c)), (int)(fCentralityClasses->At((1+c))));
437  }
438  title += Form(";%s;[counts]", x);
439  TH1F* histogram = new TH1F(name, title.Data(), bins, min, max);
440  histogram->Sumw2();
441  if(append) fOutputList->Add(histogram);
442  return histogram;
443 }
444 //_____________________________________________________________________________
445 TH2F* AliAnalysisTaskJetV3::BookTH2F(const char* name, const char* x, const char* y, Int_t binsx, Double_t minx, Double_t maxx, Int_t binsy, Double_t miny, Double_t maxy, Int_t c, Bool_t append)
446 {
447  // book a TH2F and connect it to the output container
448  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
449  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
450  #endif
451  if(fReduceBinsXByFactor > 0 ) binsx = TMath::Nint(binsx/fReduceBinsXByFactor);
452  if(fReduceBinsYByFactor > 0 ) binsy = TMath::Nint(binsy/fReduceBinsYByFactor);
453  if(append && !fOutputList) return 0x0;
454  TString title(name);
455  if(c!=-1) { // format centrality dependent histograms accordingly
456  name = Form("%s_%i", name, c);
457  title += Form("_%i-%i", (int)fCentralityClasses->At(c), (int)(fCentralityClasses->At((1+c))));
458  }
459  title += Form(";%s;%s", x, y);
460  TH2F* histogram = new TH2F(name, title.Data(), binsx, minx, maxx, binsy, miny, maxy);
461  histogram->Sumw2();
462  if(append) fOutputList->Add(histogram);
463  return histogram;
464 }
465 //_____________________________________________________________________________
466 TH3F* AliAnalysisTaskJetV3::BookTH3F(const char* name, const char* x, const char* y, const char* z, Int_t binsx, Double_t minx, Double_t maxx, Int_t binsy, Double_t miny, Double_t maxy, Int_t binsz, Double_t minz, Double_t maxz, Int_t c, Bool_t append)
467 {
468  // book a TH2F and connect it to the output container
469  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
470  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
471  #endif
472  if(fReduceBinsXByFactor > 0 ) {
473  binsx = TMath::Nint(binsx/fReduceBinsXByFactor);
474  binsy = TMath::Nint(binsy/fReduceBinsXByFactor);
475  binsz = TMath::Nint(binsz/fReduceBinsXByFactor);
476  }
477  if(append && !fOutputList) return 0x0;
478  TString title(name);
479  if(c!=-1) { // format centrality dependent histograms accordingly
480  name = Form("%s_%i", name, c);
481  title += Form("_%i-%i", (int)fCentralityClasses->At(c), (int)(fCentralityClasses->At((1+c))));
482  }
483  title += Form(";%s;%s;%s", x, y, z);
484  TH3F* histogram = new TH3F(name, title.Data(), binsx, minx, maxx, binsy, miny, maxy, binsz, minz, maxz);
485  histogram->Sumw2();
486  if(append) fOutputList->Add(histogram);
487  return histogram;
488 }
489 //_____________________________________________________________________________
491 {
492  // create output objects. also initializes some default values in case they aren't
493  // loaded via the AddTask macro
494  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
495  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
496  #endif
498  fOutputList = new TList();
499  fOutputList->SetOwner(kTRUE);
500  if(!fCentralityClasses) { // classes must be defined at this point
501  Double_t c[] = {0., 20., 40., 60., 80., 100.};
502  fCentralityClasses = new TArrayD(sizeof(c)/sizeof(c[0]), c);
503  }
504  if(!fExpectedRuns) { // expected runs must be defined at this point
505  Int_t r[] = {167813, 167988, 168066, 168068, 168069, 168076, 168104, 168212, 168311, 168322, 168325, 168341, 168361, 168362, 168458, 168460, 168461, 168992, 169091, 169094, 169138, 169143, 169167, 169417, 169835, 169837, 169838, 169846, 169855, 169858, 169859, 169923, 169956, 170027, 170036, 170081, /* up till here original good TPC list */169975, 169981, 170038, 170040, 170083, 170084, 170085, 170088, 170089, 170091, 170152, 170155, 170159, 170163, 170193, 170195, 170203, 170204, 170205, 170228, 170230, 170264, 170268, 170269, 170270, 170306, 170308, 170309, /* original semi-good tpc list */169415, 169411, 169035, 168988, 168984, 168826, 168777, 168512, 168511, 168467, 168464, 168342, 168310, 168115, 168108, 168107, 167987, 167915, 167903, /*new runs, good according to RCT */ 169238, 169160, 169156, 169148, 169145, 169144 /* run swith missing OROC 8 but seem ok in QA */};
506  fExpectedRuns = new TArrayI(sizeof(r)/sizeof(r[0]), r);
507  }
508  // set default semi-good runs only for 11h data
509  switch (fCollisionType) {
510  case kPbPb10h : {
511  fHistMultCorAfterCuts = new TH2F("fHistMultCorAfterCuts", "TPC vs Global multiplicity (After cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
513  fHistMultvsCentr = new TH2F("fHistMultvsCentr", "Multiplicity vs centrality; centrality; Multiplicity", 9, -0.5, 100.5, 101, 0, 3000);
515  } break;
516  default : {
517  if(!fExpectedSemiGoodRuns) {
518  Int_t r[] = {169975, 169981, 170038, 170040, 170083, 170084, 170085, 170088, 170089, 170091, 170152, 170155, 170159, 170163, 170193, 170195, 170203, 170204, 170205, 170228, 170230, 170264, 170268, 170269, 170270, 170306, 170308, 170309};
519  fExpectedSemiGoodRuns = new TArrayI(sizeof(r)/sizeof(r[0]), r);
520  }
521  }
522  }
523 
524  // global QA
525  fHistCentrality = BookTH1F("fHistCentrality", "centrality", 102, -2, 100);
526  fHistVertexz = BookTH1F("fHistVertexz", "vertex z (cm)", 100, -12, 12);
527  if(fAcceptanceWeights) {
528  fHistCentralityPercIn = new TProfile("fHistCentralityPercIn", "fHistCentralityPercIn", 102, -2, 100);
529  fHistCentralityPercOut = new TProfile("fHistCentralityPercOut", "fHistCentralityPercOut", 102, -2, 100);
530  fHistCentralityPercLost = new TProfile("fHistCentralityPercLost", "fHistCentralityPercLost", 102, -2, 100);
531  }
532  // for some histograms adjust the bounds according to analysis acceptance
533  Double_t etaMin(-1.), etaMax(1.), phiMin(0.), phiMax(TMath::TwoPi());
534  switch (fAnalysisType) {
535  case kFull : {
536  etaMin = -.7;
537  etaMax = .7;
538  phiMin = 1.405;
539  phiMax = 3.135;
540  } break;
541  default : break;
542  }
543 
544  // pico track and emcal cluster kinematics, trigger qa
545  for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i++) {
546  fHistPicoTrackPt[i] = BookTH1F("fHistPicoTrackPt", "p_{t} [GeV/c]", 100, 0, 100, i);
547  fHistPicoTrackMult[i] = BookTH1F("fHistPicoTrackMult", "multiplicity", 100, 0, 5000, i);
548  if(fFillQAHistograms) {
549  fHistPicoCat1[i] = BookTH2F("fHistPicoCat1", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i);
550  fHistPicoCat2[i] = BookTH2F("fHistPicoCat2", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i);
551  fHistPicoCat3[i] = BookTH2F("fHistPicoCat3", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i);
553  fHistClusterPt[i] = BookTH1F("fHistClusterPt", "p_{t} [GeV/c]", 100, 0, 100, i);
554  fHistClusterEtaPhi[i] = BookTH2F("fHistClusterEtaPhi", "#eta", "#phi", 100, etaMax, etaMax, 100, phiMin, phiMax, i);
555  fHistClusterEtaPhiWeighted[i] = BookTH2F("fHistClusterEtaPhiWeighted", "#eta", "#phi", 100, etaMin, etaMax, 100, phiMin, phiMax, i);
556  }
557  fHistPsiTPCLeadingJet[i] = BookTH3F("fHistPsiTPCLeadingJet", "p_{t} [GeV/c]", "#Psi_{TPC}", "#varphi_{jet}", 70, 0, 210, 50, -1.*TMath::Pi()/3., TMath::Pi()/3., 50, phiMin, phiMax, i);
558  fHistEPCorrelations[i] = BookTH3F("fHistEPCorrelations", "EP_V0 average", "EP_V0 #chi", "EP_V0 #sigma", 50, -TMath::Pi()/2., TMath::Pi()/2., 50, -TMath::Pi()/2., TMath::Pi()/2., 50, -TMath::Pi()/2., TMath::Pi()/2.);
559  fHistEPCorrAvChi[i] = BookTH2F("fHistEPCorrAvChi", "EP_V0 average", "EP_V0 #chi", 50, -TMath::Pi()/2., TMath::Pi()/2., 50, -TMath::Pi()/2., TMath::Pi()/2., i);
560  fHistEPCorrAvSigma[i] = BookTH2F("fHistEPCorrAvSigma", "EP_V0 average", "EP_V0 #sigma", 50, -TMath::Pi()/2., TMath::Pi()/2., 50, -TMath::Pi()/2., TMath::Pi()/2., i);
561  fHistEPCorrChiSigma[i] = BookTH2F("fHistEPCorrChiSigma", "EP_V0 #chi", "EP_V0 #sigma", 50, -TMath::Pi()/2., TMath::Pi()/2., 50, -TMath::Pi()/2., TMath::Pi()/2., i);
562  fHistIntegralCorrelations[i] = BookTH2F("fHistIntegralCorrelations", "square [GeV/c/A]", "circle [GeVc/A]", 100, 0, 100, 100, 0, 100);
563  fProfIntegralCorrelations[i] = new TProfile(Form("fProfIntegralCorrelations_%i", i), Form("fProfIntegralCorrelations_%i", i), 100, 0, 100);
564  fProfIntegralCorrelations[i]->GetXaxis()->SetTitle("RC energy, #eta #varphi scale");
565  fProfIntegralCorrelations[i]->GetYaxis()->SetTitle("#phi / #eta, #varphi");
567  fHistPsiVZEROALeadingJet[i] = BookTH3F("fHistPsiVZEROALeadingJet", "p_{t} [GeV/c]", "#Psi_{VZEROA}", "#varphi_{jet}", 70, 0, 210, 50, -1.*TMath::Pi()/3., TMath::Pi()/3., 50, phiMin, phiMax, i);
568  fHistPsiVZEROCLeadingJet[i] = BookTH3F("fHistPsiVZEROCLeadingJet", "p_{t} [GeV/c]", "#Psi_{VZEROC}", "#varphi_{jet}", 70, 0, 210, 50, -1.*TMath::Pi()/3., TMath::Pi()/3., 50, phiMin, phiMax, i);
569  fHistPsiVZEROCombLeadingJet[i] = BookTH3F("fHistPsiVZEROCombLeadingJet", "p_{t} [GeV/c]", "#Psi_{VZEROComb}", "#varphi_{jet}", 70, 0, 210, 50, -1.*TMath::Pi()/3., TMath::Pi()/3., 50, phiMin, phiMax, i);
570  fHistPsi3Correlation[i] = BookTH3F("fHistPsi3Correlation", "#Psi_{TPC}", "#Psi_{VZEROA}", "#Psi_{VZEROC}", 20, -1.*TMath::Pi()/3., TMath::Pi()/3., 20, -1.*TMath::Pi()/3., TMath::Pi()/3., 20, -1.*TMath::Pi()/3., TMath::Pi()/3., i);
571  fHistLeadingJetBackground[i] = BookTH2F("fHistLeadingJetBackground", "#Delta #eta (leading jet with, without sub)", "Delta #varphi (leading jet with, without sub)", 50, 0., 2, 50, 0., TMath::TwoPi(), i);
572  // trigger qa
573  fHistTriggerQAIn[i] = BookTH2F("fHistTriggerQAIn", "trigger configuration", "p_{T}^{jet} (GeV/c) in-plane jets", 16, 0.5, 16.5, 70, -100, 250, i);
574  fHistTriggerQAOut[i] = BookTH2F("fHistTriggerQAOut", "trigger configuration", "p_{T}^{jet} (GeV/c) out-of-plane jets", 16, 0.5, 16.5, 70, -100, 250, i);
575  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(1, "no trigger");
576  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(2, "kAny");
577  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(3, "kAnyINT");
578  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(4, "kMB");
579  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(5, "kCentral");
580  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(6, "kSemiCentral");
581  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(7, "kEMCEJE");
582  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(8, "kEMCEGA");
583  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(9, "kEMCEJE & kMB");
584  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(10, "kEMCEJE & kCentral");
585  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(11, "kEMCEJE & kSemiCentral");
586  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(12, "kEMCEJE & all min bias");
587  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(13, "kEMCEGA & kMB");
588  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(14, "kEMCEGA & kCentral");
589  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(15, "kEMCEGA & kSemiCentral");
590  fHistTriggerQAIn[i]->GetXaxis()->SetBinLabel(16, "kEMCEGA & all min bias");
591  fHistTriggerQAIn[i]->LabelsOption("v");
592  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(1, "no trigger");
593  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(2, "kAny");
594  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(3, "kAnyINT");
595  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(4, "kMB");
596  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(5, "kCentral");
597  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(6, "kSemiCentral");
598  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(7, "kEMCEJE");
599  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(8, "kEMCEGA");
600  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(9, "kEMCEJE & kMB");
601  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(10, "kEMCEJE & kCentral");
602  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(11, "kEMCEJE & kSemiCentral");
603  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(12, "kEMCEJE & all min bias");
604  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(13, "kEMCEGA & kMB");
605  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(14, "kEMCEGA & kCentral");
606  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(15, "kEMCEGA & kSemiCentral");
607  fHistTriggerQAOut[i]->GetXaxis()->SetBinLabel(16, "kEMCEGA & all min bias");
608  fHistTriggerQAOut[i]->LabelsOption("v");
609  }
610  }
611 
612  if(fFillQAHistograms) {
613  Int_t low(fCentralityClasses->At(0)), up(fCentralityClasses->At(fCentralityClasses->GetSize()-1));
614  Int_t diff(TMath::Abs(up-low));
615  // event plane estimates and quality
616  fHistPsiVZEROAV0M = BookTH2F("fHistPsiVZEROAV0M", "V0M", "#Psi_{2, VZEROA}", diff, low, up, 40, -.5*TMath::Pi(), .5*TMath::Pi());
617  fHistPsiVZEROCV0M = BookTH2F("fHistPsiVZEROCV0M", "V0M", "#Psi_{2, VZEROC}", diff, low, up, 40, -.5*TMath::Pi(), .5*TMath::Pi());
618  fHistPsiVZEROVV0M = BookTH2F("fHistPsiVZEROV0M", "V0M", "#Psi_{2, VZERO}", diff, low, up, 40, -.5*TMath::Pi(), .5*TMath::Pi());
619  fHistPsiTPCV0M = BookTH2F("fHistPsiTPCV0M", "V0M", "#Psi_{2, TRK}", diff, low, up, 40, -.5*TMath::Pi(), .5*TMath::Pi());
620  fHistPsiVZEROATRK = BookTH2F("fHistPsiVZEROATRK", "TRK", "#Psi_{2, VZEROA}", diff, low, up, 40, -.5*TMath::Pi(), .5*TMath::Pi());
621  fHistPsiVZEROCTRK = BookTH2F("fHistPsiVZEROCTRK", "TRK", "#Psi_{2, VZEROC}", diff, low, up, 40, -.5*TMath::Pi(), .5*TMath::Pi());
622  fHistPsiVZEROTRK = BookTH2F("fHistPsiVZEROTRK", "TRK", "#Psi_{2, VZERO}", diff, low, up, 40, -.5*TMath::Pi(), .5*TMath::Pi());
623  fHistPsiTPCTRK = BookTH2F("fHistPsiTPCTRK", "TRK", "#Psi_{2, TRK}", diff, low, up, 40, -.5*TMath::Pi(), .5*TMath::Pi());
624  }
625  // background
626  for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i ++) {
627  fHistRhoPackage[i] = BookTH1F("fHistRhoPackage", "#rho [GeV/c]", 100, 0, 150, i);
628  fHistRho[i] = BookTH1F("fHistRho", "#rho [GeV/c]", 100, 0, 150, i);
629  }
630  fHistRhoVsMult = BookTH2F("fHistRhoVsMult", "multiplicity", "#rho [GeV/c]", 100, 0, 4000, 100, 0, 250);
631  fHistRhoVsCent = BookTH2F("fHistRhoVsCent", "centrality", "#rho [GeV/c]", 100, 0, 100, 100, 0, 250);
632  fHistRhoAVsMult = BookTH2F("fHistRhoAVsMult", "multiplicity", "#rho * A (jet) [GeV/c]", 100, 0, 4000, 100, 0, 50);
633  fHistRhoAVsCent = BookTH2F("fHistRhoAVsCent", "centrality", "#rho * A (jet) [GeV/c]", 100, 0, 100, 100, 0, 50);
634 
635  TString detector("");
636  switch (fDetectorType) {
637  case kTPC : detector+="TPC";
638  break;
639  case kVZEROA : detector+="VZEROA";
640  break;
641  case kVZEROC : detector+="VZEROC";
642  break;
643  case kVZEROComb : detector+="VZEROComb";
644  break;
645  case kFixedEP : detector+="FixedEP";
646  break;
647  default: break;
648  }
649  // delta pt distributions
650  for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i ++) {
651  if(fFillQAHistograms) fHistRCPhiEta[i] = BookTH2F("fHistRCPhiEta", "#phi (RC)", "#eta (RC)", 40, phiMin, phiMax, 40, etaMin, etaMax, i);
652  fHistRhoVsRCPt[i] = BookTH2F("fHistRhoVsRCPt", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i);
653  fHistRCPt[i] = BookTH1F("fHistRCPt", "p_{t} (RC) [GeV/c]", 130, -20, 150, i);
654  if(fFillQAHistograms) fHistRCPhiEtaExLJ[i] = BookTH2F("fHistRCPhiEtaExLJ", "#phi (RC)", "#eta (RC)", 40, phiMin, phiMax, 40, etaMin, etaMax, i);
655  fHistDeltaPtDeltaPhi3[i] = BookTH2F("fHistDeltaPtDeltaPhi3", Form("#phi - #Psi_{3, %s}", detector.Data()), "#delta p_{t} [GeV/c]", 40, 0, 2.*TMath::Pi()/3., 400, -70, 130, i);
656  fHistDeltaPtDeltaPhi3Rho0[i] = BookTH2F("fHistDeltaPtDeltaPhi3Rho0", Form("#phi - #Psi_{3, %s}", detector.Data()), "#delta p_{t} [GeV/c]", 40, 0, 2.*TMath::Pi()/3., 400, -70, 130, i);
657  fHistRhoVsRCPtExLJ[i] = BookTH2F("fHistRhoVsRCPtExLJ", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i);
658  fHistRCPtExLJ[i] = BookTH1F("fHistRCPtExLJ", "p_{t} (RC) [GeV/c]", 130, -20, 150, i);
659  fHistDeltaPtDeltaPhi3ExLJ[i] = BookTH2F("fHistDeltaPtDeltaPhi3ExLJ", Form("#phi - #Psi_{3, %s}", detector.Data()), "#delta p_{t} [GeV/c]", 40, 0, 2.*TMath::Pi()/3., 400, -70, 130, i);
660  fHistDeltaPtDeltaPhi3ExLJRho0[i] = BookTH2F("fHistDeltaPtDeltaPhi3ExLJRho0", Form("#phi - #Psi_{3, %s}", detector.Data()), "#delta p_{t} [GeV/c]", 40, 0, 2.*TMath::Pi()/3., 400, -70, 130, i);
661  // jet histograms (after kinematic cuts)
662  fHistJetPtRaw[i] = BookTH1F("fHistJetPtRaw", "p_{t, jet} RAW [GeV/c]", 200, -50, 150, i);
663  fHistJetPt[i] = BookTH1F("fHistJetPt", "p_{t, jet} [GeV/c]", 350, -100, 250, i);
664  if(fFillQAHistograms) fHistJetEtaPhi[i] = BookTH2F("fHistJetEtaPhi", "#eta", "#phi", 100, etaMin, etaMax, 100, phiMin, phiMax, i);
665  fHistJetPtArea[i] = BookTH2F("fHistJetPtArea", "p_{t, jet} [GeV/c]", "Area", 175, -100, 250, 30, 0, 0.9, i);
666  fHistJetPtEta[i] = BookTH2F("fHistJetPtEta", "p_{t, jet} [GeV/c]", "Eta", 175, -100, 250, 30, etaMin, etaMax, i);
667  fHistJetPtConstituents[i] = BookTH2F("fHistJetPtConstituents", "p_{t, jet} [GeV/c]", "no. of constituents", 350, -100, 250, 60, 0, 150, i);
668  fHistJetEtaRho[i] = BookTH2F("fHistJetEtaRho", "#eta", "#rho", 100, etaMin, etaMax, 100, 0, 300, i);
669  // in plane and out of plane spectra
670  fHistJetPsi3Pt[i] = BookTH2F("fHistJetPsi3Pt", Form("#phi_{jet} - #Psi_{3, %s}", detector.Data()), "p_{t, jet} [GeV/c]", 40, 0., 2.*TMath::Pi()/3., 350, -100, 250, i);
671  fHistJetLJPsi3Pt[i] = BookTH3F("fHistJetLJPsi3Pt", Form("#phi_{part} - #Psi_{3, %s}", detector.Data()), "p_{t, jet} [GeV/c]", "p_{t, leading track}", 40, 0., 2.*TMath::Pi()/3., 350, -100, 250, 200, 0, 50, i);
672  fHistJetLJPsi3PtRatio[i] = BookTH3F("fHistJetLJPsi3PtRatio", Form("#phi_{part} - #Psi_{3, %s}", detector.Data()), Form("#phi_{jet} - #Psi_{3, %s}", detector.Data()), "p_{t, jet} [GeV/c]", 40, 0., 2.*TMath::Pi()/3., 40, 0., 2.*TMath::Pi()/3., 350, -100, 250, i);
673 
674  fHistJetPsi3PtRho0[i] = BookTH2F("fHistJetPsi3PtRho0", Form("#phi_{jet} - #Psi_{3, %s}", detector.Data()), "p_{t, jet} [GeV/c]", 40, 0., 2.*TMath::Pi()/3., 350, -100, 250, i);
675  // profiles for all correlator permutations which are necessary to calculate each second and third order event plane resolution
676  fProfV2Resolution[i] = new TProfile(Form("fProfV2Resolution_%i", i), Form("fProfV2Resolution_%i", i), 11, -0.5, 10.5);
677  fProfV2Resolution[i]->GetXaxis()->SetBinLabel(3, "<cos(2(#Psi_{VZEROA} - #Psi_{VZEROC}))>");
678  fProfV2Resolution[i]->GetXaxis()->SetBinLabel(4, "<cos(2(#Psi_{VZEROC} - #Psi_{VZEROA}))>");
679  fProfV2Resolution[i]->GetXaxis()->SetBinLabel(5, "<cos(2(#Psi_{VZEROA} - #Psi_{TPC}))>");
680  fProfV2Resolution[i]->GetXaxis()->SetBinLabel(6, "<cos(2(#Psi_{TPC} - #Psi_{VZEROA}))>");
681  fProfV2Resolution[i]->GetXaxis()->SetBinLabel(7, "<cos(2(#Psi_{VZEROC} - #Psi_{TPC}))>");
682  fProfV2Resolution[i]->GetXaxis()->SetBinLabel(8, "<cos(2(#Psi_{TPC} - #Psi_{VZEROC}))>");
683  fProfV2Resolution[i]->GetXaxis()->SetBinLabel(9, "<cos(2(#Psi_{VZERO} - #Psi_{TPC_A}))>");
684  fProfV2Resolution[i]->GetXaxis()->SetBinLabel(10, "<cos(2(#Psi_{VZERO} - #Psi_{TPC_B}))>");
685  fProfV2Resolution[i]->GetXaxis()->SetBinLabel(11, "<cos(2(#Psi_{TPC_A} - #Psi_{TPC_B}))>");
686  fOutputList->Add(fProfV2Resolution[i]);
687  fProfV3Resolution[i] = new TProfile(Form("fProfV3Resolution_%i", i), Form("fProfV3Resolution_%i", i), 11, -0.5, 10.5);
688  fProfV3Resolution[i]->GetXaxis()->SetBinLabel(3, "<cos(3(#Psi_{VZEROA} - #Psi_{VZEROC}))>");
689  fProfV3Resolution[i]->GetXaxis()->SetBinLabel(4, "<cos(3(#Psi_{VZEROC} - #Psi_{VZEROA}))>");
690  fProfV3Resolution[i]->GetXaxis()->SetBinLabel(5, "<cos(3(#Psi_{VZEROA} - #Psi_{TPC}))>");
691  fProfV3Resolution[i]->GetXaxis()->SetBinLabel(6, "<cos(3(#Psi_{TPC} - #Psi_{VZEROA}))>");
692  fProfV3Resolution[i]->GetXaxis()->SetBinLabel(7, "<cos(3(#Psi_{VZEROC} - #Psi_{TPC}))>");
693  fProfV3Resolution[i]->GetXaxis()->SetBinLabel(8, "<cos(3(#Psi_{TPC} - #Psi_{VZEROC}))>");
694  fProfV3Resolution[i]->GetXaxis()->SetBinLabel(9, "<cos(3(#Psi_{VZERO} - #Psi_{TPC_A}))>");
695  fProfV3Resolution[i]->GetXaxis()->SetBinLabel(10, "<cos(3(#Psi_{VZERO} - #Psi_{TPC_B}))>");
696  fProfV3Resolution[i]->GetXaxis()->SetBinLabel(11, "<cos(3(#Psi_{TPC_A} - #Psi_{TPC_B}))>");
697  fOutputList->Add(fProfV3Resolution[i]);
698  }
699  // vn profile
700  Float_t temp[fCentralityClasses->GetSize()];
701  for(Int_t i(0); i < fCentralityClasses->GetSize(); i++) temp[i] = fCentralityClasses->At(i);
702  fProfV2 = new TProfile("fProfV2", "fProfV2", fCentralityClasses->GetSize()-1, temp);
703  fProfV3 = new TProfile("fProfV3", "fProfV3", fCentralityClasses->GetSize()-1, temp);
704  fOutputList->Add(fProfV2);
705  fOutputList->Add(fProfV3);
706  switch (fFitModulationType) {
707  case kQC2 : {
708  fProfV2Cumulant = new TProfile("fProfV2Cumulant", "fProfV2Cumulant", fCentralityClasses->GetSize()-1, temp);
709  fProfV3Cumulant = new TProfile("fProfV3Cumulant", "fProfV3Cumulant", fCentralityClasses->GetSize()-1, temp);
711  fOutputList->Add(fProfV3Cumulant);
712  } break;
713  case kQC4 : {
714  fProfV2Cumulant = new TProfile("fProfV2Cumulant", "fProfV2Cumulant", fCentralityClasses->GetSize()-1, temp);
715  fProfV3Cumulant = new TProfile("fProfV3Cumulant", "fProfV3Cumulant", fCentralityClasses->GetSize()-1, temp);
717  fOutputList->Add(fProfV3Cumulant);
718  } break;
719  default : break;
720  }
721  // for the histograms initialized below, binning is fixed to runnumbers or flags
724  if(fFillQAHistograms) {
725  fHistRunnumbersEta = new TH2F("fHistRunnumbersEta", "fHistRunnumbersEta", fExpectedRuns->GetSize()+1, -.5, fExpectedRuns->GetSize()+.5, 100, -1.1, 1.1);
726  fHistRunnumbersEta->Sumw2();
728  fHistRunnumbersPhi = new TH2F("fHistRunnumbersPhi", "fHistRunnumbersPhi", fExpectedRuns->GetSize()+1, -.5, fExpectedRuns->GetSize()+.5, 100, -0.2, TMath::TwoPi()+0.2);
729  fHistRunnumbersPhi->Sumw2();
731  for(Int_t i(0); i < fExpectedRuns->GetSize(); i++) {
732  fHistRunnumbersPhi->GetXaxis()->SetBinLabel(i+1, Form("%i", fExpectedRuns->At(i)));
733  fHistRunnumbersEta->GetXaxis()->SetBinLabel(i+1, Form("%i", fExpectedRuns->At(i)));
734  }
735  fHistRunnumbersPhi->GetXaxis()->SetBinLabel(fExpectedRuns->GetSize()+1, "undetermined");
736  fHistRunnumbersEta->GetXaxis()->SetBinLabel(fExpectedRuns->GetSize()+1, "undetermined");
737  if(fCollisionType == kPbPb10h) {
738  // control histo to see if the calibration was properly kickstarted
739  fHistRunnumbersCaliInfo = new TH1I("fHistRunnumbersCaliInfo", "fHistRunnumbersCaliInfo", fExpectedRuns->GetSize()+1, -.5, fExpectedRuns->GetSize()+.5);
741  for(Int_t i(0); i < fExpectedRuns->GetSize(); i++) {
742  fHistRunnumbersCaliInfo->GetXaxis()->SetBinLabel(i+1, Form("%i", fExpectedRuns->At(i)));
743  }
744  fHistRunnumbersCaliInfo->GetXaxis()->SetBinLabel(fExpectedRuns->GetSize()+1, "undetermined");
745  }
746  }
747  fHistAnalysisSummary = BookTH1F("fHistAnalysisSummary", "flag", 54, -0.5, 54.5);
748  fHistSwap = new TH1F("fHistSwap", "fHistSwap", 20, 0, TMath::TwoPi());
749  if(fUsePtWeight) fHistSwap->Sumw2();
750 
755  for(Int_t i(0); i < 10; i++) {
756  if(fEventPlaneWeights[i]) {
757  // add the original event plane distribution histogram
758  fOutputList->Add((TH1F*)(fEventPlaneWeights[i]->Clone(Form("EP_distribution_original_cen_%i", i))));
759  // calculate the weights that will actually be used and store them
762  }
763  }
764  // increase readability of output list
765  fOutputList->Sort();
766  // cdf and pdf of chisquare distribution
767  fHistPvalueCDF = BookTH1F("fHistPvalueCDF", "CDF #chi^{2}", 50, 0, 1);
768  fHistPvalueCDFCent = BookTH2F("fHistPvalueCDFCent", "centrality", "p-value", 40, 0, 100, 40, 0, 1);
769  fHistChi2Cent = BookTH2F("fHistChi2Cent", "centrality", "#tilde{#chi^{2}}", 100, 0, 100, 100, 0, 5);
770  fHistPChi2 = BookTH2F("fHistPChi2", "p-value", "#tilde{#chi^{2}}", 1000, 0, 1, 100, 0, 5);
771  fHistKolmogorovTest = BookTH1F("fHistKolmogorovTest", "KolmogorovTest", 50, 0, 1);
772  fHistKolmogorovTestCent = BookTH2F("fHistKolmogorovTestCent", "centrality", "Kolmogorov p", 40, 0, 100, 45, 0, 1);
773  fHistPvalueCDFROOT = BookTH1F("fHistPvalueCDFROOT", "CDF #chi^{2} ROOT", 50, 0, 1);
774  fHistPvalueCDFROOTCent = BookTH2F("fHistPvalueCDFROOTCent", "centrality", "p-value ROOT", 40, 0, 100, 45, 0, 1);
775  fHistChi2ROOTCent = BookTH2F("fHistChi2ROOTCent", "centrality", "#tilde{#chi^{2}}", 40, 0, 100, 45, 0, 5);
776  fHistPChi2Root = BookTH2F("fHistPChi2Root", "p-value", "#tilde{#chi^{2}} ROOT", 1000, 0, 1, 100, 0, 5);
777  fHistPKolmogorov = BookTH2F("fHistPKolmogorov", "p-value", "kolmogorov p",40, 0, 1, 40, 0, 1);
778  fHistRhoStatusCent = BookTH2F("fHistRhoStatusCent", "centrality", "status [-1=lin was better, 0=ok, 1 = failed]", 101, -1, 100, 3, -1.5, 1.5);
779  fHistUndeterminedRunQA = BookTH1F("fHistUndeterminedRunQA", "runnumber", 10, 0, 10);
780 
781  // Mar 24 2016 - add some figures that are missing for the thesis
782  for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i ++) {
783  fHistRhoEtaBC[i] = BookTH2F("fHistRhoEtaBC", "#rho [GeV/c]", "#eta", 100, 0, 150, 50, -1, 1, i);
784  fHistJetPtBC[i] = BookTH1F("fHistJetPtBC", "p_{t, jet} [GeV/c]", 350, -100, 250, i);
785  fHistJetEtaPhiBC[i] = BookTH2F("fHistJetEtaPhiBC", "#eta", "#phi", 100, etaMin, etaMax, 100, phiMin, phiMax, i);
786  fHistJetPtAreaBC[i] = BookTH2F("fHistJetPtAreaBC", "p_{t, jet} [GeV/c]", "Area", 175, -100, 250, 30, 0, 0.3, i);
787  }
788  fHistQxV0aBC = BookTH2F("fHistQxV0aBC", "Q_{x} V0A", "centrality class", 140, -700, 700, 10, -.5, 9.5);
789  fHistQyV0aBC = BookTH2F("fHistQyV0aBC", "Q_{y} V0A", "centrality class", 140, -700, 700, 10, -.5, 9.5);
790  fHistQxV0cBC = BookTH2F("fHistQxV0cBC", "Q_{x} V0C", "centrality class", 140, -700, 700, 10, -.5, 9.5);
791  fHistQyV0cBC = BookTH2F("fHistQyV0cBC", "Q_{y} V0C", "centrality class", 140, -700, 700, 10, -.5, 9.5);
792  fHistQxV0a = BookTH2F("fHistQxV0a", "Q_{x} V0A", "centrality class", 100, -10, 10, 10, -.5, 9.5);
793  fHistQyV0a = BookTH2F("fHistQyV0a", "Q_{y} V0A", "centrality class", 100, -10, 10, 10, -.5, 9.5);
794  fHistQxV0c = BookTH2F("fHistQxV0c", "Q_{x} V0C", "centrality class", 100, -10, 10, 10, -.5, 9.5);
795  fHistQyV0c = BookTH2F("fHistQyV0c", "Q_{y} V0C", "centrality class", 100, -10, 10, 10, -.5, 9.5);
796  fHistMultVsCellBC = BookTH2F("fHistMultVsCellBC", "channel", "multiplicty", 64, -.5, 63.5, 100, 0, 1000);
797  fHistMultVsCell = BookTH2F("fHistMultVsCell", "channel", "multiplicty", 64, -.5, 63.5, 100, 0, 1000);
798  fHistEPBC = BookTH1F("fHistEPBC", "#Psi_{EP, 3}, uncalibrated", 100, -0.34*TMath::Pi(), 0.34*TMath::Pi());
799  fHistEP = BookTH1F("fHistEP", "#Psi_{EP, 3}, calibrated", 100, -0.34*TMath::Pi(), 0.34*TMath::Pi());
800 
801 
802 
803 
804  PostData((fCreateHisto) ? 2 : 1, fOutputList);
805 
806  switch (fRunModeType) {
807  case kLocal : {
808  fOutputListGood = new TList();
809  fOutputListGood->SetOwner(kTRUE);
810  fOutputListBad = new TList();
811  fOutputListBad->SetOwner(kTRUE);
812  PostData((fCreateHisto) ? 3 : 2, fOutputListGood);
813  PostData((fCreateHisto) ? 4 : 3, fOutputListBad);
814  } break;
815  default: break;
816  }
817 
818  // get the containers
819  fTracksCont = GetTrackContainer("Tracks");
820  fClusterCont = GetClusterContainer(0); // get the default cluster container
821  fJetsCont = GetJetContainer("Jets");
822 }
823 //_____________________________________________________________________________
825 {
826  // called for each accepted event (call made from user exec of parent class)
827  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
828  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
829  #endif
830  if(!fTracks||!fJets||!fRho) {
831  if(!fTracks) printf(" > Failed to retrieve fTracks ! < \n");
832  if(!fJets) printf(" > Failed to retrieve fJets ! < \n");
833  if(!fRho) printf(" > Failed to retrieve fRho ! < \n");
834  return kFALSE;
835  }
837  // reject the event if expected data is missing
838  if(!PassesCuts(InputEvent())) return kFALSE;
839  // cache the leading jet within acceptance
841  // set the rho value
842  fLocalRho->SetVal(fRho->GetVal());
843  // place holder arrays for the event planes
844  //
845  // [0][0] psi2a [1,0] psi2c
846  // [0][1] psi3a [1,1] psi3c
847  Double_t vzero[2][2];
848  /* for the combined vzero event plane
849  * [0] psi2 [1] psi3
850  * not fully implmemented yet, use with caution ! */
851  Double_t vzeroComb[2];
852  // [0] psi2 [1] psi3
853  Double_t tpc[2];
854  // evaluate the actual event planes
855  switch (fDetectorType) {
856  case kFixedEP : {
857  // for fixed, fix all ep's to default values
858  tpc[0] = 0.; tpc[1] = 1.;
859  vzero[0][0] = 0.; vzero[0][1] = 1.;
860  vzero[1][0] = 0.; vzero[1][1] = 1.;
861  vzeroComb[0] = 0.; vzeroComb[1] = 1.;
862  } break;
863  default : {
864  // else grab the actual data
868  } break;
869  }
870  Double_t psi2(-1), psi3(-1);
871  // arrays which will hold the fit parameters
872  switch (fDetectorType) { // determine the detector type for the rho fit
873  case kTPC : { psi2 = tpc[0]; psi3 = tpc[1]; } break;
874  case kVZEROA : { psi2 = vzero[0][0]; psi3 = vzero[0][1]; } break;
875  case kVZEROC : { psi2 = vzero[1][0]; psi3 = vzero[1][1]; } break;
876  case kVZEROComb : { psi2 = vzeroComb[0]; psi3 = vzeroComb[1];} break;
877  case kFixedEP : { psi2 = 0.; psi3 = 1.;} break;
878  default : break;
879  }
880  // if requested extract the event plane weight
881  fEventPlaneWeight = 1.; // ALWAYS reset to 1 here to avoid recycling an old weight if the next if-statement fails
883  // get the weight from the corresponding
884  fEventPlaneWeight = fEventPlaneWeights[fInCentralitySelection]->GetBinContent(fEventPlaneWeights[fInCentralitySelection]->FindBin(psi3));
885  }
886  // if requested store the acceptance weights
887  if(fAcceptanceWeights) {
888  Double_t percIn(0.), percOut(0.), percLost(0.);
889  NumericalOverlap(GetJetContainer()->GetJetEtaMin(), GetJetContainer()->GetJetEtaMax(),
890  psi3, percIn, percOut, percLost);
891  fHistCentralityPercIn->Fill(fCent, percIn);
892  fHistCentralityPercOut->Fill(fCent, percOut);
893  fHistCentralityPercLost->Fill(fCent, percLost);
894  }
895  switch (fFitModulationType) { // do the fits
896  case kNoFit : {
897  switch (fCollisionType) {
898  case kPythia : { // background is zero for pp jets
899  fFitModulation->FixParameter(0, 0);
900  fLocalRho->SetVal(0);
901  } break;
902  default : {
903  fFitModulation->FixParameter(0, fLocalRho->GetVal());
904  } break;
905  }
906  } break;
907  case kV2 : { // only v2
908  if(CorrectRho(psi2, psi3)) {
909  fProfV2->Fill(fCent, fFitModulation->GetParameter(3));
910  if(fUserSuppliedR2) {
911  Double_t r(fUserSuppliedR2->GetBinContent(fUserSuppliedR2->GetXaxis()->FindBin(fCent)));
912  if(r > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)/r);
913  }
914  CalculateEventPlaneResolution(vzero, vzeroComb, tpc);
915  }
916  } break;
917  case kV3 : { // only v3
918  if(CorrectRho(psi2, psi3)) {
919  if(fUserSuppliedR3) {
920  Double_t r(fUserSuppliedR3->GetBinContent(fUserSuppliedR3->GetXaxis()->FindBin(fCent)));
921  if(r > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)/r);
922  }
923  fProfV3->Fill(fCent, fFitModulation->GetParameter(3));
924  CalculateEventPlaneResolution(vzero, vzeroComb, tpc);
925  }
926  } break;
927  case kQC2 : { // qc2 analysis
928  if(CorrectRho(psi2, psi3)) {
930  // note for the qc method, resolution is REVERSED to go back to v2obs
931  Double_t r2(fUserSuppliedR2->GetBinContent(fUserSuppliedR2->GetXaxis()->FindBin(fCent)));
932  Double_t r3(fUserSuppliedR3->GetBinContent(fUserSuppliedR3->GetXaxis()->FindBin(fCent)));
933  if(r2 > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)*r2);
934  if(r3 > 0) fFitModulation->SetParameter(7, fFitModulation->GetParameter(7)*r3);
935  }
936  if (fUsePtWeight) { // use weighted weights
937  Double_t dQCnM11 = (fNoEventWeightsForQC) ? 1. : QCnM11();
938  fProfV2->Fill(fCent, fFitModulation->GetParameter(3), dQCnM11);
939  fProfV3->Fill(fCent, fFitModulation->GetParameter(7), dQCnM11);
940  } else {
941  Double_t dQCnM = (fNoEventWeightsForQC) ? 2. : QCnM();
942  fProfV2->Fill(fCent, fFitModulation->GetParameter(3), dQCnM*(dQCnM-1));
943  fProfV3->Fill(fCent, fFitModulation->GetParameter(7), dQCnM*(dQCnM-1));
944  }
945  CalculateEventPlaneResolution(vzero, vzeroComb, tpc);
946  }
947  } break;
948  case kQC4 : {
949  if(CorrectRho(psi2, psi3)) {
951  // note for the qc method, resolution is REVERSED to go back to v2obs
952  Double_t r2(fUserSuppliedR2->GetBinContent(fUserSuppliedR2->GetXaxis()->FindBin(fCent)));
953  Double_t r3(fUserSuppliedR3->GetBinContent(fUserSuppliedR3->GetXaxis()->FindBin(fCent)));
954  if(r2 > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)*r2);
955  if(r3 > 0) fFitModulation->SetParameter(7, fFitModulation->GetParameter(7)*r3);
956  }
957  if (fUsePtWeight) { // use weighted weights
958  fProfV2->Fill(fCent, TMath::Power(fFitModulation->GetParameter(3),0.5)/*, QCnM1111()*/);
959  fProfV3->Fill(fCent, TMath::Power(fFitModulation->GetParameter(7),0.5)/*, QCnM1111()*/);
960  } else {
961  fProfV2->Fill(fCent, TMath::Power(fFitModulation->GetParameter(3),0.5)/*, QCnM()*(QCnM()-1)*(QCnM()-2)*(QCnM()-3)*/);
962  fProfV3->Fill(fCent, TMath::Power(fFitModulation->GetParameter(7),0.5)/*, QCnM()*(QCnM()-1)*(QCnM()-2)*(QCnM()-3)*/);
963  }
964  }
965  CalculateEventPlaneResolution(vzero, vzeroComb, tpc);
966  } break;
967  default : {
968  if(CorrectRho(psi2, psi3)) {
970  Double_t r2(fUserSuppliedR2->GetBinContent(fUserSuppliedR2->GetXaxis()->FindBin(fCent)));
971  Double_t r3(fUserSuppliedR3->GetBinContent(fUserSuppliedR3->GetXaxis()->FindBin(fCent)));
972  if(r2 > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)/r2);
973  if(r3 > 0) fFitModulation->SetParameter(7, fFitModulation->GetParameter(7)/r3);
974  }
975  fProfV2->Fill(fCent, fFitModulation->GetParameter(3));
976  fProfV3->Fill(fCent, fFitModulation->GetParameter(7));
977  CalculateEventPlaneResolution(vzero, vzeroComb, tpc);
978  }
979  } break;
980  }
981  // if all went well, update the local rho parameter
983  // and only at this point can the leading jet after rho subtraction be evaluated
985  // fill a number of histograms. event qa needs to be filled first as it also determines the runnumber for the track qa
987  if(fFillHistograms) FillHistogramsAfterSubtraction(psi3, vzero, vzeroComb, tpc);
988  // send the output to the connected output container
989  PostData((fCreateHisto) ? 2 : 1, fOutputList);
990  switch (fRunModeType) {
991  case kLocal : {
992  PostData((fCreateHisto) ? 3 : 2, fOutputListGood);
993  PostData((fCreateHisto) ? 4 : 3, fOutputListBad);
994  } break;
995  default: break;
996  }
997  return kTRUE;
998 }
999 //_____________________________________________________________________________
1001 {
1002  // for stand alone, avoid framework event setup
1003  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1004  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1005  #endif
1006  switch (fCollisionType) {
1007  case kJetFlowMC : {
1008  // need to call ExecOnce as it is not loaded otherwise
1011  } break;
1012 // case kPbPb10h : {
1013 // // bypass framework event selection. additional check for fTracks
1014 // // to avoid the situation where base classes are never initialized
1015 // if(fTracks && fTracks->GetEntriesFast() > 0) AliAnalysisTaskJetV3::Run();
1016 // else AliAnalysisTaskSE::Exec(c);
1017 // } break;
1018  default : {
1019  AliAnalysisTaskSE::Exec(c);
1020  } break;
1021  }
1022 }
1023 //_____________________________________________________________________________
1025 {
1026  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_2
1027  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1028  #endif
1029  // numerically integrate with finite resolution
1030  // idea is the following:
1031  // 1) choose a vector phi
1032  // 2) see if it is in a region of overlap between detector and in/out of plane spectrum
1033  // 3) bookkeep percentages over overlap
1034  Double_t a(psi3 - TMath::Pi()/4.);
1035  // poor man's appproach: fix the frame
1036  if(a < 0) a += TMath::Pi();
1037  // set the rest of the event
1038  Double_t b(a + TMath::Pi()/2.);
1039  Double_t c(b + TMath::Pi()/2.);
1040  Double_t d(c + TMath::Pi()/2.);
1041  Double_t e(d + TMath::Pi()/2.); // may seem mysterious but here for good reasons
1042  // get percetnages
1043  Double_t interval(TMath::TwoPi() / 1000.);
1044  percIn = 0.;
1045  percOut = 0.;
1046  percLost = 0.;
1047  Int_t status(-1);
1048  // automagically do the integration
1049  for(Double_t i = a; i < a+TMath::TwoPi()-interval; i += interval) {
1050  status = OverlapsWithPlane(x1, x2, a, b, c, d, e, i);
1051  if(status == 0 ) percLost += .001;
1052  else if(status == 1 ) percIn += 0.001;
1053  else if(status == 2 ) percOut += 0.001;
1054  }
1055 }
1056 //_____________________________________________________________________________
1058  Double_t x1, Double_t x2, // detector geometry relative to ep
1059  Double_t a, Double_t b, Double_t c, Double_t d, Double_t e, // in-plane, out-of-plane boundaries (see comments)
1060  Double_t phi) // variable
1061 {
1062  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_2
1063  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1064  #endif
1065  // 'numerical integration' of geometric overlap
1066  //
1067  // works as follows: for a given vector phi determines whether
1068  // or not this vector points towards an overlap region of
1069  // detector geometry and plane (in or out)
1070  //
1071  // returns
1072  // 1) if overlap with in plane
1073  // 2) if overlap with out of plane
1074  // 0) if no overlap at all
1075  Int_t overlap(0);
1076  // check for condition in-plane
1077  // conditions are always checked as
1078  // 1) is the angle within in-plane sector?
1079  // 2) is the angle also within detector acceptance?
1080  if(phi > a && phi < b && phi > x1 && phi < x2) overlap = 1;
1081  if(phi > c && phi < d && phi > x1 && phi < x2) overlap = 1;
1082  // likewise for out-of-plane
1083  if(phi > b && phi < c && phi > x1 && phi < x2) overlap = 2;
1084  if(phi > d && phi < e && phi > x1 && phi < x2) overlap = 2;
1085 
1086  // life would be so much easier if the detector was flat instead of cylindrical ....
1087  x1+=TMath::TwoPi();
1088  x2+=TMath::TwoPi();
1089 
1090  if(phi > a && phi < b && phi > x1 && phi < x2) overlap = 1;
1091  if(phi > c && phi < d && phi > x1 && phi < x2) overlap = 1;
1092  // likewise for out-of-plane
1093  if(phi > b && phi < c && phi > x1 && phi < x2) overlap = 2;
1094  if(phi > d && phi < e && phi > x1 && phi < x2) overlap = 2;
1095 
1096  return overlap;
1097 }
1098 //_____________________________________________________________________________
1100 {
1101  // return chi for given resolution to combine event plane estimates from two subevents
1102  // see Phys. Rev. C no. CS6346 (http://arxiv.org/abs/nucl-ex/9805001)
1103  Double_t chi(2.), delta(1.), con((TMath::Sqrt(TMath::Pi()))/(2.*TMath::Sqrt(2)));
1104  for (Int_t i(0); i < 15; i++) {
1105  chi = ((con*chi*TMath::Exp(-chi*chi/4.)*(TMath::BesselI0(chi*chi/4.)+TMath::BesselI1(chi*chi/4.))) < res) ? chi + delta : chi - delta;
1106  delta = delta / 2.;
1107  }
1108  return chi;
1109 }
1110 //_____________________________________________________________________________
1112 {
1113  // get the vzero event plane (a and c separately)
1114  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1115  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1116  #endif
1117  switch (fCollisionType) {
1118  case kPbPb10h : {
1119  // for 10h data, get the calibrated q-vector from the database
1120  Double_t QA2[] = {-999., -999.};
1121  Double_t QA3[] = {-999., -999.};
1122  Double_t QC2[] = {-999., -999.};
1123  Double_t QC3[] = {-999., -999.};
1124  CalculateQvectorVZERO(QA2, QC2, QA3, QC3);
1125  vzero[0][0] = .5*TMath::ATan2(QA2[1], QA2[0]);
1126  vzero[1][0] = .5*TMath::ATan2(QC2[1], QC2[0]);
1127  vzero[0][1] = (1./3.)*TMath::ATan2(QA3[1], QA3[0]);
1128  vzero[1][1] = (1./3.)*TMath::ATan2(QC3[1], QC3[0]);
1129  return; // paranoid return
1130  } break;
1131  case kPbPb15o : {
1132  Int_t VZEROcentralityBin(GetVZEROCentralityBin());
1133  Double_t Qxan = 0, Qyan = 0;
1134  Double_t Qxcn = 0, Qycn = 0;
1135  Double_t Qxa3 = 0, Qya3 = 0;
1136  Double_t Qxc3 = 0, Qyc3 = 0;
1137  Double_t Qxa3_raw = 0, Qya3_raw = 0;
1138  Double_t Qxc3_raw = 0, Qyc3_raw = 0;
1139  Double_t sumMa = 0, sumMc = 0;
1140  AliVVZERO* aodV0 = (InputEvent())->GetVZEROData();
1141  for (Int_t iV0 = 0; iV0 < 64; iV0++) {
1142  Double_t phiV0 = TMath::PiOver4()*(0.5 + iV0 % 8);
1143  Float_t multv0 = aodV0->GetMultiplicity(iV0);
1144  if (iV0 < 32){
1145  Double_t multCorC = -10;
1146  if (iV0 < 8) multCorC = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(1);
1147  else if (iV0 >= 8 && iV0 < 16) multCorC = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(9);
1148  else if (iV0 >= 16 && iV0 < 24) multCorC = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(17);
1149  else if (iV0 >= 24 && iV0 < 32) multCorC = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(25);
1150  if (multCorC < 0) cout<<"Problem with multiplicity in V0C"<<endl;
1151  Qxcn += TMath::Cos(2.*phiV0) * multCorC;
1152  Qycn += TMath::Sin(2.*phiV0) * multCorC;
1153  Qxc3 += TMath::Cos(3.*phiV0) * multCorC;
1154  Qxc3_raw += TMath::Cos(3.*phiV0) * multv0;
1155  Qyc3 += TMath::Sin(3.*phiV0) * multCorC;
1156  Qyc3_raw += TMath::Sin(3.*phiV0) * multv0;
1157  sumMc = sumMc + multCorC;
1158  if(fFillQAHistograms) {
1159  fHistMultVsCellBC->Fill(iV0, multv0);
1160  fHistMultVsCell->Fill(iV0, multCorC);
1161  }
1162  } else {
1163  Double_t multCorA = -10;
1164  if (iV0 >= 32 && iV0 < 40) multCorA = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(33);
1165  else if (iV0 >= 40 && iV0 < 48) multCorA = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(41);
1166  else if (iV0 >= 48 && iV0 < 56) multCorA = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(49);
1167  else if (iV0 >= 56 && iV0 < 64) multCorA = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(57);
1168  if (multCorA < 0) cout<<"Problem with multiplicity in V0A"<<endl;
1169  Qxan += TMath::Cos(2.*phiV0) * multCorA;
1170  Qyan += TMath::Sin(2.*phiV0) * multCorA;
1171  Qxa3 += TMath::Cos(3.*phiV0) * multCorA;
1172  Qxa3_raw += TMath::Cos(3.*phiV0) * multv0;
1173  Qya3 += TMath::Sin(3.*phiV0) * multCorA;
1174  Qya3_raw += TMath::Sin(3.*phiV0) * multv0;
1175  sumMa = sumMa + multCorA;
1176  if(fFillQAHistograms) {
1177  fHistMultVsCellBC->Fill(iV0, multv0);
1178  fHistMultVsCell->Fill(iV0, multCorA);
1179  }
1180  }
1181  }
1182  if (sumMa <=0 || sumMc <= 0) return;
1183  Double_t iCentSPD = GetCentrality("CL1");
1184  Double_t QyanCor = (Qyan - fMQ[1][0][0]->GetBinContent(iCentSPD+1))/fWQ[1][0][0]->GetBinContent(iCentSPD+1);
1185  Double_t QycnCor = (Qycn - fMQ[1][1][0]->GetBinContent(iCentSPD+1))/fWQ[1][1][0]->GetBinContent(iCentSPD+1);
1186  Double_t QxanCor = (Qxan - fMQ[0][0][0]->GetBinContent(iCentSPD+1))/fWQ[0][0][0]->GetBinContent(iCentSPD+1);
1187  Double_t QxcnCor = (Qxcn - fMQ[0][1][0]->GetBinContent(iCentSPD+1))/fWQ[0][1][0]->GetBinContent(iCentSPD+1);
1188  vzero[0][0] = .5*TMath::ATan2(QyanCor,QxanCor);
1189  vzero[1][0] = .5*TMath::ATan2(QycnCor,QxcnCor);
1190  QyanCor = (Qya3 - fMQ[1][0][1]->GetBinContent(iCentSPD+1))/fWQ[1][0][1]->GetBinContent(iCentSPD+1);
1191  QycnCor = (Qyc3 - fMQ[1][1][1]->GetBinContent(iCentSPD+1))/fWQ[1][1][1]->GetBinContent(iCentSPD+1);
1192  QxanCor = (Qxa3 - fMQ[0][0][1]->GetBinContent(iCentSPD+1))/fWQ[0][0][1]->GetBinContent(iCentSPD+1);
1193  QxcnCor = (Qxc3 - fMQ[0][1][1]->GetBinContent(iCentSPD+1))/fWQ[0][1][1]->GetBinContent(iCentSPD+1);
1194  vzero[0][1] = (1./3.)*TMath::ATan2(QyanCor,QxanCor);
1195  vzero[1][1] = (1./3.)*TMath::ATan2(QycnCor,QxcnCor);
1196  if(fFillQAHistograms) {
1197  fHistQxV0aBC->Fill(Qxa3_raw, VZEROcentralityBin);
1198  fHistQyV0aBC->Fill(Qya3_raw, VZEROcentralityBin);
1199  fHistQxV0cBC->Fill(Qxc3_raw, VZEROcentralityBin);
1200  fHistQyV0cBC->Fill(Qyc3_raw, VZEROcentralityBin);
1201  fHistQxV0a->Fill(QxanCor, VZEROcentralityBin);
1202  fHistQyV0a->Fill(QyanCor, VZEROcentralityBin);
1203  fHistQxV0c->Fill(QxcnCor, VZEROcentralityBin);
1204  fHistQyV0c->Fill(QycnCor, VZEROcentralityBin);
1205  fHistEPBC->Fill((1./3.)*TMath::ATan2(Qyc3_raw+Qya3_raw,Qxc3_raw+Qxa3_raw));
1206  fHistEP->Fill((1./3.)*TMath::ATan2(QycnCor+QyanCor,QxcnCor+QxanCor));
1207 ;
1208  }
1209  } break;
1210  default: {
1211  // by default use the ep from the event header (make sure EP selection task is enabeled!)
1212  Double_t a(0), b(0), c(0), d(0), e(0), f(0), g(0), h(0);
1213  vzero[0][0] = InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 8, 2, a, b);
1214  vzero[1][0] = InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 9, 2, c, d);
1215  vzero[0][1] = InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 8, 3, e, f);
1216  vzero[1][1] = InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 9, 3, g, h);
1217  return;
1218  }
1219  }
1220 }
1221 //_____________________________________________________________________________
1223 {
1224  // return the combined vzero event plane
1225  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1226  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1227  #endif
1228 
1229  // define some placeholders
1230  Double_t Q2[] = {-999., -999.};
1231  Double_t Q3[] = {-999., -999.};
1232 
1233  switch (fCollisionType) {
1234  // for 10h data call calibration info
1235  case kPbPb10h : {
1236  // get the calibrated q-vectors
1238  comb[0] = .5*TMath::ATan2(Q2[1], Q2[0]);
1239  comb[1] = (1./3.)*TMath::ATan2(Q3[1], Q3[0]);
1240  } break;
1241  case kPbPb15o : { //V0 info
1242  Double_t Qxan = 0, Qyan = 0;
1243  Double_t Qxcn = 0, Qycn = 0;
1244  Double_t Qxa3 = 0, Qya3 = 0;
1245  Double_t Qxc3 = 0, Qyc3 = 0;
1246  Double_t sumMa = 0, sumMc = 0;
1247  AliVVZERO* aodV0 =(InputEvent())->GetVZEROData();
1248  for (Int_t iV0 = 0; iV0 < 64; iV0++) {
1249  Double_t phiV0 = TMath::PiOver4()*(0.5 + iV0 % 8);
1250  Float_t multv0 = aodV0->GetMultiplicity(iV0);
1251  if (iV0 < 32){
1252  Double_t multCorC = -10;
1253  if (iV0 < 8) multCorC = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(1);
1254  else if (iV0 >= 8 && iV0 < 16) multCorC = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(9);
1255  else if (iV0 >= 16 && iV0 < 24) multCorC = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(17);
1256  else if (iV0 >= 24 && iV0 < 32) multCorC = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(25);
1257  if (multCorC < 0) cout<<"Problem with multiplicity in V0C"<<endl;
1258  Qxcn += TMath::Cos(2.*phiV0) * multCorC;
1259  Qycn += TMath::Sin(2.*phiV0) * multCorC;
1260  Qxc3 += TMath::Cos(3.*phiV0) * multCorC;
1261  Qyc3 += TMath::Sin(3.*phiV0) * multCorC;
1262  sumMc = sumMc + multCorC;
1263  } else {
1264  Double_t multCorA = -10;
1265  if (iV0 >= 32 && iV0 < 40) multCorA = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(33);
1266  else if (iV0 >= 40 && iV0 < 48) multCorA = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(41);
1267  else if (iV0 >= 48 && iV0 < 56) multCorA = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(49);
1268  else if (iV0 >= 56 && iV0 < 64) multCorA = multv0/fVZEROgainEqualization->GetBinContent(iV0+1)*fVZEROgainEqualization->GetBinContent(57);
1269  if (multCorA < 0) cout<<"Problem with multiplicity in V0A"<<endl;
1270  Qxan += TMath::Cos(2.*phiV0) * multCorA;
1271  Qyan += TMath::Sin(2.*phiV0) * multCorA;
1272  Qxa3 += TMath::Cos(3.*phiV0) * multCorA;
1273  Qya3 += TMath::Sin(3.*phiV0) * multCorA;
1274  sumMa = sumMa + multCorA;
1275  }
1276  }
1277  if (sumMa <=0 || sumMc <= 0) return;
1278  Double_t iCentSPD = GetCentrality("CL1");
1279  Double_t QyanCor = (Qyan - fMQ[1][0][0]->GetBinContent(iCentSPD+1))/fWQ[1][0][0]->GetBinContent(iCentSPD+1);
1280  Double_t QycnCor = (Qycn - fMQ[1][1][0]->GetBinContent(iCentSPD+1))/fWQ[1][1][0]->GetBinContent(iCentSPD+1);
1281  Double_t QxanCor = (Qxan - fMQ[0][0][0]->GetBinContent(iCentSPD+1))/fWQ[0][0][0]->GetBinContent(iCentSPD+1);
1282  Double_t QxcnCor = (Qxcn - fMQ[0][1][0]->GetBinContent(iCentSPD+1))/fWQ[0][1][0]->GetBinContent(iCentSPD+1);
1283  comb[0] = .5*TMath::ATan2(QyanCor+QycnCor,QxanCor+QxcnCor);
1284  QyanCor = (Qya3 - fMQ[1][0][1]->GetBinContent(iCentSPD+1))/fWQ[1][0][1]->GetBinContent(iCentSPD+1);
1285  QycnCor = (Qyc3 - fMQ[1][1][1]->GetBinContent(iCentSPD+1))/fWQ[1][1][1]->GetBinContent(iCentSPD+1);
1286  QxanCor = (Qxa3 - fMQ[0][0][1]->GetBinContent(iCentSPD+1))/fWQ[0][0][1]->GetBinContent(iCentSPD+1);
1287  QxcnCor = (Qxc3 - fMQ[0][1][1]->GetBinContent(iCentSPD+1))/fWQ[0][1][1]->GetBinContent(iCentSPD+1);
1288  comb[1] = (1./3.)*TMath::ATan2(QyanCor+QycnCor,QxanCor+QxcnCor);
1289  } break;
1290  default : {
1291  // for all other types use calibrated event plane from the event header
1292  //
1293  // note that the code is a bit messy here. for 10h data retrieving q-vectors of
1294  // the separate vzero detectors and combining the q-vectors have dedicated functions.
1295  // for 11h however this is all done in this function (the lines below)
1296  // reason is that the procedure is much shorter as the calibration is done in another task
1297  //
1298  // define some pleaceholders to the values by reference
1299  Double_t qx2a(0), qy2a(0), qx2c(0), qy2c(0), qx3a(0), qy3a(0), qx3c(0), qy3c(0);
1300  // get the q-vectors by reference
1301  InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 8, 2, qx2a, qy2a);
1302  InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 9, 2, qx2c, qy2c);
1303  InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 8, 3, qx3a, qy3a);
1304  InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 9, 3, qx3c, qy3c);
1305 
1306  // get cache index and retrieve the chi weights for this centrality
1307  Int_t VZEROcentralityBin(GetVZEROCentralityBin());
1308  Double_t chi2A(1);
1309  Double_t chi2C(1);
1310  Double_t chi3A(1);
1311  Double_t chi3C(1);
1312 
1313  switch (fWeightForVZERO) {
1314  case kChi : {
1315  chi2A = fChi2A->At(VZEROcentralityBin);
1316  chi2C = fChi2C->At(VZEROcentralityBin);
1317  chi3A = fChi3A->At(VZEROcentralityBin);
1318  chi3C = fChi3C->At(VZEROcentralityBin);
1319  } break;
1320  case kSigmaSquared : {
1321  chi2A = fSigma2A->At(VZEROcentralityBin);
1322  chi2C = fSigma2C->At(VZEROcentralityBin);
1323  chi3A = fSigma3A->At(VZEROcentralityBin);
1324  chi3C = fSigma3C->At(VZEROcentralityBin);
1325  chi2A = (chi2A > 0) ? 1./chi2A : 1.;
1326  chi2C = (chi2C > 0) ? 1./chi2C : 1.;
1327  chi3A = (chi3A > 0) ? 1./chi3A : 1.;
1328  chi3C = (chi3C > 0) ? 1./chi3C : 1.;
1329  } break;
1330  default : break;
1331  }
1332 
1333  // combine the vzera and vzeroc signal
1334  Q2[0] = chi2A*chi2A*qx2a+chi2C*chi2C*qx2c;
1335  Q2[1] = chi2A*chi2A*qy2a+chi2C*chi2C*qy2c;
1336  Q3[0] = chi3A*chi3A*qx3a+chi3C*chi3C*qx3c;
1337  Q3[1] = chi3A*chi3A*qy3a+chi3C*chi3C*qy3c;
1338 
1339  comb[0] = .5*TMath::ATan2(Q2[1], Q2[0]);
1340  comb[1] = (1./3.)*TMath::ATan2(Q3[1], Q3[0]);
1341 
1342  Double_t _chi(0), _sigma(0), _none(0);
1343  // if requested do the EP correlation histos
1345  switch (fWeightForVZERO) {
1346  case kNone : {
1347  chi2A = fChi2A->At(VZEROcentralityBin);
1348  chi2C = fChi2C->At(VZEROcentralityBin);
1349  _chi = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1350  chi2A = fSigma2A->At(VZEROcentralityBin);
1351  chi2C = fSigma2C->At(VZEROcentralityBin);
1352  chi2A = (chi2A > 0) ? 1./chi2A : 1.;
1353  chi2C = (chi2C > 0) ? 1./chi2C : 1.;
1354  _sigma = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1355  fHistEPCorrelations[fInCentralitySelection]->Fill(.5*TMath::ATan2(qy2a+qy2c,qx2a+qx2c), _chi, _sigma);
1356  } break;
1357  case kChi : {
1358  _chi = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1359  chi2A = fSigma2A->At(VZEROcentralityBin);
1360  chi2C = fSigma2C->At(VZEROcentralityBin);
1361  chi2A = (chi2A > 0) ? 1./chi2A : 1.;
1362  chi2C = (chi2C > 0) ? 1./chi2C : 1.;
1363  _sigma = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1364  fHistEPCorrelations[fInCentralitySelection]->Fill(.5*TMath::ATan2(qy2a+qy2c,qx2a+qx2c), _chi, _sigma);
1365  } break;
1366  case kSigmaSquared : {
1367  _sigma = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1368  chi2A = fChi2A->At(VZEROcentralityBin);
1369  chi2C = fChi2C->At(VZEROcentralityBin);
1370  _chi = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1371  fHistEPCorrelations[fInCentralitySelection]->Fill(.5*TMath::ATan2(qy2a+qy2c,qx2a+qx2c), _chi, _sigma);
1372  } break;
1373  default : break;
1374  }
1375  _none = .5*TMath::ATan2(qy2a+qy2c,qx2a+qx2c);
1376  fHistEPCorrAvChi[fInCentralitySelection]->Fill(_none, _chi);
1377  fHistEPCorrAvSigma[fInCentralitySelection]->Fill(_none, _sigma);
1378  fHistEPCorrChiSigma[fInCentralitySelection]->Fill(_chi, _sigma);
1379  }
1380  }
1381  }
1382 }
1383 //_____________________________________________________________________________
1385 {
1386  // grab the TPC event plane
1387  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1388  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1389  #endif
1390  fNAcceptedTracks = 0; // reset the track counter
1391  Double_t qx2(0), qy2(0); // for psi2
1392  Double_t qx3(0), qy3(0); // for psi3
1393  if(fTracksCont) {
1394  Float_t excludeInEta = -999;
1395  if(fExcludeLeadingJetsFromFit > 0 ) { // remove the leading jet from ep estimate
1396  if(fLeadingJet) excludeInEta = fLeadingJet->Eta();
1397  }
1398  for(Int_t iTPC(0); iTPC < fTracksCont->GetNEntries(); iTPC++) {
1399  AliVParticle* track = fTracksCont->GetParticle(iTPC);
1400  if(!PassesCuts(track) || track->Pt() < fSoftTrackMinPt || track->Pt() > fSoftTrackMaxPt) continue;
1401  if(fExcludeLeadingJetsFromFit > 0 &&( (TMath::Abs(track->Eta() - excludeInEta) < GetJetContainer()->GetJetRadius()*fExcludeLeadingJetsFromFit ) || (TMath::Abs(track->Eta()) - GetJetContainer()->GetJetRadius() - GetJetContainer()->GetJetEtaMax() ) > 0 )) continue;
1402  fNAcceptedTracks++;
1403  qx2+= TMath::Cos(2.*track->Phi());
1404  qy2+= TMath::Sin(2.*track->Phi());
1405  qx3+= TMath::Cos(3.*track->Phi());
1406  qy3+= TMath::Sin(3.*track->Phi());
1407  }
1408  }
1409  tpc[0] = .5*TMath::ATan2(qy2, qx2);
1410  tpc[1] = (1./3.)*TMath::ATan2(qy3, qx3);
1411  fTracksCont->ResetCurrentID();
1412 }
1413 //_____________________________________________________________________________
1415 {
1416  // fill the profiles for the resolution parameters
1417  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1418  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1419  #endif
1420  fProfV2Resolution[fInCentralitySelection]->Fill(2., TMath::Cos(2.*(vzero[0][0] - vzero[1][0])));
1421  fProfV2Resolution[fInCentralitySelection]->Fill(3., TMath::Cos(2.*(vzero[1][0] - vzero[0][0])));
1422  fProfV2Resolution[fInCentralitySelection]->Fill(4., TMath::Cos(2.*(vzero[0][0] - tpc[0])));
1423  fProfV2Resolution[fInCentralitySelection]->Fill(5., TMath::Cos(2.*(tpc[0] - vzero[0][0])));
1424  fProfV2Resolution[fInCentralitySelection]->Fill(6., TMath::Cos(2.*(vzero[1][0] - tpc[0])));
1425  fProfV2Resolution[fInCentralitySelection]->Fill(7., TMath::Cos(2.*(tpc[0] - vzero[1][0])));
1426  fProfV3Resolution[fInCentralitySelection]->Fill(2., TMath::Cos(3.*(vzero[0][0] - vzero[1][0])));
1427  fProfV3Resolution[fInCentralitySelection]->Fill(3., TMath::Cos(3.*(vzero[1][0] - vzero[0][0])));
1428  fProfV3Resolution[fInCentralitySelection]->Fill(4., TMath::Cos(3.*(vzero[0][0] - tpc[0])));
1429  fProfV3Resolution[fInCentralitySelection]->Fill(5., TMath::Cos(3.*(tpc[0] - vzero[0][0])));
1430  fProfV3Resolution[fInCentralitySelection]->Fill(6., TMath::Cos(3.*(vzero[1][0] - tpc[0])));
1431  fProfV3Resolution[fInCentralitySelection]->Fill(7., TMath::Cos(3.*(tpc[0] - vzero[1][0])));
1432  // for the resolution of the combined vzero event plane, use two tpc halves as uncorrelated subdetectors
1433  Double_t qx2a(0), qy2a(0); // for psi2a, negative eta
1434  Double_t qx3a(0), qy3a(0); // for psi3a, negative eta
1435  Double_t qx2b(0), qy2b(0); // for psi2a, positive eta
1436  Double_t qx3b(0), qy3b(0); // for psi3a, positive eta
1437  if(fTracks) {
1438  Int_t iTracks(fTracks->GetEntriesFast());
1439  for(Int_t iTPC(0); iTPC < iTracks; iTPC++) {
1440  AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(iTPC));
1441  if(!PassesCuts(track) || track->Pt() < fSoftTrackMinPt || track->Pt() > fSoftTrackMaxPt) continue;
1442  if(track->Eta() < 0 ) {
1443  qx2a+= TMath::Cos(2.*track->Phi());
1444  qy2a+= TMath::Sin(2.*track->Phi());
1445  qx3a+= TMath::Cos(3.*track->Phi());
1446  qy3a+= TMath::Sin(3.*track->Phi());
1447  } else if (track->Eta() > 0) {
1448  qx2b+= TMath::Cos(2.*track->Phi());
1449  qy2b+= TMath::Sin(2.*track->Phi());
1450  qx3b+= TMath::Cos(3.*track->Phi());
1451  qy3b+= TMath::Sin(3.*track->Phi());
1452  }
1453  }
1454  }
1455  Double_t tpca2(.5*TMath::ATan2(qy2a, qx2a));
1456  Double_t tpca3((1./3.)*TMath::ATan2(qy3a, qx3a));
1457  Double_t tpcb2(.5*TMath::ATan2(qy2b, qx2b));
1458  Double_t tpcb3((1./3.)*TMath::ATan2(qy3b, qx3b));
1459  fProfV2Resolution[fInCentralitySelection]->Fill(8., TMath::Cos(2.*(vzeroComb[0] - tpca2)));
1460  fProfV2Resolution[fInCentralitySelection]->Fill(9., TMath::Cos(2.*(vzeroComb[0] - tpcb2)));
1461  fProfV2Resolution[fInCentralitySelection]->Fill(10., TMath::Cos(2.*(tpca2 - tpcb2)));
1462  fProfV3Resolution[fInCentralitySelection]->Fill(8., TMath::Cos(3.*(vzeroComb[1] - tpca3)));
1463  fProfV3Resolution[fInCentralitySelection]->Fill(9., TMath::Cos(3.*(vzeroComb[1] - tpcb3)));
1464  fProfV3Resolution[fInCentralitySelection]->Fill(10., TMath::Cos(3.*(tpca3 - tpcb3)));
1465  fTracksCont->ResetCurrentID();
1466 }
1467 //_____________________________________________________________________________
1469 {
1470  // return the calibrated 2nd and 3rd order q-vectors for vzeroa and vzeroc
1471  // function takes arrays as arguments, which correspond to vzero info in the following way
1472  //
1473  // Qa2[0] = Qx2 for vzero A Qa2[1] = Qy2 for vzero A (etc)
1474 
1475  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1476  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1477  #endif
1478  // placeholders
1479  Double_t phi(-999.), mult(-999.);
1480  // reset placeholders for Q-vector components
1481  Qa2[0] = 0.; Qc2[0] = 0.; Qa3[0] = 0.; Qc3[0] = 0.;
1482  Qa2[1] = 0.; Qc2[1] = 0.; Qa3[1] = 0.; Qc3[1] = 0.;
1483  // for qa purposes, save also raw signal
1484  Double_t QaX(0), QaY(0), QcX(0), QcY(0);
1485  for(Int_t i(0); i < 64; i++) {
1486  // loop over all scintillators, construct Q-vectors in the same loop
1487  phi = TMath::PiOver4()*(0.5+i%8);
1488  mult = InputEvent()->GetVZEROData()->GetMultiplicity(i);
1489  if(fFillQAHistograms) fHistMultVsCellBC->Fill(i, mult);
1490  // note that disabled rings have already been excluded in ReadVZEROCalibration2010h
1491  if(i < 32) { // v0c side
1492  // fill Q-vectors for v0c side
1493  Qc2[0] += mult*TMath::Cos(2.*phi)*fVZEROCpol/fVZEROgainEqualization->GetBinContent(1+i);
1494  Qc3[0] += mult*TMath::Cos(3.*phi)*fVZEROCpol/fVZEROgainEqualization->GetBinContent(1+i);
1495  Qc2[1] += mult*TMath::Sin(2.*phi)*fVZEROCpol/fVZEROgainEqualization->GetBinContent(1+i);
1496  Qc3[1] += mult*TMath::Sin(3.*phi)*fVZEROCpol/fVZEROgainEqualization->GetBinContent(1+i);
1497  if(fFillQAHistograms) {
1498  fHistMultVsCell->Fill(i, mult*fVZEROCpol/fVZEROgainEqualization->GetBinContent(1+i));
1499  QcX += mult*TMath::Cos(2.*phi);
1500  QcY += mult*TMath::Sin(2.*phi);
1501  }
1502  } else { // v0a side
1503  // fill Q-vectors for v0a side
1504  Qa2[0] += mult*TMath::Cos(2.*phi)*fVZEROApol/fVZEROgainEqualization->GetBinContent(1+i);
1505  Qa3[0] += mult*TMath::Cos(3.*phi)*fVZEROApol/fVZEROgainEqualization->GetBinContent(1+i);
1506  Qa2[1] += mult*TMath::Sin(2.*phi)*fVZEROApol/fVZEROgainEqualization->GetBinContent(1+i);
1507  Qa3[1] += mult*TMath::Sin(3.*phi)*fVZEROApol/fVZEROgainEqualization->GetBinContent(1+i);
1508  if(fFillQAHistograms) {
1509  fHistMultVsCell->Fill(i, mult*fVZEROApol/fVZEROgainEqualization->GetBinContent(1+i));
1510  QaX += mult*TMath::Cos(2.*phi);
1511  QaY += mult*TMath::Sin(2.*phi);
1512  }
1513  }
1514  }
1515  // get the cache index and read the correction terms from the cache
1516  Int_t VZEROcentralityBin(GetVZEROCentralityBin());
1517 
1518  if(fFillQAHistograms) {
1519  // recentering qa
1520  fHistQxV0aBC->Fill(Qa2[0], VZEROcentralityBin);
1521  fHistQyV0aBC->Fill(Qa2[1], VZEROcentralityBin);
1522  fHistQxV0cBC->Fill(Qc2[0], VZEROcentralityBin);
1523  fHistQyV0cBC->Fill(Qc2[0], VZEROcentralityBin);
1524  fHistEPBC->Fill(.5*TMath::ATan2(QaY+QcY, QaX+QcX));
1525  }
1526 
1527  Double_t Qx2amean = fMeanQ[VZEROcentralityBin][1][0];
1528  Double_t Qx2arms = fWidthQ[VZEROcentralityBin][1][0];
1529  Double_t Qy2amean = fMeanQ[VZEROcentralityBin][1][1];
1530  Double_t Qy2arms = fWidthQ[VZEROcentralityBin][1][1];
1531 
1532  Double_t Qx2cmean = fMeanQ[VZEROcentralityBin][0][0];
1533  Double_t Qx2crms = fWidthQ[VZEROcentralityBin][0][0];
1534  Double_t Qy2cmean = fMeanQ[VZEROcentralityBin][0][1];
1535  Double_t Qy2crms = fWidthQ[VZEROcentralityBin][0][1];
1536 
1537  Double_t Qx3amean = fMeanQv3[VZEROcentralityBin][1][0];
1538  Double_t Qx3arms = fWidthQv3[VZEROcentralityBin][1][0];
1539  Double_t Qy3amean = fMeanQv3[VZEROcentralityBin][1][1];
1540  Double_t Qy3arms = fWidthQv3[VZEROcentralityBin][1][1];
1541 
1542  Double_t Qx3cmean = fMeanQv3[VZEROcentralityBin][0][0];
1543  Double_t Qx3crms = fWidthQv3[VZEROcentralityBin][0][0];
1544  Double_t Qy3cmean = fMeanQv3[VZEROcentralityBin][0][1];
1545  Double_t Qy3crms = fWidthQv3[VZEROcentralityBin][0][1];
1546 
1547  // update the weighted q-vectors with the re-centered values
1548  Qa2[0] = (Qa2[0] - Qx2amean)/Qx2arms;
1549  Qa2[1] = (Qa2[1] - Qy2amean)/Qy2arms;
1550  Qc2[0] = (Qc2[0] - Qx2cmean)/Qx2crms;
1551  Qc2[1] = (Qc2[1] - Qy2cmean)/Qy2crms;
1552 
1553  Qa3[0] = (Qa3[0] - Qx3amean)/Qx3arms;
1554  Qa3[1] = (Qa3[1] - Qy3amean)/Qy3arms;
1555  Qc3[0] = (Qc3[0] - Qx3cmean)/Qx3crms;
1556  Qc3[1] = (Qc3[1] - Qy3cmean)/Qy3crms;
1557 
1558  if(fFillQAHistograms) {
1559  // recentering qa
1560  fHistQxV0a->Fill(Qa2[0], VZEROcentralityBin);
1561  fHistQyV0a->Fill(Qa2[1], VZEROcentralityBin);
1562  fHistQxV0c->Fill(Qc2[0], VZEROcentralityBin);
1563  fHistQyV0c->Fill(Qc2[0], VZEROcentralityBin);
1564  fHistEP->Fill(.5*TMath::ATan2(Qa2[1]+Qc2[1], Qa2[0]+Qc2[0]));
1565  }
1566 }
1567 //_____________________________________________________________________________
1569 {
1570  // calculate calibrated q-vector of the combined vzeroa, vzeroc system
1571  // this is somewhat ugly as CalculateQvectorCombinedVZERO is called more than once per event
1572  // but for now it will have to do ...
1573  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1574  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1575  #endif
1576 
1577  // first step: retrieve the q-vectors component-wise per vzero detector
1578  Double_t QA2[] = {-999., -999.};
1579  Double_t QA3[] = {-999., -999.};
1580  Double_t QC2[] = {-999., -999.};
1581  Double_t QC3[] = {-999., -999.};
1582  CalculateQvectorVZERO(QA2, QC2, QA3, QC3);
1583 
1584  // get cache index and retrieve the chi weights for this centrality
1585  Int_t VZEROcentralityBin(GetVZEROCentralityBin());
1586  Double_t chi2A(1);
1587  Double_t chi2C(1);
1588  Double_t chi3A(1);
1589  Double_t chi3C(1);
1590 
1591  switch (fWeightForVZERO) {
1592  case kChi : {
1593  chi2A = fChi2A->At(VZEROcentralityBin);
1594  chi2C = fChi2C->At(VZEROcentralityBin);
1595  chi3A = fChi3A->At(VZEROcentralityBin);
1596  chi3C = fChi3C->At(VZEROcentralityBin);
1597  } break;
1598  case kSigmaSquared : {
1599  chi2A = fSigma2A->At(VZEROcentralityBin);
1600  chi2C = fSigma2C->At(VZEROcentralityBin);
1601  chi3A = fSigma3A->At(VZEROcentralityBin);
1602  chi3C = fSigma3C->At(VZEROcentralityBin);
1603  chi2A = (chi2A > 0) ? 1./chi2A : 1.;
1604  chi2C = (chi2C > 0) ? 1./chi2C : 1.;
1605  chi3A = (chi3A > 0) ? 1./chi3A : 1.;
1606  chi3C = (chi3C > 0) ? 1./chi3C : 1.;
1607  } break;
1608  default : break;
1609  }
1610 
1611  // bookkkeep these guys
1612  Double_t qx2a(QA2[0]), qy2a(QA2[1]), qx2c(QC2[0]), qy2c(QC2[1]);
1613  // combine the vzera and vzeroc signal
1614  Q2[0] = chi2A*chi2A*QA2[0]+chi2C*chi2C*QC2[0];
1615  Q2[1] = chi2A*chi2A*QA2[1]+chi2C*chi2C*QC2[1];
1616  Q3[0] = chi3A*chi3A*QA3[0]+chi3C*chi3C*QC3[0];
1617  Q3[1] = chi3A*chi3A*QA3[1]+chi3C*chi3C*QC3[1];
1618 
1619  Double_t _chi(0), _sigma(0), _none(0);
1620  // if requested do the EP correlation histos
1622  switch (fWeightForVZERO) {
1623  case kNone : {
1624  chi2A = fChi2A->At(VZEROcentralityBin);
1625  chi2C = fChi2C->At(VZEROcentralityBin);
1626  _chi = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1627  chi2A = fSigma2A->At(VZEROcentralityBin);
1628  chi2C = fSigma2C->At(VZEROcentralityBin);
1629  chi2A = (chi2A > 0) ? 1./chi2A : 1.;
1630  chi2C = (chi2C > 0) ? 1./chi2C : 1.;
1631  _sigma = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1632  fHistEPCorrelations[fInCentralitySelection]->Fill(.5*TMath::ATan2(qy2a+qy2c,qx2a+qx2c), _chi, _sigma);
1633  } break;
1634  case kChi : {
1635  _chi = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1636  chi2A = fSigma2A->At(VZEROcentralityBin);
1637  chi2C = fSigma2C->At(VZEROcentralityBin);
1638  chi2A = (chi2A > 0) ? 1./chi2A : 1.;
1639  chi2C = (chi2C > 0) ? 1./chi2C : 1.;
1640  _sigma = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1641  fHistEPCorrelations[fInCentralitySelection]->Fill(.5*TMath::ATan2(qy2a+qy2c,qx2a+qx2c), _chi, _sigma);
1642  } break;
1643  case kSigmaSquared : {
1644  _sigma = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1645  chi2A = fChi2A->At(VZEROcentralityBin);
1646  chi2C = fChi2C->At(VZEROcentralityBin);
1647  _chi = .5*TMath::ATan2(chi2A*chi2A*qy2a+chi2C*chi2C*qy2c, chi2A*chi2A*qx2a+chi2C*chi2C*qx2c);
1648  fHistEPCorrelations[fInCentralitySelection]->Fill(.5*TMath::ATan2(qy2a+qy2c,qx2a+qx2c), _chi, _sigma);
1649  } break;
1650  default : break;
1651  }
1652  _none = .5*TMath::ATan2(qy2a+qy2c,qx2a+qx2c);
1653  fHistEPCorrAvChi[fInCentralitySelection]->Fill(_none, _chi);
1654  fHistEPCorrAvSigma[fInCentralitySelection]->Fill(_none, _sigma);
1655  fHistEPCorrChiSigma[fInCentralitySelection]->Fill(_chi, _sigma);
1656  }
1657 }
1658 //_____________________________________________________________________________
1660  AliTrackContainer* tracksCont, AliClusterContainer* clusterCont, AliEmcalJet* jet) const
1661 {
1662  // get a random cone
1663  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_2
1664  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1665  #endif
1666  pt = 0; eta = 0; phi = 0;
1667  Float_t etaJet(999), phiJet(999), dJet(999); // no jet: same as jet very far away
1668  if(jet) { // if a leading jet is given, use its kinematic properties to exclude it
1669  etaJet = jet->Eta();
1670  phiJet = jet->Phi();
1671  }
1672  // the random cone acceptance has to equal the jet acceptance
1673  // this also insures safety when runnnig on the semi-good tpc runs for 11h data,
1674  // where jet acceptance is adjusted to reduced acceptance - hence random cone acceptance as well
1675  Float_t minPhi(GetJetContainer()->GetJetPhiMin()), maxPhi(GetJetContainer()->GetJetPhiMax());
1676  if(maxPhi > TMath::TwoPi()) maxPhi = TMath::TwoPi();
1677  if(minPhi < 0 ) minPhi = 0.;
1678  // construct a random cone and see if it's far away enough from the leading jet
1679  Int_t attempts(1000);
1680  while(kTRUE) {
1681  attempts--;
1682  eta = gRandom->Uniform(GetJetContainer()->GetJetEtaMin(), GetJetContainer()->GetJetEtaMax());
1683  phi = gRandom->Uniform(minPhi, maxPhi);
1684 
1685  dJet = TMath::Sqrt((etaJet-eta)*(etaJet-eta)+(phiJet-phi)*(phiJet-phi));
1686  if(dJet > fMinDisanceRCtoLJ) break;
1687  else if (attempts == 0) {
1688  printf(" > No random cone after 1000 tries, giving up ... !\n");
1689  return;
1690  }
1691  }
1692  // get the charged energy (if tracks are provided)
1693  if(tracksCont) {
1694  tracksCont->ResetCurrentID();
1695  AliVParticle* track = tracksCont->GetNextAcceptParticle();
1696  while(track) {
1697  Float_t etaTrack(track->Eta()), phiTrack(track->Phi());
1698  // get distance from cone
1699  if(TMath::Abs(phiTrack-phi) > TMath::Abs(phiTrack - phi + TMath::TwoPi())) phiTrack+=TMath::TwoPi();
1700  if(TMath::Abs(phiTrack-phi) > TMath::Abs(phiTrack - phi - TMath::TwoPi())) phiTrack-=TMath::TwoPi();
1701  if(TMath::Sqrt(TMath::Abs((etaTrack-eta)*(etaTrack-eta)+(phiTrack-phi)*(phiTrack-phi))) <= GetJetRadius()) pt += track->Pt();
1702  track = tracksCont->GetNextAcceptParticle();
1703  }
1704  }
1705 
1706  // get the neutral energy (if clusters are provided)
1707  if(clusterCont) {
1708  TLorentzVector momentum;
1709  clusterCont->ResetCurrentID();
1710  AliVCluster* cluster = clusterCont->GetNextAcceptCluster();
1711  while(cluster) {
1712  cluster->GetMomentum(momentum, const_cast<Double_t*>(fVertex));
1713  Float_t etaClus(momentum.Eta()), phiClus(momentum.Phi());
1714  // get distance from cone
1715  if(TMath::Abs(phiClus-phi) > TMath::Abs(phiClus - phi + TMath::TwoPi())) phiClus+=TMath::TwoPi();
1716  if(TMath::Abs(phiClus-phi) > TMath::Abs(phiClus - phi - TMath::TwoPi())) phiClus-=TMath::TwoPi();
1717  if(TMath::Sqrt(TMath::Abs((etaClus-eta)*(etaClus-eta)+(phiClus-phi)*(phiClus-phi))) <= GetJetRadius()) pt += momentum.Pt();
1718  cluster = clusterCont->GetNextAcceptCluster();
1719  }
1720  }
1721 }
1722 //_____________________________________________________________________________
1724  // get the second order q-cumulant, a -999 return will be caught in the qa routine of CorrectRho
1725  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1726  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1727  #endif
1728  Double_t reQ(0), imQ(0), modQ(0), M11(0), M(0);
1729  if(fUsePtWeight) { // for the weighted 2-nd order q-cumulant
1730  QCnQnk(harm, 1, reQ, imQ); // get the weighted 2-nd order q-vectors
1731  modQ = reQ*reQ+imQ*imQ; // get abs Q-squared
1732  M11 = QCnM11(); // equals S2,1 - S1,2
1733  return (M11 > 0) ? ((modQ - QCnS(1,2))/M11) : -999;
1734  } // else return the non-weighted 2-nd order q-cumulant
1735  QCnQnk(harm, 0, reQ, imQ); // get the non-weighted 2-nd order q-vectors
1736  modQ = reQ*reQ+imQ*imQ; // get abs Q-squared
1737  M = QCnM();
1738  return (M > 1) ? (modQ - M)/(M*(M-1)) : -999;
1739 }
1740 //_____________________________________________________________________________
1742  // get the fourth order q-cumulant, a -999 return will be caught in the qa routine of CorrectRho
1743  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1744  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1745  #endif
1746  Double_t reQn1(0), imQn1(0), reQ2n2(0), imQ2n2(0), reQn3(0), imQn3(0), M1111(0), M(0);
1747  Double_t a(0), b(0), c(0), d(0), e(0), f(0), g(0); // terms of the calculation
1748  if(fUsePtWeight) { // for the weighted 4-th order q-cumulant
1749  QCnQnk(harm, 1, reQn1, imQn1);
1750  QCnQnk(harm*2, 2, reQ2n2, imQ2n2);
1751  QCnQnk(harm, 3, reQn3, imQn3);
1752  // fill in the terms ...
1753  a = (reQn1*reQn1+imQn1*imQn1)*(reQn1*reQn1+imQn1*imQn1);
1754  b = reQ2n2*reQ2n2 + imQ2n2*imQ2n2;
1755  c = -2.*(reQ2n2*reQn1*reQn1-reQ2n2*imQn1*imQn1+2.*imQ2n2*reQn1*imQn1);
1756  d = 8.*(reQn3*reQn1+imQn3*imQn1);
1757  e = -4.*QCnS(1,2)*(reQn1*reQn1+imQn1*imQn1);
1758  f = -6.*QCnS(1,4);
1759  g = 2.*QCnS(2,2);
1760  M1111 = QCnM1111();
1761  return (M1111 > 0) ? (a+b+c+d+e+f+g)/M1111 : -999;
1762  } // else return the unweighted case
1763  Double_t reQn(0), imQn(0), reQ2n(0), imQ2n(0);
1764  QCnQnk(harm, 0, reQn, imQn);
1765  QCnQnk(harm*2, 0, reQ2n, imQ2n);
1766  // fill in the terms ...
1767  M = QCnM();
1768  if(M < 4) return -999;
1769  a = (reQn*reQn+imQn*imQn)*(reQn*reQn+imQn*imQn);
1770  b = reQ2n*reQ2n + imQ2n*imQ2n;
1771  c = -2.*(reQ2n*reQn*reQn-reQ2n*imQn*imQn+2.*imQ2n*reQn*imQn);
1772  e = -4.*(M-2)*(reQn*reQn+imQn*imQn);
1773  f = 2.*M*(M-3);
1774  return (a+b+c+e+f)/(M*(M-1)*(M-2)*(M-3));
1775 }
1776 //_____________________________________________________________________________
1778  // get the weighted n-th order q-vector, pass real and imaginary part as reference
1779  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1780  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1781  #endif
1782  if(!fTracks) return;
1783  fNAcceptedTracksQCn = 0;
1784  Int_t iTracks(fTracks->GetEntriesFast());
1785  for(Int_t iTPC(0); iTPC < iTracks; iTPC++) {
1786  AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(iTPC));
1787  if(!PassesCuts(track) || track->Pt() < fSoftTrackMinPt || track->Pt() > fSoftTrackMaxPt) continue;
1789  // for the unweighted case, k equals zero and the weight doesn't contribute to the equation below
1790  reQ += TMath::Power(track->Pt(), k) * TMath::Cos(((double)n)*track->Phi());
1791  imQ += TMath::Power(track->Pt(), k) * TMath::Sin(((double)n)*track->Phi());
1792  }
1793 }
1794 //_____________________________________________________________________________
1796  TClonesArray* pois, TArrayD* ptBins, Bool_t vpart, Double_t* repn, Double_t* impn,
1797  Double_t *mp, Double_t *reqn, Double_t *imqn, Double_t* mq, Int_t n)
1798 {
1799  // get unweighted differential flow vectors
1800  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1801  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1802  #endif
1803  Int_t iPois(pois->GetEntriesFast());
1804  if(vpart) {
1805  for(Int_t i(0); i < iPois; i++) {
1806  for(Int_t ptBin(0); ptBin < ptBins->GetSize()-1; ptBin++) {
1807  AliVTrack* poi = static_cast<AliVTrack*>(pois->At(i));
1808  if(PassesCuts(poi)) {
1809  if(poi->Pt() >= ptBins->At(ptBin) && poi->Pt() < ptBins->At(ptBin+1)) {
1810  // fill the flow vectors assuming that all poi's are in the rp selection (true by design)
1811  repn[ptBin]+=TMath::Cos(((double)n)*poi->Phi());
1812  impn[ptBin]+=TMath::Sin(((double)n)*poi->Phi());
1813  mp[ptBin]++;
1814  reqn[ptBin]+=TMath::Cos(((double)n)*poi->Phi());
1815  imqn[ptBin]+=TMath::Sin(((double)n)*poi->Phi());
1816  mq[ptBin]++;
1817  }
1818  }
1819  }
1820  }
1821  } else {
1822  for(Int_t i(0); i < iPois; i++) {
1823  for(Int_t ptBin(0); ptBin < ptBins->GetSize()-1; ptBin++) {
1824  AliEmcalJet* poi = static_cast<AliEmcalJet*>(pois->At(i));
1825  if(PassesCuts(poi)) {
1826  Double_t pt(poi->Pt()-poi->Area()*fLocalRho->GetLocalVal(poi->Phi(), GetJetContainer()->GetJetRadius(), fLocalRho->GetVal()));
1827  if(fUse2DIntegration) pt = poi->Pt()-poi->Area()*fLocalRho->GetLocalValInEtaPhi(poi->Phi(), GetJetContainer()->GetJetRadius(), fLocalRho->GetVal());
1828  if(pt >= ptBins->At(ptBin) && pt < ptBins->At(ptBin+1)) {
1829  repn[ptBin]+=TMath::Cos(((double)n)*poi->Phi());
1830  impn[ptBin]+=TMath::Sin(((double)n)*poi->Phi());
1831  mp[ptBin]++; // qn isn't filled, no overlap between poi's and rp's
1832  }
1833  }
1834  }
1835  }
1836  }
1837 }
1838 //_____________________________________________________________________________
1840  // get the weighted ij-th order autocorrelation correction
1841  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1842  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1843  #endif
1844  if(!fTracks || i <= 0 || j <= 0) return -999;
1845  Int_t iTracks(fTracks->GetEntriesFast());
1846  Double_t Sij(0);
1847  for(Int_t iTPC(0); iTPC < iTracks; iTPC++) {
1848  AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(iTPC));
1849  if(!PassesCuts(track) || track->Pt() < fSoftTrackMinPt || track->Pt() > fSoftTrackMaxPt) continue;
1850  Sij+=TMath::Power(track->Pt(), j);
1851  }
1852  return TMath::Power(Sij, i);
1853 }
1854 //_____________________________________________________________________________
1856  // get multiplicity for unweighted q-cumulants. function QCnQnk should be called first
1857  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1858  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1859  #endif
1860  return (Double_t) fNAcceptedTracksQCn;
1861 }
1862 //_____________________________________________________________________________
1864  // get multiplicity weights for the weighted two particle cumulant
1865  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1866  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1867  #endif
1868  return (QCnS(2,1) - QCnS(1,2));
1869 }
1870 //_____________________________________________________________________________
1872  // get multiplicity weights for the weighted four particle cumulant
1873  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1874  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1875  #endif
1876  return (QCnS(4,1)-6*QCnS(1,2)*QCnS(2,1)+8*QCnS(1,3)*QCnS(1,1)+3*QCnS(2,2)-6*QCnS(1,4));
1877 }
1878 //_____________________________________________________________________________
1880  // decides how to deal with the situation where c2 or c3 is negative
1881  // returns kTRUE depending on whether or not a modulated rho is used for the jet background
1882  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1883  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1884  #endif
1885  if(TMath::AreEqualAbs(fFitModulation->GetParameter(3), .0, 1e-10) && TMath::AreEqualAbs(fFitModulation->GetParameter(7), .0,1e-10)) {
1886  fFitModulation->SetParameter(7, 0);
1887  fFitModulation->SetParameter(3, 0);
1888  fFitModulation->SetParameter(0, fLocalRho->GetVal());
1889  return kTRUE; // v2 and v3 have physical null values
1890  }
1891  switch (fQCRecovery) {
1892  case kFixedRho : { // roll back to the original rho
1893  fFitModulation->SetParameter(7, 0);
1894  fFitModulation->SetParameter(3, 0);
1895  fFitModulation->SetParameter(0, fLocalRho->GetVal());
1896  return kFALSE; // rho is forced to be fixed
1897  }
1898  case kNegativeVn : {
1899  Double_t c2(fFitModulation->GetParameter(3));
1900  Double_t c3(fFitModulation->GetParameter(7));
1901  if( c2 < 0 ) c2 = -1.*TMath::Sqrt(-1.*c2);
1902  if( c3 < 0 ) c3 = -1.*TMath::Sqrt(-1.*c3);
1903  fFitModulation->SetParameter(3, c2);
1904  fFitModulation->SetParameter(7, c3);
1905  return kTRUE; // is this a physical quantity ?
1906  }
1907  case kTryFit : {
1908  fitModulationType tempType(fFitModulationType); // store temporarily
1910  fFitModulation->SetParameter(7, 0);
1911  fFitModulation->SetParameter(3, 0);
1912  Bool_t pass(CorrectRho(psi2, psi3)); // do the fit and all quality checks
1913  fFitModulationType = tempType; // roll back for next event
1914  return pass;
1915  }
1916  default : return kFALSE;
1917  }
1918  return kFALSE;
1919 }
1920 //_____________________________________________________________________________
1922 {
1923  // get rho' -> rho(phi)
1924  // two routines are available, both can be used with or without pt weights
1925  // [1] get vn from q-cumulants or as an integrated value from a user supplied histogram
1926  // in case of cumulants, both cumulants and vn values are stored. in both cases, v2 and v3
1927  // are expected. a check is performed to see if rho has no negative local minimum
1928  // for full description, see Phys. Rev. C 83, 044913
1929  // since the cn distribution has negative values, vn = sqrt(cn) can be imaginary sometimes
1930  // in this case one can either roll back to the 'original' rixed rho, do a fit for vn or take use
1931  // vn = - sqrt(|cn|)
1932  // [2] fitting a fourier expansion to the de/dphi distribution
1933  // the fit can be done with either v2, v3 or a combination.
1934  // in all cases, a cut can be made on the p-value of the chi-squared value of the fit
1935  // and a check can be performed to see if rho has no negative local minimum
1936  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
1937  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1938  #endif
1939  Int_t freeParams(2); // free parameters of the fit (for NDF)
1940  switch (fFitModulationType) { // for approaches where no fitting is required
1941  case kQC2 : {
1942  fFitModulation->FixParameter(4, psi2);
1943  fFitModulation->FixParameter(6, psi3);
1944  fFitModulation->FixParameter(3, CalculateQC2(2)); // set here with cn, vn = sqrt(cn)
1945  fFitModulation->FixParameter(7, CalculateQC2(3));
1946  // first fill the histos of the raw cumulant distribution
1947  if (fUsePtWeight) { // use weighted weights
1948  Double_t dQCnM11 = (fNoEventWeightsForQC) ? 1. : QCnM11();
1949  fProfV2Cumulant->Fill(fCent, fFitModulation->GetParameter(3), dQCnM11);
1950  fProfV3Cumulant->Fill(fCent, fFitModulation->GetParameter(7), dQCnM11);
1951  } else {
1952  Double_t dQCnM = (fNoEventWeightsForQC) ? 2. : QCnM();
1953  fProfV2Cumulant->Fill(fCent, fFitModulation->GetParameter(3), dQCnM*(dQCnM-1));
1954  fProfV3Cumulant->Fill(fCent, fFitModulation->GetParameter(7), dQCnM*(dQCnM-1));
1955  }
1956  // then see if one of the cn value is larger than zero and vn is readily available
1957  if(fFitModulation->GetParameter(3) > 0 && fFitModulation->GetParameter(7) > 0) {
1958  fFitModulation->FixParameter(3, TMath::Sqrt(fFitModulation->GetParameter(3)));
1959  fFitModulation->FixParameter(7, TMath::Sqrt(fFitModulation->GetParameter(7)));
1960  } else if (!QCnRecovery(psi2, psi3)) return kFALSE; // try to recover the cumulant, this will set v2 and v3
1961  if(fFitModulation->GetMinimum(0, TMath::TwoPi()) < 0) { // general check
1962  fFitModulation->SetParameter(7, 0);
1963  fFitModulation->SetParameter(3, 0);
1964  fFitModulation->SetParameter(0, fLocalRho->GetVal());
1965  return kFALSE;
1966  }
1967  return kTRUE;
1968  } break;
1969  case kQC4 : {
1970  fFitModulation->FixParameter(4, psi2);
1971  fFitModulation->FixParameter(6, psi3);
1972  fFitModulation->FixParameter(3, CalculateQC4(2)); // set here with cn, vn = sqrt(cn)
1973  fFitModulation->FixParameter(7, CalculateQC4(3));
1974  // first fill the histos of the raw cumulant distribution
1975  if (fUsePtWeight) { // use weighted weights
1976  fProfV2Cumulant->Fill(fCent, fFitModulation->GetParameter(3)/*, QCnM1111()*/);
1977  fProfV3Cumulant->Fill(fCent, fFitModulation->GetParameter(7)/*, QCnM1111()*/);
1978  } else {
1979  fProfV2Cumulant->Fill(fCent, fFitModulation->GetParameter(3)/*, QCnM1111()*/);
1980  fProfV3Cumulant->Fill(fCent, fFitModulation->GetParameter(7)/*, QCnM1111()*/);
1981  }
1982  // then see if one of the cn value is larger than zero and vn is readily available
1983  if(fFitModulation->GetParameter(3) > 0 && fFitModulation->GetParameter(7) > 0) {
1984  fFitModulation->FixParameter(3, TMath::Sqrt(fFitModulation->GetParameter(3)));
1985  fFitModulation->FixParameter(7, TMath::Sqrt(fFitModulation->GetParameter(7)));
1986  } else if (!QCnRecovery(psi2, psi3)) return kFALSE; // try to recover the cumulant, this will set v2 and v3
1987  if(fFitModulation->GetMinimum(0, TMath::TwoPi()) < 0) { // general check
1988  fFitModulation->SetParameter(7, 0);
1989  fFitModulation->SetParameter(3, 0);
1990  fFitModulation->SetParameter(0, fLocalRho->GetVal());
1991  return kFALSE;
1992  }
1993  } break;
1994  case kIntegratedFlow : {
1995  // use v2 and v3 values from an earlier iteration over the data
1996  fFitModulation->FixParameter(3, fUserSuppliedV2->GetBinContent(fUserSuppliedV2->GetXaxis()->FindBin(fCent)));
1997  fFitModulation->FixParameter(4, psi2);
1998  fFitModulation->FixParameter(6, psi3);
1999  fFitModulation->FixParameter(7, fUserSuppliedV3->GetBinContent(fUserSuppliedV3->GetXaxis()->FindBin(fCent)));
2000  if(fFitModulation->GetMinimum(0, TMath::TwoPi()) < 0) {
2001  fFitModulation->SetParameter(7, 0);
2002  fFitModulation->SetParameter(3, 0);
2003  fFitModulation->SetParameter(0, fLocalRho->GetVal());
2004  return kFALSE;
2005  }
2006  return kTRUE;
2007  }
2008  default : break;
2009  }
2010  TString detector("");
2011  switch (fDetectorType) {
2012  case kTPC : detector+="TPC";
2013  break;
2014  case kVZEROA : detector+="VZEROA";
2015  break;
2016  case kVZEROC : detector+="VZEROC";
2017  break;
2018  case kVZEROComb : detector+="VZEROComb";
2019  break;
2020  case kFixedEP : detector+="FixedEP";
2021  break;
2022  default: break;
2023  }
2024  Int_t iTracks(fTracks->GetEntriesFast());
2025  Double_t excludeInEta = -999;
2026  Double_t excludeInPhi = -999;
2027  Double_t excludeInPt = -999;
2028  if(iTracks <= 0 || fLocalRho->GetVal() <= 0 ) return kFALSE; // no use fitting an empty event ...
2029  if(fExcludeLeadingJetsFromFit > 0 ) {
2030  if(fLeadingJet) {
2031  excludeInEta = fLeadingJet->Eta();
2032  excludeInPhi = fLeadingJet->Phi();
2033  excludeInPt = fLeadingJet->Pt();
2034  }
2035  }
2036  // check the acceptance of the track selection that will be used
2037  // if one uses e.g. semi-good tpc tracks, accepance in phi is reduced to 0 < phi < 4
2038  // the defaults (-10 < phi < 10) which accept all, are then overwritten
2039  Double_t lowBound(0.), upBound(TMath::TwoPi()); // bounds for fit
2040  if(GetTrackContainer()->GetParticlePhiMin() > lowBound) lowBound = GetTrackContainer()->GetParticlePhiMin();
2041  if(GetTrackContainer()->GetParticlePhiMax() < upBound) upBound = GetTrackContainer()->GetParticlePhiMax();
2042  fHistSwap->Reset(); // clear the histogram
2043  TH1F _tempSwap; // on stack for quick access
2044  TH1F _tempSwapN; // on stack for quick access, bookkeeping histogram
2046  if(fNAcceptedTracks < 49) fNAcceptedTracks = 49; // avoid aliasing effects
2047  _tempSwap = TH1F("_tempSwap", "_tempSwap", TMath::CeilNint(TMath::Sqrt(fNAcceptedTracks)), lowBound, upBound);
2048  if(fUsePtWeightErrorPropagation) _tempSwapN = TH1F("_tempSwapN", "_tempSwapN", TMath::CeilNint(TMath::Sqrt(fNAcceptedTracks)), lowBound, upBound);
2049  if(fUsePtWeight) _tempSwap.Sumw2();
2050  }
2051  else _tempSwap = *fHistSwap; // now _tempSwap holds the desired histo
2052  // non poissonian error when using pt weights
2053  Double_t totalpts(0.), totalptsquares(0.), totalns(0.);
2054 
2055  fTracksCont->ResetCurrentID();
2056  AliVParticle* track = fTracksCont->GetNextAcceptParticle();
2057  while(track) {
2058  /*
2059  if(fExcludeLeadingJetsFromFit > 0 &&( (TMath::Abs(track->Eta() - excludeInEta) < GetJetContainer()->GetJetRadius()*fExcludeLeadingJetsFromFit ) || (TMath::Abs(track->Eta()) - GetJetContainer()->GetJetRadius() - GetJetContainer()->GetJetEtaMax() ) > 0 )) {
2060  track = fTracksCont->GetNextAcceptParticle();
2061  continue;
2062  }
2063  if(track->Pt() > fSoftTrackMaxPt || track->Pt() < fSoftTrackMinPt) {
2064  track = fTracksCont->GetNextAcceptParticle();
2065  continue;
2066  }*/
2067  if(fUsePtWeight) {
2068  _tempSwap.Fill(track->Phi(), track->Pt());
2070  totalpts += track->Pt();
2071  totalptsquares += track->Pt()*track->Pt();
2072  totalns += 1;
2073  _tempSwapN.Fill(track->Phi());
2074  }
2075  }
2076  else _tempSwap.Fill(track->Phi());
2078  }
2080  // in the case of pt weights overwrite the poissonian error estimate which is assigned by root by a more sophisticated appraoch
2081  // the assumption here is that the bin error will be dominated by the uncertainty in the mean pt in a bin and in the uncertainty
2082  // of the number of tracks in a bin, the first of which will be estimated from the sample standard deviation of all tracks in the
2083  // event, for the latter use a poissonian estimate. the two contrubitions are assumed to be uncorrelated
2084  if(totalns < 2) return kFALSE; // not one track passes the cuts > 2 avoids possible division by 0 later on
2085  for(Int_t l = 0; l < _tempSwap.GetNbinsX(); l++) {
2086  if(_tempSwapN.GetBinContent(l+1) == 0) {
2087  _tempSwap.SetBinContent(l+1,0);
2088  _tempSwap.SetBinError(l+1,0);
2089  }
2090  else {
2091  Double_t vartimesnsq = totalptsquares*totalns - totalpts*totalpts;
2092  Double_t variance = vartimesnsq/(totalns*(totalns-1.));
2093  Double_t SDOMSq = variance / _tempSwapN.GetBinContent(l+1);
2094  Double_t SDOMSqOverMeanSq = SDOMSq * _tempSwapN.GetBinContent(l+1) * _tempSwapN.GetBinContent(l+1) / (_tempSwapN.GetBinContent(l+1) * _tempSwapN.GetBinContent(l+1));
2095  Double_t poissonfrac = 1./_tempSwapN.GetBinContent(l+1);
2096  Double_t vartotalfrac = SDOMSqOverMeanSq + poissonfrac;
2097  Double_t vartotal = vartotalfrac * _tempSwap.GetBinContent(l+1) * _tempSwap.GetBinContent(l+1);
2098  if(vartotal > 0.0001) _tempSwap.SetBinError(l+1,TMath::Sqrt(vartotal));
2099  else {
2100  _tempSwap.SetBinContent(l+1,0);
2101  _tempSwap.SetBinError(l+1,0);
2102  }
2103  }
2104  }
2105  }
2106  fFitModulation->SetParameter(0, fLocalRho->GetVal());
2107  switch (fFitModulationType) {
2108  case kNoFit : {
2109  fFitModulation->FixParameter(0, fLocalRho->GetVal() );
2110  freeParams = 0;
2111  } break;
2112  case kV2 : {
2113  fFitModulation->FixParameter(4, psi2);
2114  freeParams = 1;
2115  } break;
2116  case kV3 : {
2117  fFitModulation->FixParameter(4, psi3);
2118  freeParams = 1;
2119  } break;
2120  case kCombined : {
2121  fFitModulation->FixParameter(4, psi2);
2122  fFitModulation->FixParameter(6, psi3);
2123  freeParams = 2;
2124  } break;
2125  case kFourierSeries : {
2126  // in this approach, an explicit calculation will be made of vn = sqrt(xn^2+yn^2)
2127  // where x[y] = Integrate[r(phi)cos[sin](n phi)dphi, 0, 2pi]
2128  Double_t cos2(0), sin2(0), cos3(0), sin3(0), sumPt(0);
2129  for(Int_t i(0); i < iTracks; i++) {
2130  AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
2131  if(!PassesCuts(track) || track->Pt() > fSoftTrackMaxPt || track->Pt() < fSoftTrackMinPt) continue;
2132  sumPt += track->Pt();
2133  cos2 += track->Pt()*TMath::Cos(2*PhaseShift(track->Phi()-psi2));
2134  sin2 += track->Pt()*TMath::Sin(2*PhaseShift(track->Phi()-psi2));
2135  cos3 += track->Pt()*TMath::Cos(3*PhaseShift(track->Phi()-psi3));
2136  sin3 += track->Pt()*TMath::Sin(3*PhaseShift(track->Phi()-psi3));
2137  }
2138  fFitModulation->SetParameter(3, TMath::Sqrt(cos2*cos2+sin2*sin2)/fLocalRho->GetVal());
2139  fFitModulation->SetParameter(4, psi2);
2140  fFitModulation->SetParameter(6, psi3);
2141  fFitModulation->SetParameter(7, TMath::Sqrt(cos3*cos3+sin3*sin3)/fLocalRho->GetVal());
2142  } break;
2143  default : break;
2144  }
2145  if(fRunToyMC) {
2146  // toy mc, just here to check procedure, azimuthal profile is filled from hypothesis so p-value distribution should be flat
2147  Int_t _bins = _tempSwap.GetXaxis()->GetNbins();
2148  TF1* _tempFit = new TF1("temp_fit_kCombined", "[0]*([1]+[2]*([3]*TMath::Cos([2]*(x-[4]))+[7]*TMath::Cos([5]*(x-[6]))))", 0, TMath::TwoPi());
2149  _tempFit->SetParameter(0, fFitModulation->GetParameter(0)); // normalization
2150  _tempFit->SetParameter(3, 0.1); // v2
2151  _tempFit->FixParameter(1, 1.); // constant
2152  _tempFit->FixParameter(2, 2.); // constant
2153  _tempFit->FixParameter(5, 3.); // constant
2154  _tempFit->FixParameter(4, fFitModulation->GetParameter(4));
2155  _tempFit->FixParameter(6, fFitModulation->GetParameter(6));
2156  _tempFit->SetParameter(7, 0.1); // v3
2157  _tempSwap.Reset(); // rese bin content
2158  for(int _binsI = 0; _binsI < _bins*_bins; _binsI++) _tempSwap.Fill(_tempFit->GetRandom());
2159  }
2160  _tempSwap.Fit(fFitModulation, fFitModulationOptions.Data(), "", lowBound, upBound);
2161 
2162 
2163 
2164  // the quality of the fit is evaluated from 1 - the cdf of the chi square distribution
2165  // three methods are available, all with their drawbacks. all are stored, one is selected to do the cut
2166  Int_t NDF(_tempSwap.GetXaxis()->GetNbins()-freeParams);
2167  if(NDF == 0 || (float)NDF <= 0.) return kFALSE;
2168  Double_t CDF(1.-ChiSquareCDF(NDF, ChiSquare(_tempSwap, fFitModulation)));
2169  Double_t CDFROOT(1.-ChiSquareCDF(NDF, fFitModulation->GetChisquare()));
2170  Double_t CDFKolmogorov(KolmogorovTest(/*_tempSwap, fFitModulation*/));
2171  // fill the values and centrality correlation (redundant but easy on the eyes)
2172  fHistPvalueCDF->Fill(CDF);
2173  fHistPvalueCDFCent->Fill(fCent, CDF);
2174  fHistPvalueCDFROOT->Fill(CDFROOT);
2175  fHistPvalueCDFROOTCent->Fill(fCent, CDFROOT);
2176  fHistKolmogorovTest->Fill(CDFKolmogorov);
2177  fHistChi2ROOTCent->Fill(fCent, fFitModulation->GetChisquare()/((float)NDF));
2178  fHistChi2Cent->Fill(fCent, ChiSquare(_tempSwap, fFitModulation)/((float)NDF));
2179  fHistKolmogorovTestCent->Fill(fCent, CDFKolmogorov);
2180  fHistPChi2Root->Fill(CDFROOT, fFitModulation->GetChisquare()/((float)NDF));
2181  fHistPChi2->Fill(CDF, ChiSquare(_tempSwap, fFitModulation)/((float)NDF));
2182  fHistPKolmogorov->Fill(CDF, CDFKolmogorov);
2183 
2184  // variable CDF is used for making cuts, so we fill it with the selected p-value
2185  switch (fFitGoodnessTest) {
2186  case kChi2ROOT : {
2187  CDF = CDFROOT;
2188  } break;
2189  case kChi2Poisson : break; // CDF is already CDF
2190  case kKolmogorov : {
2191  CDF = CDFKolmogorov;
2192  } break;
2193  default: break;
2194  }
2195 
2196  if(fFitControl) {
2197  // as an additional quality check, see if fitting a control fit has a higher significance
2198  _tempSwap.Fit(fFitControl, fFitModulationOptions.Data(), "", lowBound, upBound);
2199  Double_t CDFControl(-1.);
2200  switch (fFitGoodnessTest) {
2201  case kChi2ROOT : {
2202  CDFControl = 1.-ChiSquareCDF(fFitControl->GetNDF(), fFitModulation->GetChisquare());
2203  } break;
2204  case kChi2Poisson : {
2205  CDFControl = 1.-ChiSquareCDF(fFitControl->GetNDF(), ChiSquare(_tempSwap, fFitModulation));
2206  } break;
2207  case kKolmogorov : {
2208  CDFControl = KolmogorovTest(/*_tempSwap, fFitControl*/);
2209  } break;
2210  default: break;
2211  }
2212  if(CDFControl > CDF) {
2213  CDF = -1.; // control fit is more significant, so throw out the 'old' fit
2214  fHistRhoStatusCent->Fill(fCent, -1);
2215  }
2216  }
2217  if(CDF >= fMinPvalue && CDF <= fMaxPvalue && ( fFitModulation->GetMinimum(0, TMath::TwoPi()) > 0)) {
2218  // fit quality. not that although with limited acceptance the fit is performed on just
2219  // part of phase space, the requirement that energy desntiy is larger than zero is applied
2220  // to the FULL spectrum
2221  fHistRhoStatusCent->Fill(fCent, 0.);
2222  // for LOCAL didactic purposes, save the best and the worst fits
2223  // this routine can produce a lot of output histograms (it's not memory 'safe') and will not work on GRID
2224  // since the output will become unmergeable (i.e. different nodes may produce conflicting output)
2225  switch (fRunModeType) {
2226  case kLocal : {
2227  if(fRandom->Uniform(0, 100) > fPercentageOfFits) break;
2228  static Int_t didacticCounterBest(0);
2229  TProfile* didacticProfile = (TProfile*)_tempSwap.Clone(Form("Fit_%i_1-CDF_%.3f_cen_%i_%s", didacticCounterBest, CDF, fInCentralitySelection, detector.Data()));
2230  TF1* didacticFit = (TF1*)fFitModulation->Clone(Form("fit_%i_CDF_%.3f_cen_%i_%s", didacticCounterBest, CDF, fInCentralitySelection, detector.Data()));
2231  switch(fFitModulationType) {
2232  case kCombined : {
2233  // to make a nice picture also plot the separate components (v2 and v3) of the fit
2234  // only done for cobined fit where there are actually components to split ...
2235  TF1* v0(new TF1("dfit_kV2", "[0]", 0, TMath::TwoPi()));
2236  v0->SetParameter(0, didacticFit->GetParameter(0)); // normalization
2237  v0->SetLineColor(kMagenta);
2238  v0->SetLineStyle(7);
2239  didacticProfile->GetListOfFunctions()->Add(v0);
2240  TF1* v2(new TF1("dfit_kV2", "[0]*([1]+[2]*[3]*TMath::Cos([2]*(x-[4])))", 0, TMath::TwoPi()));
2241  v2->SetParameter(0, didacticFit->GetParameter(0)); // normalization
2242  v2->SetParameter(3, didacticFit->GetParameter(3)); // v2
2243  v2->FixParameter(1, 1.); // constant
2244  v2->FixParameter(2, 2.); // constant
2245  v2->FixParameter(4, didacticFit->GetParameter(4)); // psi2
2246  v2->SetLineColor(kGreen);
2247  didacticProfile->GetListOfFunctions()->Add(v2);
2248  TF1* v3(new TF1("dfit_kV3", "[0]*([1]+[2]*[3]*TMath::Cos([5]*(x-[4])))", 0, TMath::TwoPi()));
2249  v3->SetParameter(0, didacticFit->GetParameter(0)); // normalization
2250  v3->SetParameter(3, didacticFit->GetParameter(7)); // v3
2251  v3->FixParameter(1, 1.); // constant
2252  v3->FixParameter(2, 2.); // constant
2253  v3->FixParameter(4, didacticFit->GetParameter(6)); // psi3
2254  v3->FixParameter(5, 3.); // constant
2255  v3->SetLineColor(kCyan);
2256  didacticProfile->GetListOfFunctions()->Add(v3);
2257  }
2258  default : break;
2259  }
2260  didacticProfile->GetListOfFunctions()->Add(didacticFit);
2261  didacticProfile->GetYaxis()->SetTitle("#frac{d #sum #it{p}_{T}}{d #varphi} [GeV/#it{c}]");
2262  didacticProfile->GetXaxis()->SetTitle("#varphi");
2263  fOutputListGood->Add(didacticProfile);
2264  didacticCounterBest++;
2265  TH2F* didacticSurface = BookTH2F(Form("surface_%s", didacticProfile->GetName()), "#phi", "#eta", 50, 0, TMath::TwoPi(), 50, -1, 1, -1, kFALSE);
2266  for(Int_t i(0); i < iTracks; i++) {
2267  AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
2268  if(PassesCuts(track)) {
2269  if(fUsePtWeight) didacticSurface->Fill(track->Phi(), track->Eta(), track->Pt());
2270  else didacticSurface->Fill(track->Phi(), track->Eta());
2271  }
2272  }
2273  if(fExcludeLeadingJetsFromFit) { // visualize the excluded region
2274  TF2 *f2 = new TF2(Form("%s_LJ", didacticSurface->GetName()),"[0]*TMath::Gaus(x,[1],[2])*TMath::Gaus(y,[3],[4])", 0, TMath::TwoPi(), -1, 1);
2275  f2->SetParameters(excludeInPt/3.,excludeInPhi,.1,excludeInEta,.1);
2276  didacticSurface->GetListOfFunctions()->Add(f2);
2277  }
2278  fOutputListGood->Add(didacticSurface);
2279  } break;
2280  default : break;
2281  }
2282  } else { // if the fit is of poor quality revert to the original rho estimate
2283  switch (fRunModeType) { // again see if we want to save the fit
2284  case kLocal : {
2285  static Int_t didacticCounterWorst(0);
2286  if(fRandom->Uniform(0, 100) > fPercentageOfFits) break;
2287  TProfile* didacticProfile = (TProfile*)_tempSwap.Clone(Form("Fit_%i_1-CDF_%.3f_cen_%i_%s", didacticCounterWorst, CDF, fInCentralitySelection, detector.Data() ));
2288  TF1* didacticFit = (TF1*)fFitModulation->Clone(Form("fit_%i_p_%.3f_cen_%i_%s", didacticCounterWorst, CDF, fInCentralitySelection, detector.Data()));
2289  didacticProfile->GetListOfFunctions()->Add(didacticFit);
2290  fOutputListBad->Add(didacticProfile);
2291  didacticCounterWorst++;
2292  } break;
2293  default : break;
2294  }
2295  switch (fFitModulationType) {
2296  case kNoFit : break; // nothing to do
2297  case kCombined : fFitModulation->SetParameter(7, 0); // no break
2298  case kFourierSeries : fFitModulation->SetParameter(7, 0); // no break
2299  default : { // needs to be done if there was a poor fit
2300  fFitModulation->SetParameter(3, 0);
2301  fFitModulation->SetParameter(0, fLocalRho->GetVal());
2302  } break;
2303  }
2304  if(CDF > -.5) fHistRhoStatusCent->Fill(fCent, 1.);
2305  return kFALSE; // return false if the fit is rejected
2306  }
2307  return kTRUE;
2308 }
2309 //_____________________________________________________________________________
2311 {
2312  // event cuts
2313  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2314  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2315  #endif
2316  switch (fCollisionType) {
2317  case kPbPb15o : {
2318  if(!PassesExperimentalHighLumiCuts(static_cast<AliAODEvent*>(event))) return kFALSE;
2319  } break;
2320  case kJetFlowMC : {
2322  return kTRUE;
2323  } break;
2324  case kPbPb10h : {
2325  // ugly hack for 10h data
2326  UInt_t trigger(0);
2327  AliAODEvent* aodEvent = static_cast<AliAODEvent*>(InputEvent());
2328  if(aodEvent) trigger = ((AliVAODHeader*)(aodEvent->GetHeader()))->GetOfflineTrigger();
2329  else return kFALSE;
2330  if((trigger & AliVEvent::kMB) == 0) return kFALSE;
2331  } break;
2332  default : {
2333  if(!event || !AliAnalysisTaskEmcal::IsEventSelected()) return kFALSE;
2334  } break;
2335  }
2336  // aod and esd specific checks
2337  switch (fDataType) {
2338  case kESD: {
2339  AliESDEvent* esdEvent = static_cast<AliESDEvent*>(InputEvent());
2340  if( (!esdEvent) || (TMath::Abs(esdEvent->GetPrimaryVertexSPD()->GetZ() - esdEvent->GetPrimaryVertex()->GetZ()) > .5) ) return kFALSE;
2341  } break;
2342  case kAOD: {
2343  AliAODEvent* aodEvent = static_cast<AliAODEvent*>(InputEvent());
2344  if( (!aodEvent) || (TMath::Abs(aodEvent->GetPrimaryVertexSPD()->GetZ() - aodEvent->GetPrimaryVertex()->GetZ()) > .5) ) return kFALSE;
2345  } break;
2346  default: break;
2347  }
2348 
2349  switch (fCollisionType) {
2350  case kPbPb15o : {
2351  fCent = GetCentrality("V0M");
2352  } break;
2353  default: {
2354  fCent = InputEvent()->GetCentrality()->GetCentralityPercentile("V0M");
2355  } break;
2356  }
2357  if(fCent <= fCentralityClasses->At(0) || fCent >= fCentralityClasses->At(fCentralityClasses->GetSize()-1) || TMath::Abs(fCent-InputEvent()->GetCentrality()->GetCentralityPercentile("TRK")) > 5.) return kFALSE;
2358  // determine centrality class
2360  for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i++) {
2361  if(fCent >= fCentralityClasses->At(i) && fCent <= fCentralityClasses->At(1+i)) {
2363  break;
2364  }
2365  }
2366  if(fInCentralitySelection < 0) return kFALSE;
2367  // see if input containers are filled
2368  if(fTracks->GetEntries() < 1) return kFALSE;
2369  if(fRho->GetVal() <= 0 ) return kFALSE;
2370  if(fAnalysisType == AliAnalysisTaskJetV3::kFull && !fClusterCont) return kFALSE;
2371  // last but not least this hideous pile-up cut for 10h data
2372  if(fCollisionType == kPbPb10h) {
2373  Float_t multTPC(0.), multGlob(0.);
2374  AliAODEvent* event = static_cast<AliAODEvent*>(InputEvent());
2375  Int_t nGoodTracks(event->GetNumberOfTracks());
2376  for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill tpc mult
2377  AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*>(event->GetTrack(iTracks));
2378  if(!trackAOD) AliFatal("Not a standard AOD");
2379  if (!trackAOD) continue;
2380  if (!(trackAOD->TestFilterBit(1))) continue;
2381  if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70) || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.2)) continue;
2382  multTPC++;
2383  }
2384  for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill global mult
2385  AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*>(event->GetTrack(iTracks));
2386  if(!trackAOD) AliFatal("Not a standard AOD");
2387  if (!trackAOD) continue;
2388  if (!(trackAOD->TestFilterBit(16))) continue;
2389  if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70) || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.1)) continue;
2390  Double_t b[2] = {-99., -99.};
2391  Double_t bCov[3] = {-99., -99., -99.};
2392  AliAODTrack copy(*trackAOD);
2393  if (!(copy.PropagateToDCA(event->GetPrimaryVertex(), event->GetMagneticField(), 100., b, bCov))) continue;
2394  if ((TMath::Abs(b[0]) > 0.3) || (TMath::Abs(b[1]) > 0.3)) continue;
2395  multGlob++;
2396  } //track loop
2397  if(! (multTPC > (-40.3+1.22*multGlob) && multTPC < (32.1+1.59*multGlob))) return kFALSE;
2398  fHistMultCorAfterCuts->Fill(multGlob, multTPC);
2399  fHistMultvsCentr->Fill(fCent, multTPC);
2400  }
2401  return kTRUE;
2402 }
2403 //_____________________________________________________________________________
2405 {
2406  // name of the function says it all
2407  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2408  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2409  #endif
2410 
2411  if (MultiVertexer(event)) return kFALSE;
2412 
2413  Short_t isPileup = event->IsPileupFromSPD(3);
2414  if (isPileup != 0) return kFALSE;
2415 
2416  if (((AliAODHeader*)event->GetHeader())->GetRefMultiplicityComb08() < 0) return kFALSE;
2417 
2418  // add vertexer selection
2419  AliAODVertex* vtTrc = event->GetPrimaryVertex();
2420  AliAODVertex* vtSPD = event->GetPrimaryVertexSPD();
2421  if (vtTrc->GetNContributors()<2 || vtSPD->GetNContributors()<1) return kFALSE; // one of vertices is missing
2422  double covTrc[6],covSPD[6];
2423  vtTrc->GetCovarianceMatrix(covTrc);
2424  vtSPD->GetCovarianceMatrix(covSPD);
2425  double dz = vtTrc->GetZ()-vtSPD->GetZ();
2426  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
2427  double errTrc = TMath::Sqrt(covTrc[5]);
2428  double nsigTot = TMath::Abs(dz)/errTot, nsigTrc = TMath::Abs(dz)/errTrc;
2429  if (TMath::Abs(dz)>0.2 || nsigTot>10 || nsigTrc>20) return kFALSE; // bad vertexing
2430 
2431  //new function for 2015 to remove incomplete events
2432  if (event->IsIncompleteDAQ()) return kFALSE;
2433 
2434  return kTRUE;
2435 }
2436 //_____________________________________________________________________________
2438 {
2439  // check for multi-vertexer pile-up
2440  const int kMinPlpContrib = 5;
2441  const double kMaxPlpChi2 = 5.0;
2442  const double kMinWDist = 15;
2443  const AliVVertex* vtPrm = 0;
2444  const AliVVertex* vtPlp = 0;
2445  int nPlp = 0;
2446  if ( !(nPlp = event->GetNumberOfPileupVerticesTracks()) ) return kFALSE;
2447  vtPrm = event->GetPrimaryVertex();
2448  if (vtPrm == event->GetPrimaryVertexSPD()) return kTRUE; // there are pile-up vertices but no primary
2449 
2450  for (int ipl=0;ipl<nPlp;ipl++) {
2451  vtPlp = (const AliVVertex*)event->GetPileupVertexTracks(ipl);
2452  if (vtPlp->GetNContributors() < kMinPlpContrib) continue;
2453  if (vtPlp->GetChi2perNDF() > kMaxPlpChi2) continue;
2454  double wDst = GetWDist(vtPrm,vtPlp);
2455  if (wDst<kMinWDist) continue;
2456  return kTRUE; // pile-up: well separated vertices
2457  }
2458  //
2459  return kFALSE;
2460  //
2461 }
2462 //_____________________________________________________________________________
2463 Double_t AliAnalysisTaskJetV3::GetWDist(const AliVVertex* v0, const AliVVertex* v1)
2464 {
2465 
2466  // calculate sqrt of weighted distance to other vertex
2467  if (!v0 || !v1) {
2468  printf("One of vertices is not valid\n");
2469  return 0;
2470  }
2471  static TMatrixDSym vVb(3);
2472  double dist = -1;
2473  double dx = v0->GetX()-v1->GetX();
2474  double dy = v0->GetY()-v1->GetY();
2475  double dz = v0->GetZ()-v1->GetZ();
2476  double cov0[6],cov1[6];
2477  v0->GetCovarianceMatrix(cov0);
2478  v1->GetCovarianceMatrix(cov1);
2479  vVb(1,1) = cov0[2]+cov1[2];
2480  vVb(2,2) = cov0[5]+cov1[5];
2481  vVb(1,0) = vVb(0,1) = cov0[1]+cov1[1];
2482  vVb(0,2) = vVb(1,2) = vVb(2,0) = vVb(2,1) = 0.;
2483  vVb.InvertFast();
2484  if (!vVb.IsValid()) {printf("Singular Matrix\n"); return dist;}
2485  dist = vVb(0,0)*dx*dx + vVb(1,1)*dy*dy + vVb(2,2)*dz*dz
2486  + 2*vVb(0,1)*dx*dy + 2*vVb(0,2)*dx*dz + 2*vVb(1,2)*dy*dz;
2487  return dist>0 ? TMath::Sqrt(dist) : -1;
2488 
2489 }
2490 
2491 //_____________________________________________________________________________
2493 {
2494  // fill histograms
2495  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2496  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2497  #endif
2498  // fill histograms. weight is 1 when no procedure is defined
2502  if(fFillQAHistograms) FillWeightedEventPlaneHistograms(vzero, vzeroComb, tpc);
2505 }
2506 //_____________________________________________________________________________
2507 void AliAnalysisTaskJetV3::FillQAHistograms(AliVTrack* vtrack) const
2508 {
2509  // fill qa histograms for pico tracks
2510  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_2
2511  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2512  #endif
2513 
2514  fHistPicoCat1[fInCentralitySelection]->Fill(vtrack->Eta(), vtrack->Phi());
2515 }
2516 //_____________________________________________________________________________
2518 {
2519  // fill qa histograms for events
2520  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2521  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2522  #endif
2523  if(!vevent) return;
2524  fHistVertexz->Fill(fVertex[2]);
2525  fHistCentrality->Fill(fCent);
2526  Int_t runNumber(InputEvent()->GetRunNumber());
2529  if(fExpectedRuns->At(fMappedRunNumber) == runNumber) return;
2530  }
2531  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_
2532  printf("\n > TASK %s CANNOT IDENTIFY RUN - CONFIGURATION COULD BE INCORRECT < \n", GetName());
2533  #endif
2534 }
2535 //_____________________________________________________________________________
2537 {
2538  // fill track histograms
2539  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2540  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2541  #endif
2542  Int_t iTracks(fTracks->GetEntriesFast()), iAcceptedTracks(0);
2543  for(Int_t i(0); i < iTracks; i++) {
2544  AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
2545  if(!PassesCuts(track)) continue;
2546  iAcceptedTracks++;
2549  }
2551  fTracksCont->ResetCurrentID();
2552 }
2553 //_____________________________________________________________________________
2555 {
2556  // fill cluster histograms
2557  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2558  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2559  #endif
2560  if(!fClusterCont) return;
2561  Int_t iClusters(fClusterCont->GetNClusters());
2562  TLorentzVector clusterLorentzVector;
2563  for(Int_t i(0); i < iClusters; i++) {
2564  AliVCluster* cluster = fClusterCont->GetCluster(i);
2565  if (!PassesCuts(cluster)) continue;
2566  cluster->GetMomentum(clusterLorentzVector, const_cast<Double_t*>(fVertex));
2567  fHistClusterPt[fInCentralitySelection]->Fill(clusterLorentzVector.Pt(), fEventPlaneWeight);
2568  fHistClusterEtaPhi[fInCentralitySelection]->Fill(clusterLorentzVector.Eta(), clusterLorentzVector.Phi(), fEventPlaneWeight);
2569  fHistClusterEtaPhiWeighted[fInCentralitySelection]->Fill(clusterLorentzVector.Eta(), clusterLorentzVector.Phi(), clusterLorentzVector.Pt()*fEventPlaneWeight);
2570  }
2571  return;
2572 }
2573 //_____________________________________________________________________________
2575 {
2576  // fill event plane histograms, only called in qa mode
2577  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2578  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2579  #endif
2580  Double_t TRK(InputEvent()->GetCentrality()->GetCentralityPercentile("TRK"));
2581  Double_t V0M(InputEvent()->GetCentrality()->GetCentralityPercentile("V0M"));
2582  fHistPsiVZEROAV0M->Fill(V0M, vzero[0][0], fEventPlaneWeight);
2583  fHistPsiVZEROCV0M->Fill(V0M, vzero[1][0], fEventPlaneWeight);
2584  fHistPsiVZEROVV0M->Fill(V0M, vzeroComb[0], fEventPlaneWeight);
2585  fHistPsiTPCV0M->Fill(V0M, tpc[0], fEventPlaneWeight);
2586  fHistPsiVZEROATRK->Fill(TRK, vzero[0][0], fEventPlaneWeight);
2587  fHistPsiVZEROCTRK->Fill(TRK, vzero[1][0], fEventPlaneWeight);
2588  fHistPsiVZEROTRK->Fill(TRK, vzeroComb[0], fEventPlaneWeight);
2589  fHistPsiTPCTRK->Fill(TRK, tpc[0], fEventPlaneWeight);
2590  // leading jet vs event plane bias
2591  if(fLeadingJet) {
2594  Double_t pt(fLeadingJet->Pt() - fLeadingJet->Area()*rho);
2599  }
2600  // correlation of event planes
2601  fHistPsi3Correlation[fInCentralitySelection]->Fill(tpc[0], vzero[0][0], vzero[1][0], fEventPlaneWeight);
2602 }
2603 //_____________________________________________________________________________
2605 {
2606  // fill rho histograms
2607  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2608  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2609  #endif
2610  fHistRhoPackage[fInCentralitySelection]->Fill(fLocalRho->GetVal(), fEventPlaneWeight); // save the rho estimate from the emcal jet package
2611  // get multiplicity FIXME inefficient
2612  Int_t iJets(fJets->GetEntriesFast());
2613  Double_t rho(fLocalRho->GetLocalVal(TMath::Pi(), TMath::Pi(), fLocalRho->GetVal()));
2614  if(fUse2DIntegration) rho = fLocalRho->GetLocalValInEtaPhi(TMath::Pi(), TMath::Pi(), fLocalRho->GetVal());
2616  fHistRhoVsMult->Fill(fTracks->GetEntries(), rho, fEventPlaneWeight);
2617  fHistRhoVsCent->Fill(fCent, rho, fEventPlaneWeight);
2618  for(Int_t i(0); i < iJets; i++) {
2619  AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(i));
2620  if(!PassesCuts(jet)) continue;
2621  fHistRhoAVsMult->Fill(fTracks->GetEntries(), rho * jet->Area(), fEventPlaneWeight);
2622  fHistRhoAVsCent->Fill(fCent, rho * jet->Area(), fEventPlaneWeight);
2623  }
2624 }
2625 //_____________________________________________________________________________
2627 {
2628  // fill delta pt histograms
2629  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2630  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2631  #endif
2632  Int_t i(0);
2633  const Float_t areaRC = GetJetRadius()*GetJetRadius()*TMath::Pi();
2634  // we've retrieved the leading jet, now get a random cone
2635  for(i = 0; i < fMaxCones; i++) {
2636  Float_t pt(0), eta(0), phi(0);
2637  // get a random cone without constraints on leading jet position
2638  CalculateRandomCone(pt, eta, phi, fTracksCont, fClusterCont, 0x0);
2639  if(pt > 0) {
2643 /* if(fFillQAHistograms) {
2644  Double_t temp(fLocalRho->GetLocalValInEtaPhi(phi, GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())*areaRC);
2645  fHistIntegralCorrelations[fInCentralitySelection]->Fill(fLocalRho->GetLocalVal(phi, GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())*areaRC, temp);
2646  if(temp > 0) fProfIntegralCorrelations[fInCentralitySelection]->Fill(temp, fLocalRho->GetLocalVal(phi, GetJetContainer()->GetJetRadius(), fLocalRho->GetVal())*areaRC/temp);
2647  }*/
2651  fHistDeltaPtDeltaPhi3Rho0[fInCentralitySelection]->Fill(PhaseShift(phi-psi3, 3.), pt - areaRC*fLocalRho->GetVal(), fEventPlaneWeight);
2652 
2653  }
2654  // get a random cone excluding leading jet area
2656  if(pt > 0) {
2659 
2664  fHistDeltaPtDeltaPhi3ExLJRho0[fInCentralitySelection]->Fill(PhaseShift(phi-psi3, 3.), pt - areaRC*fLocalRho->GetVal(), fEventPlaneWeight);
2665  }
2666  }
2667 }
2668 //_____________________________________________________________________________
2670 {
2671  // fill jet histograms
2672  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2673  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2674  #endif
2675  Int_t iJets(fJets->GetEntriesFast());
2676  UInt_t trigger(0);
2677  if(fFillQAHistograms) {
2678  trigger = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
2679  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2680  PrintTriggerSummary(trigger);
2681  #endif
2682  }
2683  for(Int_t i(0); i < iJets; i++) {
2684  AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(i));
2685  if(fFillQAHistograms) {
2686  if(jet) {
2687  // this is a bit redundant, but today i'm lazy
2688  Double_t pt(jet->Pt()), area(jet->Area()), eta(jet->Eta()), phi(jet->Phi());
2690  fHistRhoEtaBC[fInCentralitySelection]->Fill(rho, eta);
2691  fHistJetPtBC[fInCentralitySelection]->Fill(pt-area*rho);
2692  fHistJetEtaPhiBC[fInCentralitySelection]->Fill(eta, phi);
2693  fHistJetPtAreaBC[fInCentralitySelection]->Fill(pt-area*rho,area);
2694  }
2695  }
2696  if(PassesCuts(jet)) {
2697  Double_t pt(jet->Pt()), area(jet->Area()), eta(jet->Eta()), phi(jet->Phi());
2702  if(fFillQAHistograms) {
2704  FillWeightedTriggerQA(PhaseShift(phi-psi3, 3.), pt - area*rho, trigger);
2705  }
2706  fHistJetPtArea[fInCentralitySelection]->Fill(pt-area*rho, area, fEventPlaneWeight);
2707  fHistJetPtEta[fInCentralitySelection]->Fill(pt-area*rho, eta, fEventPlaneWeight);
2708  fHistJetPsi3Pt[fInCentralitySelection]->Fill(PhaseShift(phi-psi3, 3.), pt-area*rho, fEventPlaneWeight);
2709  AliVParticle* lp(GetLeadingTrack(jet));
2710  if(lp) {
2711  fHistJetLJPsi3Pt[fInCentralitySelection]->Fill(PhaseShift(lp->Phi()-psi3, 3.), pt-area*rho, lp->Pt(), fEventPlaneWeight);
2712  fHistJetLJPsi3PtRatio[fInCentralitySelection]->Fill(PhaseShift(lp->Phi()-psi3, 3.), PhaseShift(phi-psi3, 3.), pt-area*rho, fEventPlaneWeight);
2713  }
2714  fHistJetPsi3PtRho0[fInCentralitySelection]->Fill(PhaseShift(phi-psi3, 3.), pt-area*fLocalRho->GetVal(), fEventPlaneWeight);
2717  }
2718  }
2719 }
2720 //_____________________________________________________________________________
2722 {
2723  // fill qa histograms for pico tracks
2724  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_2
2725  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2726  #endif
2727  if(!vtrack) return;
2728  fHistRunnumbersPhi->Fill(fMappedRunNumber, vtrack->Phi(), fEventPlaneWeight);
2729  fHistRunnumbersEta->Fill(fMappedRunNumber, vtrack->Eta(), fEventPlaneWeight);
2730 }
2731 //_____________________________________________________________________________
2733 {
2734  // fill qa histograms for events
2735  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2736  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2737  #endif
2738  if(!vevent) return;
2739  fHistVertexz->Fill(vevent->GetPrimaryVertex()->GetZ());
2740  fHistCentrality->Fill(fCent);
2741  Int_t runNumber(InputEvent()->GetRunNumber());
2744  if(fExpectedRuns->At(fMappedRunNumber) == runNumber) return;
2745  }
2746  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2747  printf("\n > TASK %s CANNOT IDENTIFY RUN - CONFIGURATION COULD BE INCORRECT < \n", GetName());
2748  #endif
2750  // check if cabration was kickstarted properly. this comes down to seeing if there's a difference between the
2751  // current runnumber and the runnumber as used by the calibration. if there's a difference, flag the offending
2752  // runnumber
2754  }
2755 }
2756 //_____________________________________________________________________________
2758 {
2759  // fill the trigger efficiency histograms
2760  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_2
2761  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2762  #endif
2763  // some trigger definitions for readability. the way this routine is set up is as follows
2764  // 1) define combined trigger conditions, e.g. bitwise representation of a combined trigger
2765  // trigger a = 0 0 1
2766  // trigger b = 1 0 0
2767  // combined trigger mask = 1 0 1
2768  // combined trigger is mask is defined using bitwise OR
2769  // 2) check the condition using bitwise AND and equals operator on unsigned integer
2770  // (incoming trigger & mask) == mask
2771  // 2a) which will do, when incoming trigger equals mask
2772  // 1 0 1 & 1 0 1 -> 1 0 1
2773  // when checked against requested mask
2774  // UInt_t(1 0 1) == UInt_t(1 0 1) returns true
2775  // 2b) for an imcompatible trigger, e.g.
2776  // 0 0 1 & 1 0 1 -> 0 0 1
2777  // UInt_t(0 0 1) == UInt_t(1 0 1) returns false
2778 
2779  // preparing the combined trigger masks
2780  UInt_t MB_EMCEJE(AliVEvent::kMB | AliVEvent::kEMCEJE);
2781  UInt_t CEN_EMCEJE(AliVEvent::kCentral | AliVEvent::kEMCEJE);
2782  UInt_t SEM_EMCEJE(AliVEvent::kSemiCentral | AliVEvent::kEMCEJE);
2783  UInt_t ALL_EMCEJE(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kEMCEJE);
2784  UInt_t MB_EMCEGA(AliVEvent::kMB | AliVEvent::kEMCEGA);
2785  UInt_t CEN_EMCEGA(AliVEvent::kCentral | AliVEvent::kEMCEGA);
2786  UInt_t SEM_EMCEGA(AliVEvent::kSemiCentral | AliVEvent::kEMCEGA);
2787  UInt_t ALL_EMCEGA(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kEMCEGA);
2788  // actual routine
2789  if(IsInPlane(dPhi)) {
2790  // in plane bookkeeping of fired triggers. not 'exclusive' so no == necessary
2791  if(trigger == 0) fHistTriggerQAIn[fInCentralitySelection]->Fill(1, pt);
2792  if(trigger & AliVEvent::kAny) fHistTriggerQAIn[fInCentralitySelection]->Fill(2, pt);
2793  if(trigger & AliVEvent::kAnyINT) fHistTriggerQAIn[fInCentralitySelection]->Fill(3, pt);
2794  if(trigger & AliVEvent::kMB) fHistTriggerQAIn[fInCentralitySelection]->Fill(4, pt);
2795  if(trigger & AliVEvent::kCentral) fHistTriggerQAIn[fInCentralitySelection]->Fill(5, pt);
2796  if(trigger & AliVEvent::kSemiCentral) fHistTriggerQAIn[fInCentralitySelection]->Fill(6, pt);
2797  if(trigger & AliVEvent::kEMCEJE) fHistTriggerQAIn[fInCentralitySelection]->Fill(7, pt);
2798  if(trigger & AliVEvent::kEMCEGA) fHistTriggerQAIn[fInCentralitySelection]->Fill(8, pt);
2799  // in plane bookkeeping of trigger combinations (for efficiency)
2800  if((trigger & MB_EMCEJE) == MB_EMCEJE) fHistTriggerQAIn[fInCentralitySelection]->Fill(9, pt);
2801  if((trigger & CEN_EMCEJE) == CEN_EMCEJE) fHistTriggerQAIn[fInCentralitySelection]->Fill(10, pt);
2802  if((trigger & SEM_EMCEJE) == SEM_EMCEJE) fHistTriggerQAIn[fInCentralitySelection]->Fill(11, pt);
2803  if((trigger & ALL_EMCEJE) == ALL_EMCEJE) fHistTriggerQAIn[fInCentralitySelection]->Fill(12, pt);
2804  if((trigger & MB_EMCEGA) == MB_EMCEGA) fHistTriggerQAIn[fInCentralitySelection]->Fill(13, pt);
2805  if((trigger & CEN_EMCEGA) == CEN_EMCEGA) fHistTriggerQAIn[fInCentralitySelection]->Fill(14, pt);
2806  if((trigger & SEM_EMCEGA) == SEM_EMCEGA) fHistTriggerQAIn[fInCentralitySelection]->Fill(15, pt);
2807  if((trigger & ALL_EMCEGA) == ALL_EMCEGA) fHistTriggerQAIn[fInCentralitySelection]->Fill(16, pt);
2808  } else {
2809  // out-of-plane bookkeeping of fired triggers. not 'exclusive' so no == necessary
2810  if(trigger == 0) fHistTriggerQAOut[fInCentralitySelection]->Fill(1, pt);
2811  if(trigger & AliVEvent::kAny) fHistTriggerQAOut[fInCentralitySelection]->Fill(2, pt);
2812  if(trigger & AliVEvent::kAnyINT) fHistTriggerQAOut[fInCentralitySelection]->Fill(3, pt);
2813  if(trigger & AliVEvent::kMB) fHistTriggerQAOut[fInCentralitySelection]->Fill(4, pt);
2814  if(trigger & AliVEvent::kCentral) fHistTriggerQAOut[fInCentralitySelection]->Fill(5, pt);
2815  if(trigger & AliVEvent::kSemiCentral) fHistTriggerQAOut[fInCentralitySelection]->Fill(6, pt);
2816  if(trigger & AliVEvent::kEMCEJE) fHistTriggerQAOut[fInCentralitySelection]->Fill(7, pt);
2817  if(trigger & AliVEvent::kEMCEGA) fHistTriggerQAOut[fInCentralitySelection]->Fill(8, pt);
2818  // out-of-plane bookkeeping of trigger combinations (for efficiency)
2819  if((trigger & MB_EMCEJE) == MB_EMCEJE) fHistTriggerQAOut[fInCentralitySelection]->Fill(9, pt);
2820  if((trigger & CEN_EMCEJE) == CEN_EMCEJE) fHistTriggerQAOut[fInCentralitySelection]->Fill(10, pt);
2821  if((trigger & SEM_EMCEJE) == SEM_EMCEJE) fHistTriggerQAOut[fInCentralitySelection]->Fill(11, pt);
2822  if((trigger & ALL_EMCEJE) == ALL_EMCEJE) fHistTriggerQAOut[fInCentralitySelection]->Fill(12, pt);
2823  if((trigger & MB_EMCEGA) == MB_EMCEGA) fHistTriggerQAOut[fInCentralitySelection]->Fill(13, pt);
2824  if((trigger & CEN_EMCEGA) == CEN_EMCEGA) fHistTriggerQAOut[fInCentralitySelection]->Fill(14, pt);
2825  if((trigger & SEM_EMCEGA) == SEM_EMCEGA) fHistTriggerQAOut[fInCentralitySelection]->Fill(15, pt);
2826  if((trigger & ALL_EMCEGA) == ALL_EMCEGA) fHistTriggerQAOut[fInCentralitySelection]->Fill(16, pt);
2827  }
2828 }
2829 //_____________________________________________________________________________
2831 {
2832  // fill the analysis summary histrogram, saves all relevant analysis settigns
2833  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2834  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2835  #endif
2836  fHistAnalysisSummary->GetXaxis()->SetBinLabel(2, "fJetRadius");
2837  fHistAnalysisSummary->SetBinContent(2, GetJetContainer()->GetJetRadius());
2838  fHistAnalysisSummary->GetXaxis()->SetBinLabel(3, "fJetEtaMin");
2839  fHistAnalysisSummary->SetBinContent(3, GetJetContainer()->GetJetEtaMin());
2840  fHistAnalysisSummary->GetXaxis()->SetBinLabel(4, "fJetEtaMax");
2841  fHistAnalysisSummary->SetBinContent(4, GetJetContainer()->GetJetEtaMax());
2842  fHistAnalysisSummary->GetXaxis()->SetBinLabel(5, "fJetPhiMin");
2843  fHistAnalysisSummary->SetBinContent(5, GetJetContainer()->GetJetPhiMin());
2844  fHistAnalysisSummary->GetXaxis()->SetBinLabel(6, "fJetPhiMax");
2845  fHistAnalysisSummary->SetBinContent(6, GetJetContainer()->GetJetPhiMin());
2846  fHistAnalysisSummary->GetXaxis()->SetBinLabel(16, "fForceBeamType");
2847  fHistAnalysisSummary->SetBinContent(16, fForceBeamType);
2848  fHistAnalysisSummary->GetXaxis()->SetBinLabel(17, "fMinCent");
2849  fHistAnalysisSummary->SetBinContent(17, fMinCent);
2850  fHistAnalysisSummary->GetXaxis()->SetBinLabel(18, "fMaxCent");
2851  fHistAnalysisSummary->SetBinContent(18, fMaxCent);
2852  fHistAnalysisSummary->GetXaxis()->SetBinLabel(19, "fMinVz");
2853  fHistAnalysisSummary->SetBinContent(19, fMinVz);
2854  fHistAnalysisSummary->GetXaxis()->SetBinLabel(20, "fMaxVz");
2855  fHistAnalysisSummary->SetBinContent(20, fMaxVz);
2856  fHistAnalysisSummary->GetXaxis()->SetBinLabel(21, "fOffTrigger");
2857  fHistAnalysisSummary->SetBinContent(21, fOffTrigger);
2858  fHistAnalysisSummary->GetXaxis()->SetBinLabel(34, "fitModulationType");
2859  fHistAnalysisSummary->SetBinContent(34, (int)fFitModulationType);
2860  fHistAnalysisSummary->GetXaxis()->SetBinLabel(35, "runModeType");
2861  fHistAnalysisSummary->SetBinContent(35, (int)fRunModeType);
2862  fHistAnalysisSummary->GetXaxis()->SetBinLabel(36, "data type");
2863  fHistAnalysisSummary->SetBinContent(36, (int)fDataType);
2864  fHistAnalysisSummary->GetXaxis()->SetBinLabel(37, "iterator");
2865  fHistAnalysisSummary->SetBinContent(37, 1.);
2866  fHistAnalysisSummary->GetXaxis()->SetBinLabel(38, "fMinPvalue");
2867  fHistAnalysisSummary->SetBinContent(38, fMinPvalue);
2868  fHistAnalysisSummary->GetXaxis()->SetBinLabel(39, "fMaxPvalue");
2869  fHistAnalysisSummary->SetBinContent(39, fMaxPvalue);
2870  fHistAnalysisSummary->GetXaxis()->SetBinLabel(40, "fExcludeLeadingJetsFromFit");
2872  fHistAnalysisSummary->GetXaxis()->SetBinLabel(41, "fRebinSwapHistoOnTheFly");
2873  fHistAnalysisSummary->SetBinContent(41, (int)fRebinSwapHistoOnTheFly);
2874  fHistAnalysisSummary->GetXaxis()->SetBinLabel(42, "fUsePtWeight");
2875  fHistAnalysisSummary->SetBinContent(42, (int)fUsePtWeight);
2876  fHistAnalysisSummary->GetXaxis()->SetBinLabel(44, "fSoftTrackMinPt");
2877  fHistAnalysisSummary->SetBinContent(44, fSoftTrackMinPt);
2878  fHistAnalysisSummary->GetXaxis()->SetBinLabel(45, "fSoftTrackMaxPt");
2879  fHistAnalysisSummary->SetBinContent(45, fSoftTrackMaxPt);
2880  fHistAnalysisSummary->GetXaxis()->SetBinLabel(46, "fMaxCones");
2881  fHistAnalysisSummary->SetBinContent(46, fMaxCones);
2882  fHistAnalysisSummary->GetXaxis()->SetBinLabel(47, "used rho");
2883  fHistAnalysisSummary->GetXaxis()->SetBinLabel(48, "used small rho");
2884 }
2885 //_____________________________________________________________________________
2887 {
2888  // terminate
2889  switch (fRunModeType) {
2890  case kLocal : {
2891  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2892  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2893  #endif
2894  AliAnalysisTaskJetV3::Dump();
2895  for(Int_t i(0); i < fHistAnalysisSummary->GetXaxis()->GetNbins(); i++) printf( " > flag: %s \t content %.2f \n", fHistAnalysisSummary->GetXaxis()->GetBinLabel(1+i), fHistAnalysisSummary->GetBinContent(1+i));
2896  } break;
2897  default : break;
2898  }
2899 }
2900 //_____________________________________________________________________________
2902 {
2903  // set modulation fit
2904  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2905  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2906  #endif
2907  if (fFitModulation) delete fFitModulation;
2908  fFitModulation = fit;
2909 }
2910 //_____________________________________________________________________________
2912 {
2913  // set control fit
2914  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2915  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2916  #endif
2917  if (fFitControl) delete fFitControl;
2918  if (c) {
2919  fFitControl = new TF1("controlFit", "pol0", 0, TMath::TwoPi());
2920  } else fFitControl = 0x0;
2921 }
2922 //_____________________________________________________________________________
2924 {
2925  // INTERFACE METHOD FOR OUTPUTFILE
2926  // get the detector resolution, user has ownership of the returned histogram
2927  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2928  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2929  #endif
2930  if(!fOutputList) {
2931  printf(" > Please add fOutputList first < \n");
2932  return 0x0;
2933  }
2934  TH1F* r(0x0);
2935  (cen) ? r = new TH1F("R", "R", cen->GetSize()-1, cen->GetArray()) : r = new TH1F("R", "R", 10, 0, 10);
2936  if(!cen) r->GetXaxis()->SetTitle("number of centrality bin");
2937  r->GetYaxis()->SetTitle(Form("Resolution #Psi_{%i}", h));
2938  for(Int_t i(0); i < 10; i++) {
2939  TProfile* temp((TProfile*)fOutputList->FindObject(Form("fProfV%iResolution_%i", h, i)));
2940  if(!temp) break;
2941  Double_t a(temp->GetBinContent(3)), b(temp->GetBinContent(5)), c(temp->GetBinContent(7));
2942  Double_t d(temp->GetBinContent(9)), e(temp->GetBinContent(10)), f(temp->GetBinContent(11));
2943  Double_t _a(temp->GetBinError(3)), _b(temp->GetBinError(5)), _c(temp->GetBinError(7));
2944  Double_t _d(temp->GetBinError(9)), _e(temp->GetBinError(10)), _f(temp->GetBinError(11));
2945  Double_t error(0);
2946  if(a <= 0 || b <= 0 || c <= 0 || d <= 0 || e <= 0 || f <= 0) continue;
2947  switch (det) {
2948  case kVZEROA : {
2949  r->SetBinContent(1+i, TMath::Sqrt((a*b)/c));
2950  if(i==0) r->SetNameTitle("VZEROA resolution", "VZEROA resolution");
2951  error = TMath::Power((2.*a*TMath::Sqrt((a*b)/c))/3.,2.)*_a*_a+TMath::Power((2.*b*TMath::Sqrt((a*b)/c))/3.,2.)*_b*_b+TMath::Power(2.*c*TMath::Sqrt((a*b)/c),2.)*_c*_c;
2952  if(error > 0.) error = TMath::Sqrt(error);
2953  r->SetBinError(1+i, error);
2954  } break;
2955  case kVZEROC : {
2956  r->SetBinContent(1+i, TMath::Sqrt((a*c)/b));
2957  error = TMath::Power((2.*a*TMath::Sqrt((a*c)/b))/3.,2.)*_a*_a+TMath::Power((2.*b*TMath::Sqrt((a*c)/b)),2.)*_b*_b+TMath::Power(2.*c*TMath::Sqrt((a*c)/b)/3.,2.)*_c*_c;
2958  if(error > 0.) error = TMath::Sqrt(error);
2959  if(i==0) r->SetNameTitle("VZEROC resolution", "VZEROC resolution");
2960  r->SetBinError(1+i, error);
2961  } break;
2962  case kTPC : {
2963  r->SetBinContent(1+i, TMath::Sqrt((b*c)/a));
2964  if(i==0) r->SetNameTitle("TPC resolution", "TPC resolution");
2965  r->SetBinError(1+i, TMath::Sqrt(_a*_a+_b*_b+_c*_c));
2966  } break;
2967  case kVZEROComb : {
2968  r->SetBinContent(1+i, TMath::Sqrt((d*e)/f));
2969  if(i==0) r->SetNameTitle("VZEROComb resolution", "VZEROComb resolution");
2970  r->SetBinError(1+i, TMath::Sqrt(_d*_d+_e*_e+_f*_f));
2971  } break;
2972  default : break;
2973  }
2974  }
2975  return r;
2976 }
2977 //_____________________________________________________________________________
2979 {
2980  // INTERFACE METHOD FOR OUTPUT FILE
2981  // correct the supplied differential vn histogram v for detector resolution
2982  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
2983  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
2984  #endif
2985  TH1F* r(GetResolutionFromOutputFile(det, h, cen));
2986  if(!r) {
2987  printf(" > Couldn't find resolution < \n");
2988  return 0x0;
2989  }
2990  Double_t res(1./r->GetBinContent(1+r->FindBin(c)));
2991  TF1* line = new TF1("line", "pol0", 0, 200);
2992  line->SetParameter(0, res);
2993  v->Multiply(line);
2994  return v;
2995 }
2996 //_____________________________________________________________________________
2998 {
2999  // INTERFACE METHOD FOR OUTPUT FILE
3000  // correct the supplied intetrated vn histogram v for detector resolution
3001  // integrated vn must have the same centrality binning as the resolotion correction
3002  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3003  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3004  #endif
3005  TH1F* r(GetResolutionFromOutputFile(det, h, cen));
3006  v->Divide(v, r);
3007  return v;
3008 }
3009 //_____________________________________________________________________________
3010 TH1F* AliAnalysisTaskJetV3::GetDifferentialQC(TProfile* refCumulants, TProfile* diffCumlants, TArrayD* ptBins, Int_t h)
3011 {
3012  // get differential QC
3013  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3014  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3015  #endif
3016  Double_t r(refCumulants->GetBinContent(h-1)); // v2 reference flow
3017  if(r > 0) r = TMath::Sqrt(r);
3018  TH1F* qc = new TH1F(Form("QC2v%i", h), Form("QC2v%i", h), ptBins->GetSize()-1, ptBins->GetArray());
3019  Double_t a(0), b(0), c(0); // dummy variables
3020  for(Int_t i(0); i < ptBins->GetSize(); i++) {
3021  if(r > 0) {
3022  a = diffCumlants->GetBinContent(1+i);
3023  b = diffCumlants->GetBinError(1+i);
3024  c = a/r;
3025  qc->SetBinContent(1+i, c);
3026  (a <= 0 || b <= 0) ? qc->SetBinError(1+i, b) : qc->SetBinError(1+i, TMath::Sqrt(c*c*b*b/(a*a)));
3027  }
3028  }
3029  return qc;
3030 }
3031 //_____________________________________________________________________________
3033 {
3034  // necessary for calibration of 10h vzero event plane. code copied from flow package
3035  // (duplicate, but i didn't want to introduce an ulgy dependency )
3036  // this function is only called when the runnumber changes
3037  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3038  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3039  #endif
3040 
3041  // 1) check if the proper chi weights for merging vzero a and vzero c ep are present
3042  // if not, use sane defaults. centrality binning is equal to that given in the fVZEROcentralityBin snippet
3043  //
3044  // when the user wants to, set the weights to 1 (effectively disabling them)
3045  // chi values can be calculated using the static helper function
3046  // AliAnalysisTaskJetV3::CalculateEventPlaneChi(Double_t res) where res is the event plane
3047  // resolution in a given centrality bin
3048  // the resolutions that were used for these defaults are
3049  Double_t chiC2[] = {0.771423, 1.10236, 1.38116, 1.48077, 1.31964, 1.10236, 0.674622, 0.600403, 0.273865};
3050  Double_t chiA2[] = {0.582214, 0.674622, 0.832214, 0.873962, 0.832214, 0.771423, 0.637146, 0.424255, 0.257385};
3051  Double_t chiC3[] = {0.493347, 0.493347, 0.458557, 0.407166, 0.356628, 0.273865, 0.176208, 6.10352e-05, 6.10352e-05};
3052  Double_t chiA3[] = {0.356628, 0.373474, 0.356628, 0.306702, 0.24115, 0.192322, 0.127869, 6.10352e-05, 6.10352e-05};
3053 
3054  if(!fChi2A) fChi2A = new TArrayD(9, chiA2);
3055  if(!fChi2C) fChi2C = new TArrayD(9, chiC2);
3056  if(!fChi3A) fChi3A = new TArrayD(9, chiA3);
3057  if(!fChi3C) fChi3C = new TArrayD(9, chiC3);
3058 
3059  Double_t sigmaC2[] = {0.000210563,0.000554248,0.00126934,0.00138031,0.00124522,0.000948494,0.00115442,0.000626186,0.000161246};
3060  Double_t sigmaA2[] = {0.000195393,0.000509235,0.00112734,0.00121416,0.00110601,0.00086572,0.0010805,0.000579927,0.00013517};
3061  Double_t sigmaC3[] = {0.000131573,0.000317261,0.000783971,0.000885244,0.000763271,0.000542612,0.000647701,0.000524767,0};
3062  Double_t sigmaA3[] = {0.000123304,0.000293338,0.000714463,0.000798547,0.00069079,0.000503398,0.000615878,0.000489984,0};
3063 
3064  if(!fSigma2A) fSigma2A = new TArrayD(9, sigmaA2);
3065  if(!fSigma2C) fSigma2C = new TArrayD(9, sigmaC2);
3066  if(!fSigma3A) fSigma3A = new TArrayD(9, sigmaA3);
3067  if(!fSigma3C) fSigma3C = new TArrayD(9, sigmaC3);
3068 
3069  // 2) check if the database file is open, if not, open it
3070  if(!fOADB || fOADB->IsZombie()) fOADB = TFile::Open("$ALICE_PHYSICS/OADB/PWGCF/VZERO/VZEROcalibEP.root");
3071  if(fOADB->IsZombie()) {
3072  printf("OADB file $ALICE_PHYSICS/OADB/PWGCF/VZERO/VZEROcalibEP.root cannot be opened, CALIBRATION FAILED !");
3073  return;
3074  }
3075 
3076  AliOADBContainer *cont = (AliOADBContainer*) fOADB->Get("hMultV0BefCorr");
3077  if(!cont){
3078  // see if database is readable
3079  printf("OADB object hMultV0BefCorr is not available in the file\n");
3080  return;
3081  }
3082  Int_t run(fRunNumber);
3083  if(!(cont->GetObject(run))){
3084  // if the run isn't recognized fall back to a default run
3085  printf("OADB object hMultVZEROBefCorr is not available for run %i (used default run 137366)\n",run);
3086  run = 137366;
3087  }
3088  // step 3) get the proper multiplicity weights from the vzero signal
3089  fVZEROgainEqualization = ((TH2F*)cont->GetObject(run))->ProfileX();
3090  if(!fVZEROgainEqualization) {
3091  AliFatal(Form("%s: Fatal error, couldn't read fVZEROgainEqualization from OADB object < \n", GetName()));
3092  return;
3093  }
3094 
3095  TF1* fpol0 = new TF1("fpol0","pol0");
3096  fVZEROgainEqualization->Fit(fpol0, "N0", "", 0, 31);
3097  fVZEROCpol = fpol0->GetParameter(0);
3098  fVZEROgainEqualization->Fit(fpol0, "N0", "", 32, 64);
3099  fVZEROApol = fpol0->GetParameter(0);
3100 
3101  // step 4) extract the information to re-weight the q-vectors
3102  for(Int_t iside=0;iside<2;iside++){
3103  for(Int_t icoord=0;icoord<2;icoord++){
3104  for(Int_t i=0;i < 9;i++){
3105  char namecont[100];
3106  if(iside==0 && icoord==0)
3107  snprintf(namecont,100,"hQxc2_%i",i);
3108  else if(iside==1 && icoord==0)
3109  snprintf(namecont,100,"hQxa2_%i",i);
3110  else if(iside==0 && icoord==1)
3111  snprintf(namecont,100,"hQyc2_%i",i);
3112  else if(iside==1 && icoord==1)
3113  snprintf(namecont,100,"hQya2_%i",i);
3114 
3115  cont = (AliOADBContainer*) fOADB->Get(namecont);
3116  if(!cont){
3117  printf("OADB object %s is not available in the file\n",namecont);
3118  return;
3119  }
3120 
3121  if(!(cont->GetObject(run))){
3122  printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
3123  run = 137366;
3124  }
3125 
3126  // store info for all centralities to cache
3127  fMeanQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
3128  fWidthQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
3129 
3130  //for v3
3131  if(iside==0 && icoord==0)
3132  snprintf(namecont,100,"hQxc3_%i",i);
3133  else if(iside==1 && icoord==0)
3134  snprintf(namecont,100,"hQxa3_%i",i);
3135  else if(iside==0 && icoord==1)
3136  snprintf(namecont,100,"hQyc3_%i",i);
3137  else if(iside==1 && icoord==1)
3138  snprintf(namecont,100,"hQya3_%i",i);
3139 
3140  cont = (AliOADBContainer*) fOADB->Get(namecont);
3141  if(!cont){
3142  printf("OADB object %s is not available in the file\n",namecont);
3143  return;
3144  }
3145 
3146  if(!(cont->GetObject(run))){
3147  printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
3148  run = 137366;
3149  }
3150  // store info for all centralities to cache
3151  fMeanQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
3152  fWidthQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
3153  }
3154  }
3155  }
3156  // cleanup. the opened file is closed in the destructor, otherwise fVZEROgainEqualization is no longer available
3157  delete fpol0;
3158  // for qa store the runnumber that is currently used for calibration purposes
3159  fRunNumberCaliInfo = run;
3160 }
3161 //_____________________________________________________________________________i
3163 {
3164  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3165  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3166  #endif
3167 
3168  // 1) check if the proper chi weights for merging vzero a and vzero c ep are present
3169  // if not, use sane defaults. centrality binning is equal to that given in the fVZEROcentralityBin snippet
3170  //
3171  // when the user wants to, set the weights to 1 (effectively disabling them)
3172  // chi values can be calculated using the static helper function
3173  // AliAnalysisTaskJetV3::CalculateEventPlaneChi(Double_t res) where res is the event plane
3174  // resolution in a given centrality bin
3175  // the resolutions that were used for these defaults are
3176  Double_t chiC2[] = {0.771423, 1.10236, 1.38116, 1.48077, 1.31964, 1.10236, 0.674622, 0.600403, 0.273865};
3177  Double_t chiA2[] = {0.582214, 0.674622, 0.832214, 0.873962, 0.832214, 0.771423, 0.637146, 0.424255, 0.257385};
3178  Double_t chiC3[] = {0.493347, 0.493347, 0.458557, 0.407166, 0.356628, 0.273865, 0.176208, 6.10352e-05, 6.10352e-05};
3179  Double_t chiA3[] = {0.356628, 0.373474, 0.356628, 0.306702, 0.24115, 0.192322, 0.127869, 6.10352e-05, 6.10352e-05};
3180 
3181  if(!fChi2A) fChi2A = new TArrayD(9, chiA2);
3182  if(!fChi2C) fChi2C = new TArrayD(9, chiC2);
3183  if(!fChi3A) fChi3A = new TArrayD(9, chiA3);
3184  if(!fChi3C) fChi3C = new TArrayD(9, chiC3);
3185 
3186  Double_t sigmaC2[] = {7.50161e-05,0.000186685,0.000283528,0.000251427,0.000258122,2.26943e-05,0,0,0};
3187  Double_t sigmaA2[] = {0.000633027,0.000598435,0.000520023,0.000602312,0.00141679,0.00351296,0,0,0};
3188  Double_t sigmaC3[] = {4.69125e-05,0.000106922,0.000177552,0.000149093,0.000149436,0,0,0,0};
3189  Double_t sigmaA3[] = {0.000651813,0.000686852,0.000713499,0.000759663,0.00153532,0,0,0,0};
3190 
3191  if(!fSigma2A) fSigma2A = new TArrayD(9, sigmaA2);
3192  if(!fSigma2C) fSigma2C = new TArrayD(9, sigmaC2);
3193  if(!fSigma3A) fSigma3A = new TArrayD(9, sigmaA3);
3194  if(!fSigma3C) fSigma3C = new TArrayD(9, sigmaC3);
3195 }
3196 //_____________________________________________________________________________
3198  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3199  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3200  #endif
3201  if(!fOADB || fOADB->IsZombie()) {
3202  if (!gGrid) TGrid::Connect("alien");
3203  fOADB = TFile::Open("alien:///alice/cern.ch/user/r/rbertens/calibV0HIR.root");
3204  }
3205  if(fOADB->IsZombie()) {
3206  printf("OADB file could not be opened CALIBRATION FAILED !");
3207  return;
3208  }
3209 
3210  AliOADBContainer* cont = (AliOADBContainer*) fOADB->Get("hMultV0BefCorPfpx");
3211  fVZEROgainEqualization= ((TH1D*) cont->GetObject(fRunNumber));
3212 
3213  for(Int_t i(0); i < 2; i++) {
3214  Int_t fNHarm = i+2;
3215 
3216  AliOADBContainer* contQxnam = 0;
3217  if (fNHarm == 2) contQxnam = (AliOADBContainer*) fOADB->Get("fqxa2m");
3218  else if (fNHarm == 3) contQxnam = (AliOADBContainer*) fOADB->Get("fqxa3m");
3219  if(!contQxnam || !(contQxnam->GetObject(fRunNumber))) {
3220  printf("OADB object fqyanm is not available for run %i\n", fRunNumber);
3221  return;
3222  }
3223  fMQ[0][0][i] = ((TH1D*) contQxnam->GetObject(fRunNumber));
3224 
3225  AliOADBContainer* contQynam = 0;
3226  if (fNHarm == 2) contQynam = (AliOADBContainer*) fOADB->Get("fqya2m");
3227  else if (fNHarm == 3) contQynam = (AliOADBContainer*) fOADB->Get("fqya3m");
3228  if(!contQynam || !(contQynam->GetObject(fRunNumber))) {
3229  printf("OADB object fqyanm is not available for run %i\n", fRunNumber);
3230  return;
3231  }
3232  fMQ[1][0][i] = ((TH1D*) contQynam->GetObject(fRunNumber));
3233 
3234  AliOADBContainer* contQxnas = 0;
3235  if (fNHarm == 2) contQxnas = (AliOADBContainer*) fOADB->Get("fqxa2s");
3236  else if (fNHarm == 3) contQxnas = (AliOADBContainer*) fOADB->Get("fqxa3s");
3237 
3238  if(!contQxnas || !(contQxnas->GetObject(fRunNumber))) {
3239  printf("OADB object fqxans is not available for run %i\n", fRunNumber);
3240  return;
3241  }
3242  fWQ[0][0][i] = ((TH1D*) contQxnas->GetObject(fRunNumber));
3243 
3244  AliOADBContainer* contQynas = 0;
3245  if (fNHarm == 2) contQynas = (AliOADBContainer*) fOADB->Get("fqya2s");
3246  else if (fNHarm == 3) contQynas = (AliOADBContainer*) fOADB->Get("fqya3s");
3247 
3248  if(!contQynas || !(contQynas->GetObject(fRunNumber))){
3249  printf("OADB object fqyans is not available for run %i\n", fRunNumber);
3250  return;
3251  }
3252  fWQ[1][0][i] = ((TH1D*) contQynas->GetObject(fRunNumber));
3253 
3254  AliOADBContainer* contQxncm = 0;
3255  if (fNHarm == 2) contQxncm = (AliOADBContainer*) fOADB->Get("fqxc2m");
3256  else if (fNHarm == 3) contQxncm = (AliOADBContainer*) fOADB->Get("fqxc3m");
3257 
3258  if(!contQxncm || !(contQxncm->GetObject(fRunNumber))) {
3259  printf("OADB object fqxcnm is not available for run %i\n", fRunNumber);
3260  return;
3261  }
3262  fMQ[0][1][i] = ((TH1D*) contQxncm->GetObject(fRunNumber));
3263 
3264  AliOADBContainer* contQyncm = 0;
3265  if (fNHarm == 2) contQyncm = (AliOADBContainer*) fOADB->Get("fqyc2m");
3266  else if (fNHarm == 3) contQyncm = (AliOADBContainer*) fOADB->Get("fqyc3m");
3267  if(!contQyncm || !(contQyncm->GetObject(fRunNumber))) {
3268  printf("OADB object fqyc2m is not available for run %i\n", fRunNumber);
3269  return;
3270  }
3271  fMQ[1][1][i] = ((TH1D*) contQyncm->GetObject(fRunNumber));
3272 
3273  AliOADBContainer* contQxncs = 0;
3274  if (fNHarm == 2) contQxncs = (AliOADBContainer*) fOADB->Get("fqxc2s");
3275  else if (fNHarm == 3) contQxncs = (AliOADBContainer*) fOADB->Get("fqxc3s");
3276  if(!contQxncs || !(contQxncs->GetObject(fRunNumber))) {
3277  printf("OADB object fqxc2s is not available for run %i\n", fRunNumber);
3278  return;
3279  }
3280  fWQ[0][1][i] = ((TH1D*) contQxncs->GetObject(fRunNumber));
3281 
3282  AliOADBContainer* contQyncs = 0;
3283  if (fNHarm == 2) contQyncs = (AliOADBContainer*) fOADB->Get("fqyc2s");
3284  else if (fNHarm == 3) contQyncs = (AliOADBContainer*) fOADB->Get("fqyc3s");
3285  if(!contQyncs || !(contQyncs->GetObject(fRunNumber))){
3286  printf("OADB object fqycns is not available for run %i\n", fRunNumber);
3287  return;
3288  }
3289  fWQ[1][1][i] = ((TH1D*) contQyncs->GetObject(fRunNumber));
3290  }
3291 }
3292 //_____________________________________________________________________________
3294 {
3295  // return cache index number corresponding to the event centrality
3296  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3297  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3298  #endif
3299  Float_t v0Centr(-1.);
3300  switch (fCollisionType) {
3301  case kPbPb15o : {
3302  v0Centr = GetCentrality("V0M");
3303  } break;
3304  default : {
3305  v0Centr = InputEvent()->GetCentrality()->GetCentralityPercentile("V0M");
3306  } break;
3307  }
3308  if(v0Centr < 5) return 0;
3309  else if(v0Centr < 10) return 1;
3310  else if(v0Centr < 20) return 2;
3311  else if(v0Centr < 30) return 3;
3312  else if(v0Centr < 40) return 4;
3313  else if(v0Centr < 50) return 5;
3314  else if(v0Centr < 60) return 6;
3315  else if(v0Centr < 70) return 7;
3316  else return 8;
3317 }
3318 //_____________________________________________________________________________
3320  // return pointer to the highest pt jet (before background subtraction) within acceptance
3321  // only rudimentary cuts are applied on this level, hence the implementation outside of
3322  // the framework
3323  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3324  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3325  #endif
3326  Int_t iJets(fJets->GetEntriesFast());
3327  Double_t pt(0);
3328  AliEmcalJet* leadingJet(0x0);
3329  if(!localRho) {
3330  for(Int_t i(0); i < iJets; i++) {
3331  AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(i));
3332  if(!PassesSimpleCuts(jet)) continue;
3333  if(jet->Pt() > pt) {
3334  leadingJet = jet;
3335  pt = leadingJet->Pt();
3336  }
3337  }
3338  return leadingJet;
3339  } else {
3340  // return leading jet after background subtraction
3341  Double_t rho(0);
3342  for(Int_t i(0); i < iJets; i++) {
3343  AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(i));
3344  if(!PassesSimpleCuts(jet)) continue;
3345  rho = localRho->GetLocalVal(jet->Phi(), GetJetContainer()->GetJetRadius(), localRho->GetVal());
3346  if(fUse2DIntegration) rho = localRho->GetLocalValInEtaPhi(jet->Phi(), GetJetContainer()->GetJetRadius(), localRho->GetVal());
3347  if((jet->Pt()-jet->Area()*rho) > pt) {
3348  leadingJet = jet;
3349  pt = (leadingJet->Pt()-jet->Area()*rho);
3350  }
3351  }
3352  return leadingJet;
3353  }
3354  return 0x0;
3355 }
3356 //_____________________________________________________________________________
3358  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3359  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3360  #endif
3361 
3362  // find and return the leading constituent of the jet
3363  Double_t maxPt(-1.);
3364  Int_t iTracks(jet->GetNumberOfTracks());
3365  AliVParticle* leadingTrack(0x0);
3366  for(Int_t i(0); i < iTracks; i++) {
3367  AliVParticle* vp(static_cast<AliVParticle*>(jet->TrackAt(i, fTracksCont->GetArray())));
3368  if(vp && (vp->Pt() > maxPt)) {
3369  maxPt = vp->Pt();
3370  leadingTrack = vp;
3371  }
3372  }
3373  return leadingTrack;
3374 }
3375 //_____________________________________________________________________________
3377 {
3378  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3379  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3380  #endif
3381 
3382  // get event weights distribution from event plane distribution
3383  TH1F* temp((TH1F*)hist->Clone(Form("EP_weights_cen_%i", c)));
3384  Double_t integral(hist->Integral()/hist->GetNbinsX());
3385  // loop over bins and extract the weights
3386  for(Int_t i(0); i < hist->GetNbinsX(); i++) {
3387  temp->SetBinError(1+i, 0.); // uncertainty is irrelevant
3388  temp->SetBinContent(1+i, integral/hist->GetBinContent(1+i));
3389  }
3390  return temp;
3391 }
3392 //_____________________________________________________________________________
3394 {
3395  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3396  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3397  #endif
3398 
3399  // test function to print binary representation of given trigger mask
3400  // trigger mask is represented by 32 bits (hardcoded as it is an UInt_t )
3401  TString triggerName[] = { // trigger names and their corresponding bits. some bits have multiple names
3402  "kMB", // 0
3403  "kINT7", // 1
3404  "kMUON", // 2
3405  "kHighMult", // 3
3406  "kEMC1", // 4
3407  "kCINT5", // 5
3408  "kCMUS5 kMUSPB", // 6
3409  "kMUSH7 kMUSHPB", // 7
3410  "kMUL7 kMuonLikePB", // 8
3411  "kMUU7 kMuonUnlikePB", // 9
3412  "kEMC7 kEMC8", // 10
3413  "kMUS7", // 11
3414  "kPHI1", // 12
3415  "kPHI7 kPHI8 kPHOSPb", // 13
3416  "kEMCEJE", // 14
3417  "kEMCEGA", // 15
3418  "kCentral", // 16
3419  "kSemiCentral", // 17
3420  "kDG5", // 18
3421  "kZED", // 19
3422  "kSPI7 kSPI", // 20
3423  "kINT8", // 21
3424  "kMuonSingleLowPt", // 22
3425  "kMuonSingleHighPt8", // 23
3426  "kMuonLikeLowPt8", // 24
3427  "kMuonUnlikeLowPt8", // 25
3428  "kMuonUnlikeLowPt0", // 26
3429  "kUserDefined", // 27
3430  "kTRD"}; // 28
3431  TString notTriggered = "not fired";
3432  printf(" > trigger is %u \n ", trigger);
3433 
3434  // extract which triggers have been fired exactly and print summary of bits
3435  for (Int_t i(0); i < 29; i++) printf("[bit %i]\t [%u] [%s]\n", i, (trigger & ((UInt_t)1 << i)) ? 1U : 0U, (trigger & ((UInt_t)1 << i)) ? triggerName[i].Data() : notTriggered.Data());
3436 
3437  // print accepted trigger combinations
3438  printf(" ====== accepted trigger combinations ======= \n");
3439  UInt_t MB_EMCEJE(AliVEvent::kMB | AliVEvent::kEMCEJE);
3440  UInt_t CEN_EMCEJE(AliVEvent::kCentral | AliVEvent::kEMCEJE);
3441  UInt_t SEM_EMCEJE(AliVEvent::kSemiCentral | AliVEvent::kEMCEJE);
3442  UInt_t ALL_EMCEJE(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kEMCEJE);
3443  UInt_t MB_EMCEGA(AliVEvent::kMB | AliVEvent::kEMCEGA);
3444  UInt_t CEN_EMCEGA(AliVEvent::kCentral | AliVEvent::kEMCEGA);
3445  UInt_t SEM_EMCEGA(AliVEvent::kSemiCentral | AliVEvent::kEMCEGA);
3446  UInt_t ALL_EMCEGA(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kEMCEGA);
3447  if(trigger == 0) printf("(trigger == 0)\n");
3448  if(trigger & AliVEvent::kAny) printf("(trigger & AliVEvent::kAny)\n");
3449  if(trigger & AliVEvent::kAnyINT) printf("(trigger & AliVEvent::kAnyINT\n");
3450  if(trigger & AliVEvent::kMB) printf("(trigger & AliVEvent::kMB)\n");
3451  if(trigger & AliVEvent::kCentral) printf("(trigger & AliVEvent::kCentral)\n");
3452  if(trigger & AliVEvent::kSemiCentral) printf("(trigger & AliVEvent::kSemiCentral)\n");
3453  if(trigger & AliVEvent::kEMCEJE) printf("(trigger & AliVEvent::kEMCEJE)\n");
3454  if(trigger & AliVEvent::kEMCEGA) printf("(trigger & AliVEvent::kEMCEGA)\n");
3455  if((trigger & MB_EMCEJE) == MB_EMCEJE) printf("(trigger & MB_EMCEJE) == MB_EMCEJE)\n");
3456  if((trigger & CEN_EMCEJE) == CEN_EMCEJE) printf("(trigger & CEN_EMCEJE) == CEN_EMCEJE)\n");
3457  if((trigger & SEM_EMCEJE) == SEM_EMCEJE) printf("(trigger & SEM_EMCEJE) == SEM_EMCEJE)\n");
3458  if((trigger & ALL_EMCEJE) == ALL_EMCEJE) printf("(trigger & ALL_EMCEJE) == ALL_EMCEJE)\n");
3459  if((trigger & MB_EMCEGA) == MB_EMCEGA) printf("(trigger & MB_EMCEGA) == MB_EMCEGA)\n");
3460  if((trigger & CEN_EMCEGA) == CEN_EMCEGA) printf("(trigger & CEN_EMCEGA) == CEN_EMCEGA)\n");
3461  if((trigger & SEM_EMCEGA) == SEM_EMCEGA) printf("(trigger & SEM_EMCEGA) == SEM_EMCEGA)\n");
3462  if((trigger & ALL_EMCEGA) == ALL_EMCEGA) printf("(trigger & ALL_EMCEGA) == ALL_EMCEGA)\n");
3463 }
3464 //_____________________________________________________________________________
3466 {
3467  // function for simple illustration of in-plane, out-of-plane method
3468 
3469  // azimuthal distribution
3470  TF1* dNdphi = new TF1("dNdphi", "1.+2.*([0]*TMath::Cos(2.*(x-[1]))+[2]*TMath::Cos(3.*(x-[3]))+[4]*TMath::Cos(4.*(x-[5])))", 0, 2*TMath::Pi());
3471 
3472  // set harmonics
3473  dNdphi->SetParameter(0, v2); // v2
3474  dNdphi->SetParameter(2, v3); // v3
3475  dNdphi->SetParameter(4, v4); // v4
3476  Double_t in(0), out(0), r(0);
3477 
3478  for(Int_t i(0); i < nEvents; i ++) {
3479  // orthogonal event planes
3480  dNdphi->SetParameter(1, gRandom->Uniform(-TMath::Pi()/2.,TMath::Pi()/2.));
3481  dNdphi->SetParameter(3, gRandom->Uniform(-TMath::Pi()/3.,TMath::Pi()/3.));
3482  dNdphi->SetParameter(5, gRandom->Uniform(-TMath::Pi()/4.,TMath::Pi()/4.));
3483 
3484  // ep loop
3485  Double_t qx(0), qy(0);
3486  for(Int_t j(0); j < 100; j++) {
3487  Double_t x = dNdphi->GetRandom(0, TMath::TwoPi());
3488  qx+=TMath::Cos(2.*x);
3489  qy+=TMath::Sin(2.*x);
3490  }
3491  Double_t ep(TMath::ATan2(qy,qx)/2.);
3492 
3493  // track loop
3494  for(Int_t j(0); j < 500; j++) {
3495  Double_t x(dNdphi->GetRandom(0, TMath::TwoPi())-ep);
3496  x = PhaseShift(x, 2);
3497  // determine which plane it is in
3498  (x > TMath::Pi()/4. && x < 3*TMath::Pi()/4.) ? out++ : in++;
3499  }
3500  r += TMath::Cos(2.*(ep-dNdphi->GetParameter(1)));
3501  }
3502 
3503  r/=100000;
3504  cout << " event plane resolution is: " << r << endl;
3505 
3506  Double_t pre = TMath::Pi()/(r*4.);
3507  Double_t ratio = pre*((in-out)/(in+out));
3508  Double_t eout = TMath::Sqrt(out);
3509  Double_t ein = TMath::Sqrt(in);
3510  Double_t error2 = (4.*out*out/(TMath::Power(in+out, 4)))*ein*ein+(4.*in*in/(TMath::Power(in+out, 4)))*eout*eout;
3511  error2 = error2*pre*pre;
3512  if(error2 > 0) error2 = TMath::Sqrt(error2);
3513 
3514  dNdphi->SetTitle("total");
3515  dNdphi->DrawCopy();
3516  cout << "in: " << in << "\t out: " << out << endl;
3517  cout << "v2: " << ratio << "\t error: " << error2 << endl;
3518 
3519  TF1* dNdphi2 = new TF1("dNdphi", "1.+2.*([0]*TMath::Cos(2.*(x-[1])))", 0, 2*TMath::Pi());
3520  TF1* dNdphi3 = new TF1("dNdphi", "1.+2.*([0]*TMath::Cos(3.*(x-[1])))", 0, 2*TMath::Pi());
3521  TF1* dNdphi4 = new TF1("dNdphi", "1.+2.*([0]*TMath::Cos(4.*(x-[1])))", 0, 2*TMath::Pi());
3522 
3523  dNdphi2->SetParameter(0, dNdphi->GetParameter(0));
3524  dNdphi2->SetParameter(1, dNdphi->GetParameter(1));
3525  dNdphi2->SetLineColor(kBlue);
3526  dNdphi2->SetLineStyle(7);
3527  dNdphi2->SetTitle("v_{2}");
3528  dNdphi2->DrawCopy("same");
3529 
3530  dNdphi3->SetParameter(0, dNdphi->GetParameter(2));
3531  dNdphi3->SetParameter(1, dNdphi->GetParameter(3));
3532  dNdphi3->SetLineColor(kGreen);
3533  dNdphi3->SetLineStyle(7);
3534  dNdphi3->SetTitle("v_{3}");
3535  dNdphi3->DrawCopy("same");
3536 
3537  dNdphi4->SetParameter(0, dNdphi->GetParameter(4));
3538  dNdphi4->SetParameter(1, dNdphi->GetParameter(5));
3539  dNdphi4->SetLineColor(kMagenta);
3540  dNdphi4->SetLineStyle(7);
3541  dNdphi4->SetTitle("v_{4}");
3542  dNdphi4->DrawCopy("same");
3543 }
3544 //_____________________________________________________________________________
3545 Float_t AliAnalysisTaskJetV3::GetCentrality(const char* estimator) const
3546 {
3547  // return centrality percentile using new framework
3548  // return -1 when something goes wrong
3549  #ifdef ALIANALYSISTASKJETV3_DEBUG_FLAG_1
3550  printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
3551  #endif
3552  AliMultSelection *multSelection = 0x0;
3553  if(!InputEvent()) return -1.;
3554  multSelection = static_cast<AliMultSelection*>(InputEvent()->FindListObject("MultSelection"));
3555  if(multSelection) return multSelection->GetMultiplicityPercentile(estimator);
3556  return -1.;
3557 }
static Double_t ChiSquareCDF(Int_t ndf, Double_t x)
TH2F * fHistRunnumbersPhi
QA profile of centralty vs multiplicity.
Float_t fMeanQ[9][2][2]
event plane dependence of jet pt vs rho_0
Int_t fRunNumberCaliInfo
current runnumber (for QA and jet, track selection)
void CalculateQvectorCombinedVZERO(Double_t Q2[2], Double_t Q3[2]) const
static Double_t CalculateEventPlaneChi(Double_t res)
TH1 * fMQ[2][2][2]
recentering
Double_t Area() const
Definition: AliEmcalJet.h:117
AliRhoParameter * fCachedRho
TList * fOutputListGood
output list
TH2F * fHistDeltaPtDeltaPhi3[10]
rcpt
TH2F * fHistJetEtaRho[10]
jet pt versus number of constituents
TH2F * fHistLeadingJetBackground[10]
correlation of event planes
double Double_t
Definition: External.C:58
TH2F * fHistRhoAVsMult
rho veruss centrality
Definition: External.C:260
TH1F * GetResolutionFromOutputFile(detectorType detector, Int_t h=2, TArrayD *c=0x0)
TF1 * fFitModulation
centrality bin
TH2F * fHistRhoStatusCent
p value vs kolmogorov value
TH2F * fHistTriggerQAIn[10]
eta phi emcal clusters, pt weighted
Definition: External.C:236
Int_t fMappedRunNumber
runnumber of the cached calibration info
const char * title
Definition: MakeQAPdf.C:26
AliVParticle * GetLeadingTrack(AliEmcalJet *jet)
TH2F * fHistChi2ROOTCent
p value versus centrlaity from root
Bool_t PassesCuts(AliVParticle *track) const
AliJetContainer * GetJetContainer(Int_t i=0) const
void FillAnalysisSummaryHistogram() const
TH2F * fHistPvalueCDFROOTCent
pdf value of chisquare p
UInt_t fOffTrigger
offline trigger for event selection
Double_t CalculateQC2(Int_t harm)
TH2F * fHistJetEtaPhi[10]
jet pt before area cut
Double_t Eta() const
Definition: AliEmcalJet.h:108
TH2F * fHistClusterEtaPhiWeighted[10]
eta phi emcal clusters
Double_t fMinCent
min centrality for event selection
TH1F * fHistVertexz
centrality versus perc lost
Bool_t CorrectRho(Double_t psi2, Double_t psi3)
void FillWeightedClusterHistograms() const
Double_t Phi() const
Definition: AliEmcalJet.h:104
TH1F * fHistJetPtRaw[10]
dpt vs dphi, excl leading jet, rho_0
static void DoSimpleSimulation(Int_t nEvents=100000, Float_t v2=0.02, Float_t v3=0.04, Float_t v4=0.03)
Container with name, TClonesArray and cuts for particles.
Double_t GetLocalVal(Double_t phi, Double_t r, Double_t n) const
TH1F * fHistPvalueCDFROOT
calibration info per runnumber
TProfile * fProfV2
swap histogram
void FillQAHistograms(AliVTrack *vtrack) const
TH2F * fHistJetPtConstituents[10]
jet pt versus eta (temp control)
Bool_t fAttachToEvent
is the analysis initialized?
TH2F * fHistRhoVsRCPt[10]
random cone eta and phi
TH2F * fHistPsiVZEROATRK
psi 2 from tpc
Double_t GetJetEtaMax() const
AliEmcalJet * GetLeadingJet(AliLocalRhoParameter *localRho=0x0)
TH2F * fHistClusterEtaPhi[10]
pt emcal clusters
TCanvas * c
Definition: TestFitELoss.C:172
Int_t fInCentralitySelection
mapped runnumer (for QA)
TH1F * fHistUndeterminedRunQA
status of rho as function of centrality
TH1F * fHistEPBC
fHistMultVsCellBC
void FillWeightedQAHistograms(AliVTrack *vtrack) const
static void NumericalOverlap(Double_t x1, Double_t x2, Double_t psi2, Double_t &percIn, Double_t &percOut, Double_t &percLost)
TH2F * fHistDeltaPtDeltaPhi3ExLJRho0[10]
dpt vs dphi, excl leading jet
TH1F * BookTH1F(const char *name, const char *x, Int_t bins, Double_t min, Double_t max, Int_t c=-1, Bool_t append=kTRUE)
TH2F * fHistPKolmogorov
KolmogorovTest value, centrality correlation.
TH2F * fHistKolmogorovTestCent
KolmogorovTest value.
TH1F * fHistJetPt[10]
jet pt - no background subtraction
static Double_t ChiSquare(TH1 &histo, TF1 *func)
TH2F * fHistRhoVsCent
rho versus multiplicity
TH2F * fHistPvalueCDFCent
cdf value of chisquare p
void CalculateEventPlaneTPC(Double_t *tpc)
static void PrintTriggerSummary(UInt_t trigger)
TRandom * gRandom
static Bool_t IsInPlane(Double_t dPhi)
void FillWeightedTrackHistograms() const
TProfile * fProfV3Cumulant
extracted v3
void CalculateEventPlaneVZERO(Double_t vzero[2][2]) const
void CalculateEventPlaneResolution(Double_t vzero[2][2], Double_t *vzeroComb, Double_t *tpc)
TH2F * fHistRCPhiEta[10]
rho vs eta before cuts
static Double_t PhaseShift(Double_t x)
TH2F * fHistRhoAVsCent
rho * A vs multiplicity for all jets
UShort_t GetNumberOfConstituents() const
Definition: AliEmcalJet.h:127
TH1I * fHistRunnumbersCaliInfo
run numbers averaged eta
TH2F * fHistEPCorrAvSigma[10]
ep corr
UShort_t GetNumberOfTracks() const
Definition: AliEmcalJet.h:126
TH2F * fHistDeltaPtDeltaPhi3ExLJ[10]
rcpt, excl leading jet
TH1F * fHistSwap
analysis summary
TH2F * fHistMultCorAfterCuts
accepted verte
TProfile * fHistCentralityPercOut
centrality versus perc in
TH2F * fHistPicoCat1[10]
multiplicity of accepted pico tracks
TH2F * fHistJetPsi3Pt[10]
jet eta versus rho
TString fLocalRhoName
name for local rho
static TH1F * GetEventPlaneWeights(TH1F *hist, Int_t c)
TH3F * fHistPsiTPCLeadingJet[10]
same qa lot
Double_t GetWDist(const AliVVertex *v0, const AliVVertex *v1)
TH3F * fHistEPCorrelations[10]
psi 2 from tpc
void FillWeightedTriggerQA(Double_t dPhi, Double_t pt, UInt_t trigger)
TH2F * fHistPsiVZEROTRK
psi 2 from vzero c
TH3F * fHistPsi3Correlation[10]
correlation vzerocomb EP, LJ pt
int Int_t
Definition: External.C:63
TH2F * fHistRunnumbersEta
run numbers averaged phi
virtual AliVParticle * GetParticle(Int_t i=-1) const
Definition: External.C:204
Float_t fWidthQ[9][2][2]
recentering
unsigned int UInt_t
Definition: External.C:33
Bool_t QCnRecovery(Double_t psi2, Double_t psi3)
void QCnQnk(Int_t n, Int_t k, Double_t &reQ, Double_t &imQ)
float Float_t
Definition: External.C:68
Double_t fMaxVz
max vertex for event selection
TH2F * fHistRhoVsRCPtExLJ[10]
random cone eta and phi, excl leading jet
Int_t fNAcceptedTracksQCn
number of accepted tracks
AliRhoParameter * fRho
! event rho
Float_t fVZEROApol
equalization histo
AliEmcalJet * fLeadingJetAfterSub
leading jet
TH2F * fHistIntegralCorrelations[10]
ep corr
TH1F * CorrectForResolutionDiff(TH1F *v, detectorType detector, TArrayD *cen, Int_t c, Int_t h=2)
void SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0)
TH2F * fHistQyV0c
qx v0a before cuts
TH2F * fHistJetPtArea[10]
eta and phi correlation before cuts
Double_t GetLocalValInEtaPhi(Double_t phi, Double_t r, Double_t n, Int_t gran=20) const
TH1F * fHistPicoTrackPt[10]
resolution parameters for v3
TH1F * fHistRCPt[10]
rho * A vs rcpt
void CalculateEventPlaneCombinedVZERO(Double_t *comb) const
BeamType fForceBeamType
forced beam type
fitGoodnessTest fFitGoodnessTest
TProfile * fProfV2Cumulant
extracted v2
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Definition: External.C:212
TH2F * fHistJetEtaPhiBC[10]
eta and phi correlation
Float_t GetCentrality(const char *estimator) const
Float_t fWidthQv3[9][2][2]
recentering
TH2F * fHistMultvsCentr
QA profile global and tpc multiplicity after outlier cut.
Float_t fSoftTrackMinPt
temp cache for rho pointer
Int_t GetNClusters() const
Double_t fMinVz
min vertex for event selection
TProfile * fHistCentralityPercIn
accepted centrality
TArrayD * fChi2A
calibration info per disc
TH2F * fHistQxV0cBC
qx v0a before cuts
Double_t fCent
!event centrality
TH2F * fHistQyV0cBC
qx v0a before cuts
TH2F * fHistPChi2
reduced chi2, centrlaity correlation
TProfile * fProfIntegralCorrelations[10]
correlate polar or local integral
AliLocalRhoParameter * fLocalRho
! local event rho
TH1F * fHistKolmogorovTest
correlation p value and reduced chi2
TH1F * fHistPicoTrackMult[10]
pt of all charged tracks
TH2F * fHistRhoVsMult
background
TH2F * fHistPsiVZEROCTRK
psi 2 from vzero a
TH1 * fWQ[2][2][2]
recentering
TH3F * fHistPsiVZEROCombLeadingJet[10]
correlation vzeroc EP, LJ pt
TH2F * fHistTriggerQAOut[10]
trigger qa in plane
TProfile * fProfV3
resolution parameters for v2
ClassImp(AliAnalysisTaskJetV3) AliAnalysisTaskJetV3
TH3F * fHistPsiVZEROALeadingJet[10]
correlation tpc EP, LJ pt
TH2F * fHistEPCorrChiSigma[10]
ep corr
TH2F * fHistPsiTPCTRK
psi 2 from combined vzero
void FillWeightedJetHistograms(Double_t psi3)
AliVCluster * GetCluster(Int_t i) const
Float_t fVZEROCpol
calibration info per disc
void FillWeightedDeltaPtHistograms(Double_t psi3) const
TH2F * fHistMultVsCellBC
qx v0a before cuts
TProfile * fProfV2Resolution[10]
v2 cumulant
void FillHistogramsAfterSubtraction(Double_t psi3, Double_t vzero[2][2], Double_t *vzeroComb, Double_t *tpc)
TClonesArray * fJets
! jets
TH1F * fHistRCPtExLJ[10]
rho * A vs rcpt, excl leading jet
TH1F * fHistRhoPackage[10]
geometric correlation of leading jet w/wo bkg subtraction
TProfile * fProfV3Resolution[10]
v3 cumulant
TH2F * fHistRCPhiEtaExLJ[10]
dpt vs dphi, rho_0
Double_t KolmogorovTest() const
TH2F * fHistPChi2Root
reduced chi2 from ROOT, centrality correlation
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
short Short_t
Definition: External.C:23
Bool_t PassesSimpleCuts(AliEmcalJet *jet)
void SetJetPhiLimits(Float_t min, Float_t max, Int_t c=0)
Double_t Pt() const
Definition: AliEmcalJet.h:96
TH1F * fHistRho[10]
rho as estimated by emcal jet package
TH2F * fHistDeltaPtDeltaPhi3Rho0[10]
dpt vs dphi (psi2 - phi)
virtual Bool_t IsEventSelected()
TH2F * fHistJetPtEta[10]
jet pt versus area before cuts
Float_t GetJetRadius() const
void FillWeightedEventPlaneHistograms(Double_t vzero[2][2], Double_t *vzeroComb, Double_t *tpc) const
Float_t nEvents[nProd]
virtual void Terminate(Option_t *option)
TClonesArray * fTracks
!tracks
Int_t fNAcceptedTracks
leading jet after background subtraction
Short_t TrackAt(Int_t idx) const
Definition: AliEmcalJet.h:147
virtual void Exec(Option_t *)
Double_t GetParticlePhiMax() const
TH2F * fHistPsiVZEROCV0M
psi 2 from vzero a
Float_t fMeanQv3[9][2][2]
recentering
Double_t fVertex[3]
!event vertex
TH2F * fHistRhoEtaBC[10]
rho * A vs centrality for all jets
TH2F * fHistPicoCat3[10]
pico tracks wo spd hit w refit, constrained
TH2F * fHistChi2Cent
p value vs centrality