1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 * analysis task for jet flow preparation
19 * this task is part of the emcal jet framework and should be run in the emcaljet train
20 * the following extensions to an accepted AliVEvent are expected:
22 * - background estimate rho
24 * aod's and esd's are handled transparently
25 * the task will attempt to estimate a phi-dependent background density rho
26 * by fitting vn harmonics to the dpt/dphi distribution
28 * author: Redmer Alexander Bertens, Utrecht Univeristy, Utrecht, Netherlands
29 * rbertens@cern.ch, rbertens@nikhef.nl, r.a.bertens@uu.nl
43 #include <AliAnalysisTask.h>
44 #include <AliAnalysisManager.h>
45 #include <AliCentrality.h>
46 #include <AliVVertex.h>
47 #include <AliESDEvent.h>
48 #include <AliAODEvent.h>
49 #include <AliAODTrack.h>
50 // emcal jet framework includes
51 #include <AliPicoTrack.h>
52 #include <AliEmcalJet.h>
53 #include <AliRhoParameter.h>
55 #include "AliAnalysisTaskRhoVnModulation.h"
58 class AliAnalysisTaskRhoVnModulation;
61 ClassImp(AliAnalysisTaskRhoVnModulation)
63 AliAnalysisTaskRhoVnModulation::AliAnalysisTaskRhoVnModulation() : AliAnalysisTaskEmcalJet("AliAnalysisTaskRhoVnModulation", kTRUE),
64 fDebug(0), fInitialized(0), fFillQAHistograms(kTRUE), fCentralityClasses(0), fUserSuppliedV2(0), fUserSuppliedV3(0), fUserSuppliedR2(0), fUserSuppliedR3(0), fNAcceptedTracks(0), fFitModulationType(kNoFit), fUsePtWeight(kTRUE), fDetectorType(kTPC), fFitModulationOptions("Q"), fRunModeType(kGrid), fDataType(kESD), fRandom(0), fMappedRunNumber(0), fInCentralitySelection(-1), fFitModulation(0), fMinPvalue(0), fMaxPvalue(1), fNameJetClones(0), fNamePicoTrackClones(0), fNameRho(0), fLocalJetMinEta(-10), fLocalJetMaxEta(-10), fLocalJetMinPhi(-10), fLocalJetMaxPhi(-10), fAbsVertexZ(10), fHistCentrality(0), fHistVertexz(0), fHistRunnumbersPhi(0), fHistRunnumbersEta(0), fHistPvaluePDF(0), fHistPvalueCDF(0), fMinDisanceRCtoLJ(0), fRandomConeRadius(-1.), fAbsVnHarmonics(kTRUE), fExcludeLeadingJetsFromFit(1.), fRebinSwapHistoOnTheFly(kTRUE), fPercentageOfFits(10.), fUseV0EventPlaneFromHeader(kFALSE), fSetPtSub(kFALSE), fExplicitOutlierCut(-1), fMinLeadingHadronPt(0), fOutputList(0), fOutputListGood(0), fOutputListBad(0), fHistAnalysisSummary(0), fHistSwap(0), fProfV2(0), fProfV3(0), fHistPsiControl(0), fHistPsiSpread(0), fHistPsiVZEROA(0), fHistPsiVZEROC(0), fHistPsiTPC(0), fHistRhoVsMult(0), fHistRhoVsCent(0), fHistRhoAVsMult(0), fHistRhoAVsCent(0) {
65 for(Int_t i(0); i < 10; i++) {
66 fProfV2Resolution[i] = 0;
67 fProfV3Resolution[i] = 0;
68 fHistPicoTrackPt[i] = 0;
72 /* fHistClusterPt[i] = 0; */
73 /* fHistClusterPhi[i] = 0; */
74 /* fHistClusterEta[i] = 0; */
75 /* fHistClusterCorrPt[i] = 0; */
76 /* fHistClusterCorrPhi[i] = 0; */
77 /* fHistClusterCorrEta[i] = 0; */
78 fHistRhoPackage[i] = 0;
81 fHistRhoVsRCPt[i] = 0;
83 fHistDeltaPtDeltaPhi2[i] = 0;
84 fHistDeltaPtDeltaPhi3[i] = 0;
85 fHistRCPhiEtaExLJ[i] = 0;
86 fHistRhoVsRCPtExLJ[i] = 0;
88 fHistDeltaPtDeltaPhi2ExLJ[i] = 0;
89 fHistDeltaPtDeltaPhi3ExLJ[i] = 0;
90 /* fHistRCPhiEtaRand[i] = 0; */
91 /* fHistRhoVsRCPtRand[i] = 0; */
92 /* fHistRCPtRand[i] = 0; */
93 /* fHistDeltaPtDeltaPhi2Rand[i] = 0; */
94 /* fHistDeltaPtDeltaPhi3Rand[i] = 0; */
97 fHistJetEtaPhi[i] = 0;
98 fHistJetPtArea[i] = 0;
99 fHistJetPtConstituents[i] = 0;
100 fHistJetEtaRho[i] = 0;
101 fHistJetPsiTPCPt[i] = 0;
102 fHistJetPsiVZEROAPt[i] = 0;
103 fHistJetPsiVZEROCPt[i] = 0;
104 fHistDeltaPhi2VZEROA[i] = 0;
105 fHistDeltaPhi2VZEROC[i] = 0;
106 fHistDeltaPhi2TPC[i] = 0;
107 fHistDeltaPhi3VZEROA[i] = 0;
108 fHistDeltaPhi3VZEROC[i] = 0;
109 fHistDeltaPhi3TPC[i] = 0;
111 // default constructor
113 //_____________________________________________________________________________
114 AliAnalysisTaskRhoVnModulation::AliAnalysisTaskRhoVnModulation(const char* name, runModeType type) : AliAnalysisTaskEmcalJet(name, kTRUE),
115 fDebug(0), fInitialized(0), fFillQAHistograms(kTRUE), fCentralityClasses(0), fUserSuppliedV2(0), fUserSuppliedV3(0), fUserSuppliedR2(0), fUserSuppliedR3(0), fNAcceptedTracks(0), fFitModulationType(kNoFit), fUsePtWeight(kTRUE), fDetectorType(kTPC), fFitModulationOptions("Q"), fRunModeType(type), fDataType(kESD), fRandom(0), fMappedRunNumber(0), fInCentralitySelection(-1), fFitModulation(0), fMinPvalue(0), fMaxPvalue(1), fNameJetClones(0), fNamePicoTrackClones(0), fNameRho(0), fLocalJetMinEta(-10), fLocalJetMaxEta(-10), fLocalJetMinPhi(-10), fLocalJetMaxPhi(-10), fAbsVertexZ(10), fHistCentrality(0), fHistVertexz(0), fHistRunnumbersPhi(0), fHistRunnumbersEta(0), fHistPvaluePDF(0), fHistPvalueCDF(0), fMinDisanceRCtoLJ(0), fRandomConeRadius(-1.), fAbsVnHarmonics(kTRUE), fExcludeLeadingJetsFromFit(1.), fRebinSwapHistoOnTheFly(kTRUE), fPercentageOfFits(10.), fUseV0EventPlaneFromHeader(kFALSE), fSetPtSub(kFALSE), fExplicitOutlierCut(-1), fMinLeadingHadronPt(0), fOutputList(0), fOutputListGood(0), fOutputListBad(0), fHistAnalysisSummary(0), fHistSwap(0), fProfV2(0), fProfV3(0), fHistPsiControl(0), fHistPsiSpread(0), fHistPsiVZEROA(0), fHistPsiVZEROC(0), fHistPsiTPC(0), fHistRhoVsMult(0), fHistRhoVsCent(0), fHistRhoAVsMult(0), fHistRhoAVsCent(0) {
116 for(Int_t i(0); i < 10; i++) {
117 fProfV2Resolution[i] = 0;
118 fProfV3Resolution[i] = 0;
119 fHistPicoTrackPt[i] = 0;
120 fHistPicoCat1[i] = 0;
121 fHistPicoCat2[i] = 0;
122 fHistPicoCat3[i] = 0;
123 /* fHistClusterPt[i] = 0; */
124 /* fHistClusterPhi[i] = 0; */
125 /* fHistClusterEta[i] = 0; */
126 /* fHistClusterCorrPt[i] = 0; */
127 /* fHistClusterCorrPhi[i] = 0; */
128 /* fHistClusterCorrEta[i] = 0; */
129 fHistRhoPackage[i] = 0;
131 fHistRCPhiEta[i] = 0;
132 fHistRhoVsRCPt[i] = 0;
134 fHistDeltaPtDeltaPhi2[i] = 0;
135 fHistDeltaPtDeltaPhi3[i] = 0;
136 fHistRCPhiEtaExLJ[i] = 0;
137 fHistRhoVsRCPtExLJ[i] = 0;
138 fHistRCPtExLJ[i] = 0;
139 fHistDeltaPtDeltaPhi2ExLJ[i] = 0;
140 fHistDeltaPtDeltaPhi3ExLJ[i] = 0;
141 /* fHistRCPhiEtaRand[i] = 0; */
142 /* fHistRhoVsRCPtRand[i] = 0; */
143 /* fHistRCPtRand[i] = 0; */
144 /* fHistDeltaPtDeltaPhi2Rand[i] = 0; */
145 /* fHistDeltaPtDeltaPhi3Rand[i] = 0; */
146 fHistJetPtRaw[i] = 0;
148 fHistJetEtaPhi[i] = 0;
149 fHistJetPtArea[i] = 0;
150 fHistJetPtConstituents[i] = 0;
151 fHistJetEtaRho[i] = 0;
152 fHistJetPsiTPCPt[i] = 0;
153 fHistJetPsiVZEROAPt[i] = 0;
154 fHistJetPsiVZEROCPt[i] = 0;
155 fHistDeltaPhi2VZEROA[i] = 0;
156 fHistDeltaPhi2VZEROC[i] = 0;
157 fHistDeltaPhi2TPC[i] = 0;
158 fHistDeltaPhi3VZEROA[i] = 0;
159 fHistDeltaPhi3VZEROC[i] = 0;
160 fHistDeltaPhi3TPC[i] = 0;
163 DefineInput(0, TChain::Class());
164 DefineOutput(1, TList::Class());
165 switch (fRunModeType) {
167 gStyle->SetOptFit(1);
168 DefineOutput(2, TList::Class());
169 DefineOutput(3, TList::Class());
171 default: fDebug = -1; // suppress debug info explicitely when not running locally
174 //_____________________________________________________________________________
175 AliAnalysisTaskRhoVnModulation::~AliAnalysisTaskRhoVnModulation()
178 if(fOutputList) delete fOutputList;
179 if(fOutputListGood) delete fOutputListGood;
180 if(fOutputListBad) delete fOutputListBad;
181 if(fFitModulation) delete fFitModulation;
182 if(fHistSwap) delete fHistSwap;
183 if(fCentralityClasses) delete fCentralityClasses;
185 //_____________________________________________________________________________
186 Bool_t AliAnalysisTaskRhoVnModulation::InitializeAnalysis()
188 // initialize the anaysis
189 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
190 if(fRandomConeRadius <= 0) fRandomConeRadius = fJetRadius;
191 if(fLocalJetMinEta > -10 && fLocalJetMaxEta > -10) SetJetEtaLimits(fLocalJetMinEta, fLocalJetMaxEta);
192 if(fLocalJetMinPhi > -10 && fLocalJetMaxPhi > -10) SetJetPhiLimits(fLocalJetMinPhi, fLocalJetMaxPhi);
193 if(fMinDisanceRCtoLJ==0) fMinDisanceRCtoLJ = .5*fJetRadius;
194 if(dynamic_cast<AliAODEvent*>(InputEvent())) fDataType = kAOD; // determine the datatype
195 else if(dynamic_cast<AliESDEvent*>(InputEvent())) fDataType = kESD;
196 fHistAnalysisSummary->SetBinContent(36, (int)fDataType);
197 if(!fRandom) fRandom = new TRandom3(0); // get a randomized if one hasn't been user-supplied
198 switch (fFitModulationType) {
199 case kNoFit : { SetModulationFit(new TF1("fix_kNoFit", "[0]", 0, TMath::TwoPi())); } break;
201 SetModulationFit(new TF1("fit_kV2", "[0]*([1]+[2]*[3]*TMath::Cos([2]*(x-[4])))", 0, TMath::TwoPi()));
202 fFitModulation->SetParameter(0, 0.); // normalization
203 fFitModulation->SetParameter(3, 0.2); // v2
204 fFitModulation->FixParameter(1, 1.); // constant
205 fFitModulation->FixParameter(2, 2.); // constant
208 SetModulationFit(new TF1("fit_kV3", "[0]*([1]+[2]*[3]*TMath::Cos([2]*(x-[4])))", 0, TMath::TwoPi()));
209 fFitModulation->SetParameter(0, 0.); // normalization
210 fFitModulation->SetParameter(3, 0.2); // v3
211 fFitModulation->FixParameter(1, 1.); // constant
212 fFitModulation->FixParameter(2, 3.); // constant
214 default : { // for the combined fit, the 'direct fourier series' or the user supplied vn values we use v2 and v3
215 SetModulationFit(new TF1("fit_kCombined", "[0]*([1]+[2]*([3]*TMath::Cos([2]*(x-[4]))+[7]*TMath::Cos([5]*(x-[6]))))", 0, TMath::TwoPi()));
216 fFitModulation->SetParameter(0, 0.); // normalization
217 fFitModulation->SetParameter(3, 0.2); // v2
218 fFitModulation->FixParameter(1, 1.); // constant
219 fFitModulation->FixParameter(2, 2.); // constant
220 fFitModulation->FixParameter(5, 3.); // constant
221 fFitModulation->SetParameter(7, 0.2); // v3
224 switch (fRunModeType) {
225 case kGrid : { fFitModulationOptions += "N0"; } break;
228 FillAnalysisSummaryHistogram();
231 //_____________________________________________________________________________
232 TH1F* AliAnalysisTaskRhoVnModulation::BookTH1F(const char* name, const char* x, Int_t bins, Double_t min, Double_t max, Int_t c, Bool_t append)
234 // book a TH1F and connect it to the output container
235 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
236 if(!fOutputList) return 0x0;
238 if(c!=-1) { // format centrality dependent histograms accordingly
239 name = Form("%s_%i", name, c);
240 title += Form("_%i-%i", fCentralityClasses->At(c), fCentralityClasses->At(1+c));
242 title += Form(";%s;[counts]", x);
243 TH1F* histogram = new TH1F(name, title.Data(), bins, min, max);
245 if(append) fOutputList->Add(histogram);
248 //_____________________________________________________________________________
249 TH2F* AliAnalysisTaskRhoVnModulation::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)
251 // book a TH2F and connect it to the output container
252 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
253 if(!fOutputList) return 0x0;
255 if(c!=-1) { // format centrality dependent histograms accordingly
256 name = Form("%s_%i", name, c);
257 title += Form("_%i-%i", fCentralityClasses->At(c), fCentralityClasses->At(1+c));
259 title += Form(";%s;%s", x, y);
260 TH2F* histogram = new TH2F(name, title.Data(), binsx, minx, maxx, binsy, miny, maxy);
262 if(append) fOutputList->Add(histogram);
265 //_____________________________________________________________________________
266 void AliAnalysisTaskRhoVnModulation::UserCreateOutputObjects()
268 // create output objects
269 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
270 fOutputList = new TList();
271 fOutputList->SetOwner(kTRUE);
272 if(!fCentralityClasses) { // classes must be defined at this point
273 Int_t c[] = {0, 20, 40, 60, 80, 100};
274 fCentralityClasses = new TArrayI(sizeof(c)/sizeof(c[0]), c);
277 fHistCentrality = BookTH1F("fHistCentrality", "centrality", 102, -2, 100);
278 fHistVertexz = BookTH1F("fHistVertexz", "vertex z (cm)", 100, -12, 12);
280 // pico track kinematics
281 for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i++) {
282 fHistPicoTrackPt[i] = BookTH1F("fHistPicoTrackPt", "p_{t} [GeV/c]", 100, 0, 50, i);
283 if(fFillQAHistograms) {
284 fHistPicoCat1[i] = BookTH2F("fHistPicoCat1", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i);
285 fHistPicoCat2[i] = BookTH2F("fHistPicoCat2", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i);
286 fHistPicoCat3[i] = BookTH2F("fHistPicoCat3", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i);
289 /* fHistClusterPt[i] = BookTH1F("fHistClusterPt", "p_{t} [GeV/c]", 100, 0, 100, i); */
290 /* fHistClusterPhi[i] = BookTH1F("fHistClusterPhi", "#phi", 100, 0, TMath::TwoPi(), i); */
291 /* fHistClusterEta[i] = BookTH1F("fHistClusterEta", "#eta", 100, -5, 5); */
293 // emcal kinematics after hadronic correction
294 /* fHistClusterCorrPt[i] = BookTH1F("fHistClusterCorrPt", "p_{t} [GeV/c]", 100, 0, 100, i); */
295 /* fHistClusterCorrPhi[i] = BookTH1F("fHistClusterCorrPhi", "#phi", 100, 0, TMath::TwoPi(), i); */
296 /* fHistClusterCorrEta[i] = BookTH1F("fHistClusterCorrEta", "#eta", 100, -5, 5, i); */
299 // event plane estimates and quality
300 fHistPsiControl = new TProfile("fHistPsiControl", "fHistPsiControl", 10, 0, 10);
301 fHistPsiControl->Sumw2();
302 fHistPsiSpread = new TProfile("fHistPsiSpread", "fHistPsiSpread", 4, 0, 4);
303 fHistPsiSpread->Sumw2();
304 fHistPsiControl->GetXaxis()->SetBinLabel(1, "<#Psi_{2, VZEROA}>");
305 fHistPsiControl->GetXaxis()->SetBinLabel(2, "<#Psi_{2, VZEROC}>");
306 fHistPsiControl->GetXaxis()->SetBinLabel(3, "<#Psi_{2, TPC}>");
307 fHistPsiControl->GetXaxis()->SetBinLabel(4, "<#Psi_{2, TPC, #eta < 0}>");
308 fHistPsiControl->GetXaxis()->SetBinLabel(5, "<#Psi_{2, TPC, #eta > 0}>");
309 fHistPsiControl->GetXaxis()->SetBinLabel(6, "<#Psi_{3, VZEROA}>");
310 fHistPsiControl->GetXaxis()->SetBinLabel(7, "<#Psi_{3, VZEROC}>");
311 fHistPsiControl->GetXaxis()->SetBinLabel(8, "<#Psi_{3, TPC}>");
312 fHistPsiControl->GetXaxis()->SetBinLabel(9, "<#Psi_{3, TPC, #eta < 0}>");
313 fHistPsiControl->GetXaxis()->SetBinLabel(10, "<#Psi_{3, TPC, #eta > 0}>");
314 fHistPsiSpread->GetXaxis()->SetBinLabel(1, "<#Psi_{2, VZEROA} - #Psi_{2, VZEROC}>");
315 fHistPsiSpread->GetXaxis()->SetBinLabel(2, "<#Psi_{2, VZEROC} - #Psi_{2, TPC}>");
316 fHistPsiSpread->GetXaxis()->SetBinLabel(3, "<#Psi_{2, VZEROC} - #Psi_{2, TPC}>");
317 fHistPsiSpread->GetXaxis()->SetBinLabel(4, "<#Psi_{2, TPC, #eta < 0} - #Psi_{2, TPC, #eta > 0}>");
318 fOutputList->Add(fHistPsiControl);
319 fOutputList->Add(fHistPsiSpread);
320 fHistPsiVZEROA = BookTH1F("fHistPsiVZEROA", "#Psi_{VZEROA}", 100, -.5*TMath::Pi(), .5*TMath::Pi());
321 fHistPsiVZEROC = BookTH1F("fHistPsiVZEROC", "#Psi_{VZEROC}", 100, -.5*TMath::Pi(), .5*TMath::Pi());
322 fHistPsiTPC = BookTH1F("fHistPsiTPC", "#Psi_{TPC}", 100, -.5*TMath::Pi(), .5*TMath::Pi());
324 for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i ++) {
325 fHistRhoPackage[i] = BookTH1F("fHistRhoPackage", "#rho [GeV/c]", 100, 0, 150, i);
326 fHistRho[i] = BookTH1F("fHistRho", "#rho [GeV/c]", 100, 0, 150, i);
328 fHistRhoVsMult = BookTH2F("fHistRhoVsMult", "multiplicity", "#rho [GeV/c]", 100, 0, 4000, 100, 0, 250);
329 fHistRhoVsCent = BookTH2F("fHistRhoVsCent", "centrality", "#rho [GeV/c]", 100, 0, 100, 100, 0, 250);
330 fHistRhoAVsMult = BookTH2F("fHistRhoAVsMult", "multiplicity", "#rho * A (jet) [GeV/c]", 100, 0, 4000, 100, 0, 50);
331 fHistRhoAVsCent = BookTH2F("fHistRhoAVsCent", "centrality", "#rho * A (jet) [GeV/c]", 100, 0, 100, 100, 0, 50);
333 // delta pt distributions
334 for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i ++) {
335 fHistRCPhiEta[i] = BookTH2F("fHistRCPhiEta", "#phi (RC)", "#eta (RC)", 100, 0, TMath::TwoPi(), 100, -1, 1, i);
336 fHistRhoVsRCPt[i] = BookTH2F("fHistRhoVsRCPt", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i);
337 fHistRCPt[i] = BookTH1F("fHistRCPt", "p_{t} (RC) [GeV/c]", 130, -20, 150, i);
338 fHistRCPhiEtaExLJ[i] = BookTH2F("fHistRCPhiEtaExLJ", "#phi (RC)", "#eta (RC)", 100, 0, TMath::TwoPi(), 100, -1, 1, i);
339 fHistDeltaPtDeltaPhi2[i] = BookTH2F("fHistDeltaPtDeltaPhi2", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 50, 0, TMath::Pi(), 100, -50, 100, i);
340 fHistDeltaPtDeltaPhi3[i] = BookTH2F("fHistDeltaPtDeltaPhi3", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 50, 0, TMath::TwoPi()/3., 100, -50, 100, i);
341 fHistRhoVsRCPtExLJ[i] = BookTH2F("fHistRhoVsRCPtExLJ", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i);
342 fHistRCPtExLJ[i] = BookTH1F("fHistRCPtExLJ", "p_{t} (RC) [GeV/c]", 130, -20, 150, i);
343 /* fHistRCPhiEtaRand[i] = BookTH2F("fHistRCPhiEtaRand", "#phi (RC)", "#eta (RC)", 100, 0, TMath::TwoPi(), 100, -1, 1, i); */
344 fHistDeltaPtDeltaPhi2ExLJ[i] = BookTH2F("fHistDeltaPtDeltaPhi2ExLJ", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 50, 0, TMath::Pi(), 100, -50, 100, i);
345 fHistDeltaPtDeltaPhi3ExLJ[i] = BookTH2F("fHistDeltaPtDeltaPhi3ExLJ", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 50, 0, TMath::TwoPi()/3., 100, -50, 100, i);
346 /* fHistRhoVsRCPtRand[i] = BookTH2F("fHistRhoVsRCPtRand", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i); */
347 /* fHistRCPtRand[i] = BookTH1F("fHistRCPtRand", "p_{t} (RC) [GeV/c]", 130, -20, 150, i); */
348 /* fHistDeltaPtDeltaPhi2Rand[i] = BookTH2F("fHistDeltaPtDeltaPhi2Rand", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 50, 0, TMath::Pi(), 100, -50, 100, i); */
349 /* fHistDeltaPtDeltaPhi3Rand[i] = BookTH2F("fHistDeltaPtDeltaPhi3Rand", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 50, 0, TMath::TwoPi()/3., 100, -50, 100, i); */
350 // jet histograms (after kinematic cuts)
351 fHistJetPtRaw[i] = BookTH1F("fHistJetPtRaw", "p_{t} RAW [GeV/c]", 200, -50, 150, i);
352 fHistJetPt[i] = BookTH1F("fHistJetPt", "p_{t} [GeV/c]", 350, -100, 250, i);
353 fHistJetEtaPhi[i] = BookTH2F("fHistJetEtaPhi", "#eta", "#phi", 100, -1, 1, 100, 0, TMath::TwoPi(), i);
354 fHistJetPtArea[i] = BookTH2F("fHistJetPtArea", "p_{t} [GeV/c]", "Area", 175, -100, 250, 30, 0, 0.9, i);
355 fHistJetPtConstituents[i] = BookTH2F("fHistJetPtConstituents", "p_{t} [GeV/c]", "Area", 350, -100, 250, 60, 0, 150, i);
356 fHistJetEtaRho[i] = BookTH2F("fHistJetEtaRho", "#eta", "#rho", 100, -1, 1, 100, 0, 300, i);
357 // in plane and out of plane spectra
358 fHistJetPsiTPCPt[i] = BookTH2F("fHistJetPsiTPCPt", "#phi_{jet} - #Psi_{2, TPC}", "p_{t} [GeV/c]", 50, 0., TMath::Pi(), 700, -100, 250, i);
359 fHistJetPsiVZEROAPt[i] = BookTH2F("fHistJetPsiVZEROAPt", "#phi_{jet} - #Psi_{2, VZEROA}", "p_{t} [GeV/c]", 50, 0., TMath::Pi(), 700, -100, 250, i);
360 fHistJetPsiVZEROCPt[i] = BookTH2F("fHistJetPsiVZEROCPt", "#phi_{jet} - #Psi_{V2, ZEROC}", "p_{t} [GeV/c]", 50, 0., TMath::Pi(), 700, -100, 250, i);
362 fHistDeltaPhi2VZEROA[i] = BookTH1F("fHistDeltaPhi2VZEROA", "#phi_{jet} - #Psi_{2, VZEROA}", 50, 0, TMath::Pi(), i);
363 fHistDeltaPhi2VZEROC[i] = BookTH1F("fHistDeltaPhi2VZEROC", "#phi_{jet} - #Psi_{2, VZEROC}", 50, 0, TMath::Pi(), i);
364 fHistDeltaPhi2TPC[i] = BookTH1F("fHistDeltaPhi2TPC", "#phi_{jet} - #Psi_{2, TPC}", 50, 0, TMath::Pi(), i);
365 fHistDeltaPhi3VZEROA[i] = BookTH1F("fHistDeltaPhi3VZEROA", "#phi_{jet} - #Psi_{2, VZEROA}", 50, 0, TMath::TwoPi()/3., i);
366 fHistDeltaPhi3VZEROC[i] = BookTH1F("fHistDeltaPhi3VZEROC", "#phi_{jet} - #Psi_{2, VZEROC}", 50, 0, TMath::TwoPi()/3., i);
367 fHistDeltaPhi3TPC[i] = BookTH1F("fHistDeltaPhi3TPC", "#phi_{jet} - #Psi_{2, TPC}", 50, 0, TMath::TwoPi()/3., i);
369 fProfV2Resolution[i] = new TProfile(Form("fProfV2Resolution_%i", i), Form("fProfV2Resolution_%i", i), 8, -0.5, 7.5);
370 fProfV2Resolution[i]->GetXaxis()->SetBinLabel(3, "<cos(2(#Psi_{VZEROA} - #Psi_{VZEROC}))>");
371 fProfV2Resolution[i]->GetXaxis()->SetBinLabel(4, "<cos(2(#Psi_{VZEROC} - #Psi_{VZEROA}))>");
372 fProfV2Resolution[i]->GetXaxis()->SetBinLabel(5, "<cos(2(#Psi_{VZEROA} - #Psi_{TPC}))>");
373 fProfV2Resolution[i]->GetXaxis()->SetBinLabel(6, "<cos(2(#Psi_{TPC} - #Psi_{VZEROA}))>");
374 fProfV2Resolution[i]->GetXaxis()->SetBinLabel(7, "<cos(2(#Psi_{VZEROC} - #Psi_{TPC}))>");
375 fProfV2Resolution[i]->GetXaxis()->SetBinLabel(8, "<cos(2(#Psi_{TPC} - #Psi_{VZEROC}))>");
376 fOutputList->Add(fProfV2Resolution[i]);
377 fProfV3Resolution[i] = new TProfile(Form("fProfV3Resolution_%i", i), Form("fProfV3Resolution_%i", i), 8, -0.5, 7.5);
378 fProfV3Resolution[i]->GetXaxis()->SetBinLabel(3, "<cos(3(#Psi_{VZEROA} - #Psi_{VZEROC}))>");
379 fProfV3Resolution[i]->GetXaxis()->SetBinLabel(4, "<cos(3(#Psi_{VZEROC} - #Psi_{VZEROA}))>");
380 fProfV3Resolution[i]->GetXaxis()->SetBinLabel(5, "<cos(3(#Psi_{VZEROA} - #Psi_{TPC}))>");
381 fProfV3Resolution[i]->GetXaxis()->SetBinLabel(6, "<cos(3(#Psi_{TPC} - #Psi_{VZEROA}))>");
382 fProfV3Resolution[i]->GetXaxis()->SetBinLabel(7, "<cos(3(#Psi_{VZEROC} - #Psi_{TPC}))>");
383 fProfV3Resolution[i]->GetXaxis()->SetBinLabel(8, "<cos(3(#Psi_{TPC} - #Psi_{VZEROC}))>");
384 fOutputList->Add(fProfV3Resolution[i]);
386 // cdf and pdf of chisquare distribution
387 fHistPvaluePDF = BookTH1F("fHistPvaluePDF", "PDF #chi^{2}", 500, 0, 1);
388 fHistPvalueCDF = BookTH1F("fHistPvalueCDF", "CDF #chi^{2}", 500, 0, 1);
390 Float_t temp[fCentralityClasses->GetSize()];
391 for(Int_t i(0); i < fCentralityClasses->GetSize(); i++) temp[i] = fCentralityClasses->At(i);
392 fProfV2 = new TProfile("fProfV2", "fProfV2", fCentralityClasses->GetSize()-1, temp);
393 fProfV3 = new TProfile("fProfV3", "fProfV3", fCentralityClasses->GetSize()-1, temp);
394 fOutputList->Add(fProfV2);
395 fOutputList->Add(fProfV3);
397 if(fFillQAHistograms) {
398 fHistRunnumbersEta = new TH2F("fHistRunnumbersEta", "fHistRunnumbersEta", 100, -.5, 99.5, 100, -1.1, 1.1);
399 fHistRunnumbersEta->Sumw2();
400 fOutputList->Add(fHistRunnumbersEta);
401 fHistRunnumbersPhi = new TH2F("fHistRunnumbersPhi", "fHistRunnumbersPhi", 100, -.5, 99.5, 100, -0.2, TMath::TwoPi()+0.2);
402 fHistRunnumbersPhi->Sumw2();
403 fOutputList->Add(fHistRunnumbersPhi);
405 fHistAnalysisSummary = BookTH1F("fHistAnalysisSummary", "flag", 48, -0.5, 48.5);
406 fHistSwap = new TH1F("fHistSwap", "fHistSwap", 20, 0, TMath::TwoPi());
407 if(fUsePtWeight) fHistSwap->Sumw2();
409 if(fUserSuppliedV2) fOutputList->Add(fUserSuppliedV2);
410 if(fUserSuppliedV3) fOutputList->Add(fUserSuppliedV3);
411 if(fUserSuppliedR2) fOutputList->Add(fUserSuppliedR2);
412 if(fUserSuppliedR3) fOutputList->Add(fUserSuppliedR3);
413 // increase readability of output list
415 PostData(1, fOutputList);
417 switch (fRunModeType) {
419 fOutputListGood = new TList();
420 fOutputListGood->SetOwner(kTRUE);
421 fOutputListBad = new TList();
422 fOutputListBad->SetOwner(kTRUE);
423 PostData(2, fOutputListGood);
424 PostData(3, fOutputListBad);
429 //_____________________________________________________________________________
430 Bool_t AliAnalysisTaskRhoVnModulation::Run()
432 // user exec: execute once for each event
433 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
434 if(!fInitialized) fInitialized = InitializeAnalysis();
435 // reject the event if expected data is missing
436 if(!PassesCuts(InputEvent())) return kFALSE;
437 if(!(fTracks||fJets||fRho)) return kFALSE;
438 if(!fCaloClusters && fDebug > 0) printf(" > Warning: couldn't retreive calo clusters! < \n");
439 // [0][0] psi2a [1,0] psi2c
440 // [0][1] psi3a [1,1] psi3c
441 Double_t vzero[2][2];
442 CalculateEventPlaneVZERO(vzero);
445 CalculateEventPlaneTPC(tpc);
446 Double_t psi2(-1), psi3(-1);
447 // arrays which will hold the fit parameters
448 switch (fDetectorType) { // determine the detector type for the rho fit
449 case kTPC : { psi2 = tpc[0]; psi3 = tpc[1]; } break;
450 case kVZEROA : { psi2 = vzero[0][0]; psi3 = vzero[0][1]; } break;
451 case kVZEROC : { psi2 = vzero[1][0]; psi3 = vzero[1][1]; } break;
454 switch (fFitModulationType) { // do the fits
455 case kNoFit : { fFitModulation->FixParameter(0, RhoVal()); } break;
457 if(CorrectRho(psi2, psi3)) {
458 fProfV2->Fill(fCent, fFitModulation->GetParameter(3));
459 if(fUserSuppliedR2) {
460 Double_t r(fUserSuppliedR2->GetBinContent(fUserSuppliedR2->GetXaxis()->FindBin(fCent)));
461 if(r > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)/r);
463 CalculateEventPlaneResolution(vzero, tpc);
467 if(CorrectRho(psi2, psi3)) {
468 if(fUserSuppliedR3) {
469 Double_t r(fUserSuppliedR3->GetBinContent(fUserSuppliedR3->GetXaxis()->FindBin(fCent)));
470 if(r > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)/r);
472 fProfV3->Fill(fCent, fFitModulation->GetParameter(3));
473 CalculateEventPlaneResolution(vzero, tpc);
477 CorrectRho(psi2, psi3);
480 if(CorrectRho(psi2, psi3)) {
481 if(fUserSuppliedR2 && fUserSuppliedR3) {
482 Double_t r2(fUserSuppliedR2->GetBinContent(fUserSuppliedR2->GetXaxis()->FindBin(fCent)));
483 Double_t r3(fUserSuppliedR3->GetBinContent(fUserSuppliedR3->GetXaxis()->FindBin(fCent)));
484 if(r2 > 0) fFitModulation->SetParameter(3, fFitModulation->GetParameter(3)/r2);
485 if(r3 > 0) fFitModulation->SetParameter(7, fFitModulation->GetParameter(3)/r3);
487 fProfV2->Fill(fCent, fFitModulation->GetParameter(3));
488 fProfV3->Fill(fCent, fFitModulation->GetParameter(7));
489 CalculateEventPlaneResolution(vzero, tpc);
493 // fill a number of histograms
494 FillHistogramsAfterSubtraction(vzero, tpc);
495 // send the output to the connected output container
496 PostData(1, fOutputList);
497 switch (fRunModeType) {
499 PostData(2, fOutputListGood);
500 PostData(3, fOutputListBad);
506 //_____________________________________________________________________________
507 void AliAnalysisTaskRhoVnModulation::CalculateEventPlaneVZERO(Double_t vzero[2][2]) const
509 // get the vzero event plane
510 if(fUseV0EventPlaneFromHeader) { // use the vzero from the header
511 Double_t a(0), b(0), c(0), d(0), e(0), f(0), g(0), h(0);
512 vzero[0][0] = InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 8, 2, a, b);
513 vzero[1][0] = InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 9, 2, c, d);
514 vzero[0][1] = InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 8, 3, e, f);
515 vzero[1][1] = InputEvent()->GetEventplane()->CalculateVZEROEventPlane(InputEvent(), 9, 3, g, h);
518 // grab the vzero event plane without recentering
519 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
520 Double_t qxa2(0), qya2(0), qxc2(0), qyc2(0); // for psi2
521 Double_t qxa3(0), qya3(0), qxc3(0), qyc3(0); // for psi3
522 for(Int_t iVZERO(0); iVZERO < 64; iVZERO++) {
523 Double_t phi(TMath::PiOver4()*(.5+iVZERO%8)), /* eta(0), */ weight(InputEvent()->GetVZEROEqMultiplicity(iVZERO));
524 // (iVZERO<32) ? eta = -3.45+.5*(iVZERO/8) : eta = 4.8-.6*((iVZERO/8)-4);
526 qxa2 += weight*TMath::Cos(2.*phi);
527 qya2 += weight*TMath::Sin(2.*phi);
528 qxa3 += weight*TMath::Cos(3.*phi);
529 qya3 += weight*TMath::Sin(3.*phi);
532 qxc2 += weight*TMath::Cos(2.*phi);
533 qyc2 += weight*TMath::Sin(2.*phi);
534 qxc3 += weight*TMath::Cos(3.*phi);
535 qyc3 += weight*TMath::Sin(3.*phi);
538 vzero[0][0] = .5*TMath::ATan2(qya2, qxa2);
539 vzero[1][0] = .5*TMath::ATan2(qyc2, qxc2);
540 vzero[0][1] = (1./3.)*TMath::ATan2(qya3, qxa3);
541 vzero[1][1] = (1./3.)*TMath::ATan2(qyc3, qxc3);
543 //_____________________________________________________________________________
544 void AliAnalysisTaskRhoVnModulation::CalculateEventPlaneTPC(Double_t* tpc)
546 // grab the TPC event plane
547 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
548 fNAcceptedTracks = 0; // reset the track counter
549 Double_t qx2(0), qy2(0); // for psi2
550 Double_t qx3(0), qy3(0); // for psi3
552 Float_t excludeInEta[] = {-999, -999};
553 if(fExcludeLeadingJetsFromFit > 0 ) { // remove the leading jet from ep estimate
554 AliEmcalJet* leadingJet[] = {0x0, 0x0};
555 static Int_t lJets[9999] = {-1};
556 GetSortedArray(lJets, fJets);
557 for(Int_t i(0); i < fJets->GetEntriesFast(); i++) { // get the two leading jets
558 if (1 + i > fJets->GetEntriesFast()) break;
559 leadingJet[0] = static_cast<AliEmcalJet*>(fJets->At(lJets[i]));
560 leadingJet[1] = static_cast<AliEmcalJet*>(fJets->At(lJets[i+1]));
561 if(PassesCuts(leadingJet[0]) && PassesCuts(leadingJet[1])) break;
563 if(leadingJet[0] && leadingJet[1]) {
564 for(Int_t i(0); i < 2; i++) excludeInEta[i] = leadingJet[i]->Eta();
567 Int_t iTracks(fTracks->GetEntriesFast());
568 for(Int_t iTPC(0); iTPC < iTracks; iTPC++) {
569 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(iTPC));
570 if(!PassesCuts(track) || track->Pt() < .15 || track->Pt() > 5.) continue;
571 if(fExcludeLeadingJetsFromFit > 0 &&( (TMath::Abs(track->Eta() - excludeInEta[0]) < fJetRadius*fExcludeLeadingJetsFromFit ) || (TMath::Abs(track->Eta()) - fJetRadius - fJetMaxEta ) > 0 )) continue;
573 qx2+= TMath::Cos(2.*track->Phi());
574 qy2+= TMath::Sin(2.*track->Phi());
575 qx3+= TMath::Cos(3.*track->Phi());
576 qy3+= TMath::Sin(3.*track->Phi());
579 tpc[0] = .5*TMath::ATan2(qy2, qx2);
580 tpc[1] = (1./3.)*TMath::ATan2(qy3, qx3);
582 //_____________________________________________________________________________
583 void AliAnalysisTaskRhoVnModulation::CalculateEventPlaneResolution(Double_t vzero[2][2], Double_t* tpc) const
585 // fill the profiles for the resolution parameters
586 if(fDebug > 1) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
587 fProfV2Resolution[fInCentralitySelection]->Fill(2., TMath::Cos(2.*(vzero[0][0] - vzero[1][0])));
588 fProfV2Resolution[fInCentralitySelection]->Fill(3., TMath::Cos(2.*(vzero[1][0] - vzero[0][0])));
589 fProfV2Resolution[fInCentralitySelection]->Fill(4., TMath::Cos(2.*(vzero[0][0] - tpc[0])));
590 fProfV2Resolution[fInCentralitySelection]->Fill(5., TMath::Cos(2.*(tpc[0] - vzero[0][0])));
591 fProfV2Resolution[fInCentralitySelection]->Fill(6., TMath::Cos(2.*(vzero[1][0] - tpc[0])));
592 fProfV2Resolution[fInCentralitySelection]->Fill(7., TMath::Cos(2.*(tpc[0] - vzero[1][0])));
593 fProfV3Resolution[fInCentralitySelection]->Fill(2., TMath::Cos(3.*(vzero[0][0] - vzero[1][0])));
594 fProfV3Resolution[fInCentralitySelection]->Fill(3., TMath::Cos(3.*(vzero[1][0] - vzero[0][0])));
595 fProfV3Resolution[fInCentralitySelection]->Fill(4., TMath::Cos(3.*(vzero[0][0] - tpc[0])));
596 fProfV3Resolution[fInCentralitySelection]->Fill(5., TMath::Cos(3.*(tpc[0] - vzero[0][0])));
597 fProfV3Resolution[fInCentralitySelection]->Fill(6., TMath::Cos(3.*(vzero[1][0] - tpc[0])));
598 fProfV3Resolution[fInCentralitySelection]->Fill(7., TMath::Cos(3.*(tpc[0] - vzero[1][0])));
600 //_____________________________________________________________________________
601 void AliAnalysisTaskRhoVnModulation::CalculateRandomCone(Float_t &pt, Float_t &eta, Float_t &phi,
602 AliEmcalJet* jet, Bool_t randomize) const
605 if(fDebug > 1) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
606 pt = 0; eta = 0; phi = 0;
607 Float_t etaJet(999), phiJet(999), dJet(999); // no jet: same as jet very far away
608 if(jet) { // if a leading jet is given, use its kinematic properties
612 // force the random cones to at least be within detector acceptance
613 Float_t minPhi(fJetMinPhi), maxPhi(fJetMaxPhi);
614 if(maxPhi > TMath::TwoPi()) maxPhi = TMath::TwoPi();
615 if(minPhi < 0 ) minPhi = 0;
616 Float_t diffRcRJR(TMath::Abs(fRandomConeRadius-fJetRadius));
617 // construct a random cone and see if it's far away enough from the leading jet
618 Int_t attempts(1000);
621 eta = gRandom->Uniform(fJetMinEta+diffRcRJR, fJetMaxEta-diffRcRJR);
622 phi = gRandom->Uniform(minPhi, maxPhi);
624 dJet = TMath::Sqrt((etaJet-eta)*(etaJet-eta)+(phiJet-phi)*(phiJet-phi));
625 if(dJet > fMinDisanceRCtoLJ) break;
626 else if (attempts == 0) {
627 printf(" > No random cone after 1000 tries, giving up ... !\n");
632 Int_t iTracks(fTracks->GetEntriesFast());
633 for(Int_t i(0); i < iTracks; i++) {
634 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
635 if(!PassesCuts(track)) continue;
636 Float_t etaTrack(track->Eta()), phiTrack(track->Phi()), ptTrack(track->Pt());
637 // if requested, randomize eta and phi to destroy any correlated fluctuations
639 etaTrack = gRandom->Uniform(fTrackMinEta, fTrackMaxEta);
640 phiTrack = gRandom->Uniform(minPhi, maxPhi);
642 // get distance from cone
643 if(TMath::Abs(phiTrack-phi) > TMath::Abs(phiTrack - phi + TMath::TwoPi())) phiTrack+=TMath::TwoPi();
644 if(TMath::Abs(phiTrack-phi) > TMath::Abs(phiTrack - phi - TMath::TwoPi())) phiTrack-=TMath::TwoPi();
645 if(TMath::Sqrt(TMath::Abs((etaTrack-eta)*(etaTrack-eta)+(phiTrack-phi)*(phiTrack-phi))) <= fRandomConeRadius) pt+=ptTrack;
649 //_____________________________________________________________________________
650 Bool_t AliAnalysisTaskRhoVnModulation::CorrectRho(Double_t psi2, Double_t psi3)
652 // get rho' -> rho(phi)
653 // two routines are available
654 // [1] fitting a fourier expansion to the de/dphi distribution
655 // [2] getting vn from a fourier series around dn/dphi (see below for info)
656 // this function will return kTRUE if the fit passes a set of quality criteria
657 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
658 TString detector("");
659 switch (fDetectorType) {
660 case kTPC : detector+="TPC";
662 case kVZEROA : detector+="VZEROA";
664 case kVZEROC : detector+="VZEROC";
668 Int_t iTracks(fTracks->GetEntriesFast());
669 Double_t excludeInEta[] = {-999, -999};
670 Double_t excludeInPhi[] = {-999, -999};
671 Double_t excludeInPt[] = {-999, -999};
672 if(iTracks <= 0 || RhoVal() <= 0 ) return kFALSE; // no use fitting an empty event ...
673 if(fExcludeLeadingJetsFromFit > 0 ) {
674 AliEmcalJet* leadingJet[] = {0x0, 0x0};
675 static Int_t lJets[9999] = {-1};
676 GetSortedArray(lJets, fJets);
677 for(Int_t i(0); i < fJets->GetEntriesFast(); i++) { // get the two leading jets
678 if (1 + i > fJets->GetEntriesFast()) break;
679 leadingJet[0] = static_cast<AliEmcalJet*>(fJets->At(lJets[i]));
680 leadingJet[1] = static_cast<AliEmcalJet*>(fJets->At(lJets[i+1]));
681 if(PassesCuts(leadingJet[0]) && PassesCuts(leadingJet[1])) break;
683 if(leadingJet[0] && leadingJet[1]) {
684 for(Int_t i(0); i < 2; i++) {
685 excludeInEta[i] = leadingJet[i]->Eta();
686 excludeInPhi[i] = leadingJet[i]->Phi();
687 excludeInPt[i] = leadingJet[i]->Pt();
691 fHistSwap->Reset(); // clear the histogram
693 if(fRebinSwapHistoOnTheFly) {
694 if(fNAcceptedTracks < 49) fNAcceptedTracks = 49; // avoid aliasing effects
695 _tempSwap = TH1F("_tempSwap", "_tempSwap", TMath::CeilNint(TMath::Sqrt(fNAcceptedTracks)), 0, TMath::TwoPi());
697 else _tempSwap = *fHistSwap; // now _tempSwap holds the desired histo
698 for(Int_t i(0); i < iTracks; i++) {
699 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
700 if(fExcludeLeadingJetsFromFit > 0 &&( (TMath::Abs(track->Eta() - excludeInEta[0]) < fJetRadius*fExcludeLeadingJetsFromFit ) || (TMath::Abs(track->Eta()) - fJetRadius - fJetMaxEta ) > 0 )) continue;
701 if(!PassesCuts(track) || track->Pt() > 5 || track->Pt() < 0.15) continue;
702 if(fUsePtWeight) _tempSwap.Fill(track->Phi(), track->Pt());
703 else _tempSwap.Fill(track->Phi());
705 // for(Int_t i(0); i < _tempSwap.GetXaxis()->GetNbins(); i++) _tempSwap.SetBinError(1+i, TMath::Sqrt(_tempSwap.GetBinContent(1+i)));
706 fFitModulation->SetParameter(0, RhoVal());
707 switch (fFitModulationType) {
708 case kNoFit : { fFitModulation->FixParameter(0, RhoVal() );
711 fFitModulation->FixParameter(4, psi2);
714 fFitModulation->FixParameter(4, psi3);
717 fFitModulation->FixParameter(4, psi2);
718 fFitModulation->FixParameter(6, psi3);
720 case kFourierSeries : {
721 // in this approach, an explicit calculation will be made of vn = sqrt(xn^2+yn^2)
722 // where x[y] = Integrate[r(phi)cos[sin](n phi)dphi, 0, 2pi]
723 Double_t cos2(0), sin2(0), cos3(0), sin3(0), sumPt(0);
724 for(Int_t i(0); i < iTracks; i++) {
725 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
726 if(!PassesCuts(track) || track->Pt() > 5 || track->Pt() < 0.15) continue;
727 sumPt += track->Pt();
728 cos2 += track->Pt()*TMath::Cos(2*PhaseShift(track->Phi()-psi2));
729 sin2 += track->Pt()*TMath::Sin(2*PhaseShift(track->Phi()-psi2));
730 cos3 += track->Pt()*TMath::Cos(3*PhaseShift(track->Phi()-psi3));
731 sin3 += track->Pt()*TMath::Sin(3*PhaseShift(track->Phi()-psi3));
733 fFitModulation->SetParameter(3, TMath::Sqrt(cos2*cos2+sin2*sin2)/RhoVal());
734 fFitModulation->SetParameter(4, psi2);
735 fFitModulation->SetParameter(6, psi3);
736 fFitModulation->SetParameter(7, TMath::Sqrt(cos3*cos3+sin3*sin3)/RhoVal());
738 case kIntegratedFlow : {
739 // use v2 and v3 values from an earlier iteration over the data
740 fFitModulation->FixParameter(3, fUserSuppliedV2->GetBinContent(fUserSuppliedV2->GetXaxis()->FindBin(fCent)));
741 fFitModulation->FixParameter(4, psi2);
742 fFitModulation->FixParameter(6, psi3);
743 fFitModulation->FixParameter(7, fUserSuppliedV3->GetBinContent(fUserSuppliedV3->GetXaxis()->FindBin(fCent)));
744 return kTRUE; // no fit is performed
748 _tempSwap.Fit(fFitModulation, fFitModulationOptions.Data(), "", 0, TMath::TwoPi());
749 // the quality of the fit is evaluated from 1 - the cdf of the chi square distribution
750 Double_t CDF(1.-ChiSquareCDF(fFitModulation->GetNDF(), fFitModulation->GetChisquare()));
751 // Double_t PDF(ChiSquarePDF(fFitModulation->GetNDF(), fFitModulation->GetChisquare()));
752 fHistPvalueCDF->Fill(CDF);
753 // fHistPvaluePDF->Fill(PDF);
754 if(CDF > fMinPvalue && CDF < fMaxPvalue && ( fAbsVnHarmonics && fFitModulation->GetMinimum(0, TMath::TwoPi()) > 0)) { // fit quality
755 // for LOCAL didactic purposes, save the best and the worst fits
756 // this routine can produce a lot of output histograms (it's not memory 'safe') and will not work on GRID
757 // since the output will become unmergeable (i.e. different nodes may produce conflicting output)
758 switch (fRunModeType) {
760 if(fRandom->Uniform(0, 100) > fPercentageOfFits) break;
761 static Int_t didacticCounterBest(0);
762 TProfile* didacticProfile = (TProfile*)_tempSwap.Clone(Form("Fit_%i_1-CDF_%.3f_cen_%i_%s", didacticCounterBest, CDF, fInCentralitySelection, detector.Data()));
763 TF1* didactifFit = (TF1*)fFitModulation->Clone(Form("fit_%i_CDF_%.3f_cen_%i_%s", didacticCounterBest, CDF, fInCentralitySelection, detector.Data()));
764 didacticProfile->GetListOfFunctions()->Add(didactifFit);
765 fOutputListGood->Add(didacticProfile);
766 didacticCounterBest++;
767 TH2F* didacticSurface = BookTH2F(Form("surface_%s", didacticProfile->GetName()), "#phi", "#eta", 50, 0, TMath::TwoPi(), 50, -1, 1, -1, kFALSE);
768 for(Int_t i(0); i < iTracks; i++) {
769 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
770 if(PassesCuts(track)) {
771 if(fUsePtWeight) didacticSurface->Fill(track->Phi(), track->Eta(), track->Pt());
772 else didacticSurface->Fill(track->Phi(), track->Eta());
775 if(fExcludeLeadingJetsFromFit) { // visualize the excluded region
776 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);
777 f2->SetParameters(excludeInPt[0]/3.,excludeInPhi[0],.1,excludeInEta[0],.1);
778 didacticSurface->GetListOfFunctions()->Add(f2);
779 TF2 *f3 = new TF2(Form("%s_NLJ", didacticSurface->GetName()),"[0]*TMath::Gaus(x,[1],[2])*TMath::Gaus(y,[3],[4])", 0, TMath::TwoPi(), -1, 1);
780 f3->SetParameters(excludeInPt[1]/3.,excludeInPhi[1],.1,excludeInEta[1],.1);
781 f3->SetLineColor(kGreen);
782 didacticSurface->GetListOfFunctions()->Add(f3);
784 fOutputListGood->Add(didacticSurface);
788 } else { // if the fit is of poor quality revert to the original rho estimate
789 switch (fRunModeType) { // again see if we want to save the fit
791 static Int_t didacticCounterWorst(0);
792 if(fRandom->Uniform(0, 100) > fPercentageOfFits) break;
793 TProfile* didacticProfile = (TProfile*)_tempSwap.Clone(Form("Fit_%i_1-CDF_%.3f_cen_%i_%s", didacticCounterWorst, CDF, fInCentralitySelection, detector.Data() ));
794 TF1* didactifFit = (TF1*)fFitModulation->Clone(Form("fit_%i_p_%.3f_cen_%i_%s", didacticCounterWorst, CDF, fInCentralitySelection, detector.Data()));
795 didacticProfile->GetListOfFunctions()->Add(didactifFit);
796 fOutputListBad->Add(didacticProfile);
797 didacticCounterWorst++;
801 switch (fFitModulationType) {
802 case kNoFit : break; // nothing to do
803 case kUser : break; // FIXME not implemented yet
804 case kCombined : fFitModulation->SetParameter(7, 0); // no break
805 case kFourierSeries : fFitModulation->SetParameter(7, 0); // no break
806 default : { // needs to be done if there was a poor fit
807 fFitModulation->SetParameter(3, 0);
808 fFitModulation->SetParameter(0, RhoVal());
811 return kFALSE; // return false if the fit is rejected
815 //_____________________________________________________________________________
816 Bool_t AliAnalysisTaskRhoVnModulation::PassesCuts(AliVEvent* event)
819 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
820 if(!event) return kFALSE;
821 if(TMath::Abs(InputEvent()->GetPrimaryVertex()->GetZ()) > 10.) return kFALSE;
822 // aod and esd specific checks
825 AliESDEvent* esdEvent = static_cast<AliESDEvent*>(InputEvent());
826 if( (!esdEvent) || (TMath::Abs(esdEvent->GetPrimaryVertexSPD()->GetZ() - esdEvent->GetPrimaryVertex()->GetZ()) > .5) ) return kFALSE;
829 AliAODEvent* aodEvent = static_cast<AliAODEvent*>(InputEvent());
830 if( (!aodEvent) || (TMath::Abs(aodEvent->GetPrimaryVertexSPD()->GetZ() - aodEvent->GetPrimaryVertex()->GetZ()) > .5) ) return kFALSE;
834 fCent = InputEvent()->GetCentrality()->GetCentralityPercentile("V0M");
835 if(fCent <= fCentralityClasses->At(0) || fCent >= fCentralityClasses->At(fCentralityClasses->GetSize()-1) || TMath::Abs(fCent-InputEvent()->GetCentrality()->GetCentralityPercentile("TRK")) > 5.) return kFALSE;
836 // determine centrality class
837 for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i++) {
838 if(fCent >= fCentralityClasses->At(i) && fCent <= fCentralityClasses->At(1+i)) {
839 fInCentralitySelection = i;
842 if(fExplicitOutlierCut == 2010 || fExplicitOutlierCut == 2011) {
843 if(!PassesCuts(fExplicitOutlierCut)) return kFALSE;
845 if(fFillQAHistograms) FillQAHistograms(event);
848 //_____________________________________________________________________________
849 Bool_t AliAnalysisTaskRhoVnModulation::PassesCuts(Int_t year)
851 // additional centrality cut based on relation between tpc and global multiplicity
852 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
853 AliAODEvent* event(dynamic_cast<AliAODEvent*>(InputEvent()));
854 if(!event) return kFALSE;
855 Int_t multTPC(0), multGlob(0), nTracks(InputEvent()->GetNumberOfTracks());
856 for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) {
857 AliAODTrack* track = event->GetTrack(iTracks);
859 if (!track || track->Pt() < .2 || track->Pt() > 5.0 || TMath::Abs(track->Eta()) > .8 || track->GetTPCNcls() < 70 || !track->GetDetPid() || track->GetDetPid()->GetTPCsignal() < 10.0) continue; // general quality cut
860 if (track->TestFilterBit(1) && track->Chi2perNDF() > 0.2) multTPC++;
861 if (!track->TestFilterBit(16) || track->Chi2perNDF() < 0.1) continue;
862 Double_t b[2] = {-99., -99.};
863 Double_t bCov[3] = {-99., -99., -99.};
864 if (track->PropagateToDCA(event->GetPrimaryVertex(), event->GetMagneticField(), 100., b, bCov) && TMath::Abs(b[0]) < 0.3 && TMath::Abs(b[1]) < 0.3) multGlob++;
866 if(year == 2010 && multTPC > (-40.3+1.22*multGlob) && multTPC < (32.1+1.59*multGlob)) return kTRUE;
867 if(year == 2011 && multTPC > (-36.73 + 1.48*multGlob) && multTPC < (62.87 + 1.78*multGlob)) return kTRUE;
870 //_____________________________________________________________________________
871 Bool_t AliAnalysisTaskRhoVnModulation::PassesCuts(const AliVCluster* cluster) const
874 if(fDebug > 1) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
875 if(!cluster) return kFALSE;
878 //_____________________________________________________________________________
879 void AliAnalysisTaskRhoVnModulation::FillHistogramsAfterSubtraction(Double_t vzero[2][2], Double_t* tpc) const
882 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
883 FillTrackHistograms();
884 /* FillClusterHistograms(); */
885 FillJetHistograms(vzero, tpc);
886 /* FillCorrectedClusterHistograms(); */
887 FillEventPlaneHistograms(vzero, tpc);
889 switch (fDetectorType) { // determine the detector type for the rho fit
890 case kTPC : { FillDeltaPtHistograms(tpc[0], tpc[1]); } break;
891 case kVZEROA : { FillDeltaPtHistograms(vzero[0][0], vzero[0][1]); } break;
892 case kVZEROC : { FillDeltaPtHistograms(vzero[1][0], vzero[1][1]); } break;
895 FillDeltaPhiHistograms(vzero, tpc);
897 //_____________________________________________________________________________
898 void AliAnalysisTaskRhoVnModulation::FillTrackHistograms() const
900 // fill track histograms
901 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
902 Int_t iTracks(fTracks->GetEntriesFast());
903 for(Int_t i(0); i < iTracks; i++) {
904 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
905 if(!PassesCuts(track)) continue;
906 fHistPicoTrackPt[fInCentralitySelection]->Fill(track->Pt());
907 if(fFillQAHistograms) FillQAHistograms(track);
910 //_____________________________________________________________________________
911 void AliAnalysisTaskRhoVnModulation::FillClusterHistograms() const
913 // fill cluster histograms
914 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
915 /* Int_t iClusters(fCaloClusters->GetEntriesFast());
916 for(Int_t i(0); i < iClusters; i++) {
917 AliVCluster* cluster = static_cast<AliVCluster*>(fCaloClusters->At(iClusters));
918 if (!PassesCuts(cluster)) continue;
919 TLorentzVector clusterLorentzVector;
920 cluster->GetMomentum(clusterLorentzVector, const_cast<Double_t*>(fVertex));
921 fHistClusterPt[fInCentralitySelection]->Fill(clusterLorentzVector.Pt());
922 fHistClusterEta[fInCentralitySelection]->Fill(clusterLorentzVector.Eta());
923 fHistClusterPhi[fInCentralitySelection]->Fill(clusterLorentzVector.Phi());
927 //_____________________________________________________________________________
928 void AliAnalysisTaskRhoVnModulation::FillCorrectedClusterHistograms() const
930 // fill clusters after hadronic correction FIXME implement
931 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
933 //_____________________________________________________________________________
934 void AliAnalysisTaskRhoVnModulation::FillEventPlaneHistograms(Double_t vzero[2][2], Double_t* tpc) const
936 // fill event plane histograms
937 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
938 fHistPsiControl->Fill(0.5, vzero[0][0]); // vzero a psi2
939 fHistPsiControl->Fill(1.5, vzero[1][0]); // vzero c psi2
940 fHistPsiControl->Fill(2.5, tpc[0]); // tpc psi 2
941 fHistPsiControl->Fill(5.5, vzero[0][1]); // vzero a psi3
942 fHistPsiControl->Fill(6.5, vzero[1][1]); // vzero b psi3
943 fHistPsiControl->Fill(7.5, tpc[1]); // tpc psi 3
944 fHistPsiVZEROA->Fill(vzero[0][0]);
945 fHistPsiVZEROC->Fill(vzero[1][0]);
946 fHistPsiTPC->Fill(tpc[0]);
947 fHistPsiSpread->Fill(0.5, TMath::Abs(vzero[0][0]-vzero[1][0]));
948 fHistPsiSpread->Fill(1.5, TMath::Abs(vzero[0][0]-tpc[0]));
949 fHistPsiSpread->Fill(2.5, TMath::Abs(vzero[1][0]-tpc[0]));
951 //_____________________________________________________________________________
952 void AliAnalysisTaskRhoVnModulation::FillRhoHistograms() const
954 // fill rho histograms
955 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
956 fHistRhoPackage[fInCentralitySelection]->Fill(RhoVal()); // save the rho estimate from the emcal jet package
957 // get multiplicity FIXME inefficient
958 Int_t iTracks(fTracks->GetEntriesFast()), mult(0), iJets(fJets->GetEntriesFast());
959 for(Int_t i(0); i < iTracks; i ++) { if(PassesCuts(static_cast<AliVTrack*>(fTracks->At(i)))) mult++; }
960 Double_t rho(RhoVal(TMath::Pi(), TMath::Pi(), fRho->GetVal()));
961 fHistRho[fInCentralitySelection]->Fill(rho);
962 fHistRhoVsMult->Fill(mult, rho);
963 fHistRhoVsCent->Fill(fCent, rho);
964 for(Int_t i(0); i < iJets; i++) {
965 AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(i));
966 if(!PassesCuts(jet)) continue;
967 fHistRhoAVsMult->Fill(mult, rho * jet->Area());
968 fHistRhoAVsCent->Fill(fCent, rho * jet->Area());
971 //_____________________________________________________________________________
972 void AliAnalysisTaskRhoVnModulation::FillDeltaPtHistograms(Double_t psi2, Double_t psi3) const
974 // fill delta pt histograms
975 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
976 Int_t i(0), maxCones(20);
977 AliEmcalJet* leadingJet(0x0);
978 static Int_t sJets[9999] = {-1};
979 GetSortedArray(sJets, fJets);
980 do { // get the leading jet
981 leadingJet = static_cast<AliEmcalJet*>(fJets->At(sJets[i]));
984 while (!PassesCuts(leadingJet)&&i<fJets->GetEntriesFast());
985 if(!leadingJet && fDebug > 0) printf(" > failed to retrieve leading jet ! < \n");
986 const Float_t areaRC = fRandomConeRadius*fRandomConeRadius*TMath::Pi();
987 // we're retrieved the leading jet, now get a random cone
988 for(i = 0; i < maxCones; i++) {
989 Float_t pt(0), eta(0), phi(0);
990 // get a random cone without constraints on leading jet position
991 CalculateRandomCone(pt, eta, phi, 0x0);
993 fHistRCPhiEta[fInCentralitySelection]->Fill(phi, eta);
994 fHistRhoVsRCPt[fInCentralitySelection]->Fill(pt, RhoVal(phi, fJetRadius, fRho->GetVal())*areaRC);
995 fHistRCPt[fInCentralitySelection]->Fill(pt);
996 fHistDeltaPtDeltaPhi2[fInCentralitySelection]->Fill(PhaseShift(phi-psi2, 2.), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal()));
997 fHistDeltaPtDeltaPhi3[fInCentralitySelection]->Fill(PhaseShift(phi-psi3, 3.), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal()));
999 // get a random cone excluding leading jet area
1000 CalculateRandomCone(pt, eta, phi, leadingJet);
1002 fHistRCPhiEtaExLJ[fInCentralitySelection]->Fill(phi, eta);
1003 fHistRhoVsRCPtExLJ[fInCentralitySelection]->Fill(pt, RhoVal(phi, fJetRadius, fRho->GetVal())*areaRC);
1004 fHistRCPtExLJ[fInCentralitySelection]->Fill(pt);
1005 fHistDeltaPtDeltaPhi2ExLJ[fInCentralitySelection]->Fill(PhaseShift(phi-psi2, 2.), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal()));
1006 fHistDeltaPtDeltaPhi3ExLJ[fInCentralitySelection]->Fill(PhaseShift(phi-psi3, 3.), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal()));
1008 // get a random cone in an event with randomized phi and eta
1009 /* CalculateRandomCone(pt, eta, phi, 0x0, kTRUE);
1011 fHistRCPhiEtaRand[fInCentralitySelection]->Fill(phi, eta);
1012 fHistRhoVsRCPtRand[fInCentralitySelection]->Fill(pt, RhoVal(phi, fJetRadius, fRho->GetVal())*areaRC);
1013 fHistRCPtRand[fInCentralitySelection]->Fill(pt);
1014 fHistDeltaPtDeltaPhi2Rand[fInCentralitySelection]->Fill(PhaseShift(phi-psi2, 2.), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal()));
1015 fHistDeltaPtDeltaPhi3Rand[fInCentralitySelection]->Fill(PhaseShift(phi-psi3, 3.), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal()));
1019 //_____________________________________________________________________________
1020 void AliAnalysisTaskRhoVnModulation::FillJetHistograms(Double_t vzero[2][2], Double_t* tpc) const
1022 // fill jet histograms
1023 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1024 Int_t iJets(fJets->GetEntriesFast());
1025 for(Int_t i(0); i < iJets; i++) {
1026 AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(i));
1027 if(PassesCuts(jet)) {
1028 Double_t pt(jet->Pt()), area(jet->Area()), eta(jet->Eta()), phi(jet->Phi());
1029 Double_t rho(RhoVal(phi, fJetRadius, fRho->GetVal()));
1030 fHistJetPtRaw[fInCentralitySelection]->Fill(pt);
1031 fHistJetPt[fInCentralitySelection]->Fill(pt-area*rho);
1032 fHistJetEtaPhi[fInCentralitySelection]->Fill(eta, phi);
1033 fHistJetPtArea[fInCentralitySelection]->Fill(pt-area*rho, area);
1034 fHistJetPsiTPCPt[fInCentralitySelection]->Fill(PhaseShift(phi-tpc[0], 2.), pt-area*rho);
1035 fHistJetPsiVZEROAPt[fInCentralitySelection]->Fill(PhaseShift(phi-vzero[0][0], 2.), pt-area*rho);
1036 fHistJetPsiVZEROCPt[fInCentralitySelection]->Fill(PhaseShift(phi-vzero[1][0], 2.), pt-area*rho);
1037 fHistJetPtConstituents[fInCentralitySelection]->Fill(pt-area*rho, jet->Nch());
1038 fHistJetEtaRho[fInCentralitySelection]->Fill(eta, pt/area);
1039 if(fSetPtSub) jet->SetPtSub(pt-area*rho);
1041 else { // if the jet is rejected, excluded it for the flow analysis
1042 if(fSetPtSub) jet->SetPtSub(-999.);
1046 //_____________________________________________________________________________
1047 void AliAnalysisTaskRhoVnModulation::FillDeltaPhiHistograms(Double_t vzero[2][2], Double_t* tpc) const
1049 // fill phi minus psi histograms
1050 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1052 Int_t iTracks(fTracks->GetEntriesFast());
1053 for(Int_t iTPC(0); iTPC < iTracks; iTPC++) {
1054 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(iTPC));
1055 if(!PassesCuts(track)) continue;
1056 fHistDeltaPhi2VZEROA[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-vzero[0][0], 2.));
1057 fHistDeltaPhi2VZEROC[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-vzero[1][0], 2.));
1058 fHistDeltaPhi2TPC[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-tpc[0], 2.));
1059 fHistDeltaPhi3VZEROA[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-vzero[0][1], 3.));
1060 fHistDeltaPhi3VZEROC[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-vzero[1][1], 3.));
1061 fHistDeltaPhi3TPC[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-tpc[1], 3.));
1065 //_____________________________________________________________________________
1066 void AliAnalysisTaskRhoVnModulation::FillQAHistograms(AliVTrack* vtrack) const
1068 // fill qa histograms for pico tracks
1070 AliPicoTrack* track = static_cast<AliPicoTrack*>(vtrack);
1071 fHistRunnumbersPhi->Fill(fMappedRunNumber, track->Phi());
1072 fHistRunnumbersEta->Fill(fMappedRunNumber, track->Eta());
1073 Int_t type((int)(track->GetTrackType()));
1076 fHistPicoCat1[fInCentralitySelection]->Fill(track->Eta(), track->Phi());
1079 fHistPicoCat2[fInCentralitySelection]->Fill(track->Eta(), track->Phi());
1082 fHistPicoCat3[fInCentralitySelection]->Fill(track->Eta(), track->Phi());
1087 //_____________________________________________________________________________
1088 void AliAnalysisTaskRhoVnModulation::FillQAHistograms(AliVEvent* vevent)
1090 // fill qa histograms for events
1092 fHistVertexz->Fill(vevent->GetPrimaryVertex()->GetZ());
1093 fHistCentrality->Fill(fCent);
1094 Int_t runNumber(InputEvent()->GetRunNumber());
1095 Int_t runs[] = {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, 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};
1096 for(fMappedRunNumber = 0; fMappedRunNumber < 64; fMappedRunNumber++) {
1097 if(runs[fMappedRunNumber]==runNumber) break;
1100 //_____________________________________________________________________________
1101 void AliAnalysisTaskRhoVnModulation::FillAnalysisSummaryHistogram() const
1103 // fill the analysis summary histrogram, saves all relevant analysis settigns
1104 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1105 fHistAnalysisSummary->GetXaxis()->SetBinLabel(1, "fJetRadius");
1106 fHistAnalysisSummary->SetBinContent(1, fJetRadius);
1107 fHistAnalysisSummary->GetXaxis()->SetBinLabel(2, "fPtBiasJetTrack");
1108 fHistAnalysisSummary->SetBinContent(2, fPtBiasJetTrack);
1109 fHistAnalysisSummary->GetXaxis()->SetBinLabel(3, "fPtBiasJetClus");
1110 fHistAnalysisSummary->SetBinContent(3, fPtBiasJetClus);
1111 fHistAnalysisSummary->GetXaxis()->SetBinLabel(4, "fJetPtCut");
1112 fHistAnalysisSummary->SetBinContent(4, fJetPtCut);
1113 fHistAnalysisSummary->GetXaxis()->SetBinLabel(5, "fJetAreaCut");
1114 fHistAnalysisSummary->SetBinContent(5, fJetAreaCut);
1115 fHistAnalysisSummary->GetXaxis()->SetBinLabel(6, "fPercAreaCut");
1116 fHistAnalysisSummary->SetBinContent(6, fPercAreaCut);
1117 fHistAnalysisSummary->GetXaxis()->SetBinLabel(7, "fAreaEmcCut");
1118 fHistAnalysisSummary->SetBinContent(7, fAreaEmcCut);
1119 fHistAnalysisSummary->GetXaxis()->SetBinLabel(8, "fJetMinEta");
1120 fHistAnalysisSummary->SetBinContent(8, fJetMinEta);
1121 fHistAnalysisSummary->GetXaxis()->SetBinLabel(9, "fJetMaxEta");
1122 fHistAnalysisSummary->SetBinContent(9, fJetMaxEta);
1123 fHistAnalysisSummary->GetXaxis()->SetBinLabel(10, "fJetMinPhi");
1124 fHistAnalysisSummary->SetBinContent(10, fJetMinPhi);
1125 fHistAnalysisSummary->GetXaxis()->SetBinLabel(11, "fJetMaxPhi");
1126 fHistAnalysisSummary->SetBinContent(11, fJetMaxPhi);
1127 fHistAnalysisSummary->GetXaxis()->SetBinLabel(12, "fMaxClusterPt");
1128 fHistAnalysisSummary->SetBinContent(12, fMaxClusterPt);
1129 fHistAnalysisSummary->GetXaxis()->SetBinLabel(13, "fMaxTrackPt");
1130 fHistAnalysisSummary->SetBinContent(13, fMaxTrackPt);
1131 fHistAnalysisSummary->GetXaxis()->SetBinLabel(14, "fLeadingHadronType");
1132 fHistAnalysisSummary->SetBinContent(14, fLeadingHadronType);
1133 fHistAnalysisSummary->GetXaxis()->SetBinLabel(15, "fAnaType");
1134 fHistAnalysisSummary->SetBinContent(15, fAnaType);
1135 fHistAnalysisSummary->GetXaxis()->SetBinLabel(16, "fForceBeamType");
1136 fHistAnalysisSummary->SetBinContent(16, fForceBeamType);
1137 fHistAnalysisSummary->GetXaxis()->SetBinLabel(17, "fMinCent");
1138 fHistAnalysisSummary->SetBinContent(17, fMinCent);
1139 fHistAnalysisSummary->GetXaxis()->SetBinLabel(18, "fMaxCent");
1140 fHistAnalysisSummary->SetBinContent(18, fMaxCent);
1141 fHistAnalysisSummary->GetXaxis()->SetBinLabel(19, "fMinVz");
1142 fHistAnalysisSummary->SetBinContent(19, fMinVz);
1143 fHistAnalysisSummary->GetXaxis()->SetBinLabel(20, "fMaxVz");
1144 fHistAnalysisSummary->SetBinContent(20, fMaxVz);
1145 fHistAnalysisSummary->GetXaxis()->SetBinLabel(21, "fOffTrigger");
1146 fHistAnalysisSummary->SetBinContent(21, fOffTrigger);
1147 fHistAnalysisSummary->GetXaxis()->SetBinLabel(22, "fClusPtCut");
1148 fHistAnalysisSummary->SetBinContent(22, fClusPtCut);
1149 fHistAnalysisSummary->GetXaxis()->SetBinLabel(23, "fTrackPtCut");
1150 fHistAnalysisSummary->SetBinContent(23, fTrackPtCut);
1151 fHistAnalysisSummary->GetXaxis()->SetBinLabel(24, "fTrackMinEta");
1152 fHistAnalysisSummary->SetBinContent(24, fTrackMinEta);
1153 fHistAnalysisSummary->GetXaxis()->SetBinLabel(25, "fTrackMaxEta");
1154 fHistAnalysisSummary->SetBinContent(25, fTrackMaxEta);
1155 fHistAnalysisSummary->GetXaxis()->SetBinLabel(26, "fTrackMinPhi");
1156 fHistAnalysisSummary->SetBinContent(26, fTrackMinPhi);
1157 fHistAnalysisSummary->GetXaxis()->SetBinLabel(27, "fTrackMaxPhi");
1158 fHistAnalysisSummary->SetBinContent(27, fTrackMaxPhi);
1159 fHistAnalysisSummary->GetXaxis()->SetBinLabel(28, "fClusTimeCutLow");
1160 fHistAnalysisSummary->SetBinContent(28, fClusTimeCutLow);
1161 fHistAnalysisSummary->GetXaxis()->SetBinLabel(29, "fClusTimeCutUp");
1162 fHistAnalysisSummary->SetBinContent(29, fClusTimeCutUp);
1163 fHistAnalysisSummary->GetXaxis()->SetBinLabel(30, "fMinPtTrackInEmcal");
1164 fHistAnalysisSummary->SetBinContent(30, fMinPtTrackInEmcal);
1165 fHistAnalysisSummary->GetXaxis()->SetBinLabel(31, "fEventPlaneVsEmcal");
1166 fHistAnalysisSummary->SetBinContent(31, fEventPlaneVsEmcal);
1167 fHistAnalysisSummary->GetXaxis()->SetBinLabel(32, "fMinEventPlane");
1168 fHistAnalysisSummary->SetBinContent(32, fMaxEventPlane);
1169 fHistAnalysisSummary->GetXaxis()->SetBinLabel(33, "fRandomConeRadius");
1170 fHistAnalysisSummary->SetBinContent(33, fRandomConeRadius);
1171 fHistAnalysisSummary->GetXaxis()->SetBinLabel(34, "fitModulationType");
1172 fHistAnalysisSummary->SetBinContent(34, (int)fFitModulationType);
1173 fHistAnalysisSummary->GetXaxis()->SetBinLabel(35, "runModeType");
1174 fHistAnalysisSummary->SetBinContent(35, (int)fRunModeType);
1175 fHistAnalysisSummary->GetXaxis()->SetBinLabel(36, "data type");
1176 fHistAnalysisSummary->SetBinContent(36, (int)fDataType);
1177 fHistAnalysisSummary->GetXaxis()->SetBinLabel(37, "iterator");
1178 fHistAnalysisSummary->SetBinContent(37, 1.);
1179 fHistAnalysisSummary->GetXaxis()->SetBinLabel(38, "fMinPvalue");
1180 fHistAnalysisSummary->SetBinContent(38, fMinPvalue);
1181 fHistAnalysisSummary->GetXaxis()->SetBinLabel(39, "fMaxPvalue");
1182 fHistAnalysisSummary->SetBinContent(39, fMaxPvalue);
1183 fHistAnalysisSummary->GetXaxis()->SetBinLabel(40, "fExcludeLeadingJetsFromFit");
1184 fHistAnalysisSummary->SetBinContent(40, fExcludeLeadingJetsFromFit);
1185 fHistAnalysisSummary->GetXaxis()->SetBinLabel(41, "fRebinSwapHistoOnTheFly");
1186 fHistAnalysisSummary->SetBinContent(41, (int)fRebinSwapHistoOnTheFly);
1187 fHistAnalysisSummary->GetXaxis()->SetBinLabel(42, "fUsePtWeight");
1188 fHistAnalysisSummary->SetBinContent(42, (int)fUsePtWeight);
1189 fHistAnalysisSummary->GetXaxis()->SetBinLabel(43, "fMinLeadingHadronPt");
1190 fHistAnalysisSummary->SetBinContent(43, fMinLeadingHadronPt);
1191 fHistAnalysisSummary->GetXaxis()->SetBinLabel(44, "fExplicitOutlierCut");
1192 fHistAnalysisSummary->SetBinContent(44, fExplicitOutlierCut);
1193 fHistAnalysisSummary->GetXaxis()->SetBinLabel(45, "fLocalJetMinEta");
1194 fHistAnalysisSummary->SetBinContent(45,fLocalJetMinEta );
1195 fHistAnalysisSummary->GetXaxis()->SetBinLabel(46, "fLocalJetMaxEta");
1196 fHistAnalysisSummary->SetBinContent(46, fLocalJetMaxEta);
1197 fHistAnalysisSummary->GetXaxis()->SetBinLabel(47, "fLocalJetMinPhi");
1198 fHistAnalysisSummary->SetBinContent(47, fLocalJetMinPhi);
1199 fHistAnalysisSummary->GetXaxis()->SetBinLabel(48, "fLocalJetMaxPhi");
1200 fHistAnalysisSummary->SetBinContent(48, fLocalJetMaxPhi);
1202 //_____________________________________________________________________________
1203 void AliAnalysisTaskRhoVnModulation::Terminate(Option_t *)
1206 switch (fRunModeType) {
1208 printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
1209 if(fFillQAHistograms) {
1210 Int_t runs[] = {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, 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};
1211 for(Int_t i(0); i < 64; i++) {
1212 fHistRunnumbersPhi->GetXaxis()->SetBinLabel(i+1, Form("%i", runs[i]));
1213 fHistRunnumbersEta->GetXaxis()->SetBinLabel(i+1, Form("%i", runs[i]));
1215 fHistRunnumbersPhi->GetXaxis()->SetBinLabel(65, "undetermined");
1216 fHistRunnumbersEta->GetXaxis()->SetBinLabel(65, "undetermined");
1218 AliAnalysisTaskRhoVnModulation::Dump();
1219 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));
1224 //_____________________________________________________________________________
1225 TH1F* AliAnalysisTaskRhoVnModulation::GetResolutionFromOuptutFile(detectorType det, Int_t h, TArrayD* cen)
1227 // INTERFACE METHOD FOR OUTPUTFILE
1228 // get the detector resolution, user has ownership of the returned histogram
1230 printf(" > Please add fOutputList first < \n");
1234 (cen) ? r = new TH1F("R", "R", cen->GetSize()-1, cen->GetArray()) : r = new TH1F("R", "R", 10, 0, 10);
1235 if(!cen) r->GetXaxis()->SetTitle("number of centrality bin");
1236 r->GetYaxis()->SetTitle(Form("Resolution #Psi_{%i}", h));
1237 for(Int_t i(0); i < 10; i++) {
1238 TProfile* temp((TProfile*)fOutputList->FindObject(Form("fProfV%iResolution_%i", h, i)));
1240 Double_t a(temp->GetBinContent(3)), b(temp->GetBinContent(5)), c(temp->GetBinContent(7));
1241 Double_t _a(temp->GetBinError(3)), _b(temp->GetBinError(5)), _c(temp->GetBinError(7));
1242 if(a <= 0 || b <= 0 || c <= 0) continue;
1245 r->SetBinContent(1+i, TMath::Sqrt((a*b)/c));
1246 if(i==0) r->SetNameTitle("VZEROA resolution", "VZEROA resolution");
1249 r->SetBinContent(1+i, TMath::Sqrt((a*c)/b));
1250 if(i==0) r->SetNameTitle("VZEROC resolution", "VZEROC resolution");
1253 r->SetBinContent(1+i, TMath::Sqrt((b*c)/a));
1254 if(i==0) r->SetNameTitle("TPC resolution", "TPC resolution");
1258 r->SetBinError(1+i, TMath::Sqrt(_a*_a+_b*_b+_c*_c));
1262 //_____________________________________________________________________________
1263 TH1F* AliAnalysisTaskRhoVnModulation::CorrectForResolutionDiff(TH1F* v, detectorType det, TArrayD* cen, Int_t c, Int_t h)
1265 // INTERFACE METHOD FOR OUTPUT FILE
1266 // correct the supplied differential vn histogram v for detector resolution
1267 TH1F* r(GetResolutionFromOuptutFile(det, h, cen));
1269 printf(" > Couldn't find resolution < \n");
1272 Double_t res(1./r->GetBinContent(1+r->FindBin(c)));
1273 TF1* line = new TF1("line", "pol0", 0, 200);
1274 line->SetParameter(0, res);
1275 return (v->Multiply(line)) ? v : 0x0;
1277 //_____________________________________________________________________________
1278 TH1F* AliAnalysisTaskRhoVnModulation::CorrectForResolutionInt(TH1F* v, detectorType det, TArrayD* cen, Int_t h)
1280 // INTERFACE METHOD FOR OUTPUT FILE
1281 // correct the supplied intetrated vn histogram v for detector resolution
1282 // integrated vn must have the same centrality binning as the resolotion correction
1283 TH1F* r(GetResolutionFromOuptutFile(det, h, cen));
1284 return (v->Divide(v, r)) ? v : 0x0;
1286 //_____________________________________________________________________________