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