]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation.cxx
from Redmer
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskRhoVnModulation.cxx
CommitLineData
38d2189d 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 * analysis task for jet flow preparation
18 *
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:
21 * - (anti-kt) jets
22 * - background estimate rho
23 * - pico tracks
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
27 *
28 * author: Redmer Alexander Bertens, Utrecht Univeristy, Utrecht, Netherlands
29 * rbertens@cern.ch, rbertens@nikhef.nl, r.a.bertens@uu.nl
30 */
31
32#include <TStyle.h>
33#include <TRandom3.h>
34#include <TChain.h>
35#include <TMath.h>
36#include <TF1.h>
37#include <TH1F.h>
38#include <TH2F.h>
39#include <TProfile.h>
40
41#include <AliAnalysisTask.h>
42#include <AliAnalysisManager.h>
43#include <AliCentrality.h>
44#include <AliVVertex.h>
45#include <AliESDEvent.h>
46#include <AliAODEvent.h>
47
48#include <AliPicoTrack.h>
49#include <AliEmcalJet.h>
50#include <AliRhoParameter.h>
51
52#include "AliAnalysisTaskRhoVnModulation.h"
53
54
55class AliAnalysisTaskRhoVnModulation;
56using namespace std;
57
58ClassImp(AliAnalysisTaskRhoVnModulation)
59
60AliAnalysisTaskRhoVnModulation::AliAnalysisTaskRhoVnModulation() : AliAnalysisTaskEmcalJet("AliAnalysisTaskRhoVnModulation", kTRUE),
b43cf414 61 fDebug(0), fInitialized(0), fFillQAHistograms(kTRUE), fCentralityClasses(0), fFitModulationType(kNoFit), fUsePtWeight(kTRUE), fDetectorType(kTPC), fFitModulationOptions("Q"), fRunModeType(kGrid), fDataType(kESD), fRandom(0), fMappedRunNumber(0), fInCentralitySelection(-1), fFitModulation(0), fMinPvalue(0), fNameJetClones(0), fNamePicoTrackClones(0), fNameRho(0), fAbsVertexZ(10), fHistCentrality(0), fHistVertexz(0), fHistRunnumbersPhi(0), fHistRunnumbersEta(0), fMinDisanceRCtoLJ(0), fRandomConeRadius(0.4), fOutputList(0), fOutputListGood(0), fOutputListBad(0), fHistAnalysisSummary(0), fHistSwap(0), fProfVn(0), fHistPsi2(0), fHistPsi2Spread(0), fHistPsiVZEROA(0), fHistPsiVZEROC(0), fHistPsiTPC(0),
38d2189d 62 fHistRhoVsMult(0), fHistRhoVsCent(0), fHistRhoAVsMult(0), fHistRhoAVsCent(0) {
63 for(Int_t i(0); i < 10; i++) {
64 fHistPicoTrackPt[i] = 0;
38d2189d 65 fHistPicoCat1[i] = 0;
66 fHistPicoCat2[i] = 0;
67 fHistPicoCat3[i] = 0;
68 /* fHistClusterPt[i] = 0; */
69 /* fHistClusterPhi[i] = 0; */
70 /* fHistClusterEta[i] = 0; */
71 /* fHistClusterCorrPt[i] = 0; */
72 /* fHistClusterCorrPhi[i] = 0; */
73 /* fHistClusterCorrEta[i] = 0; */
74 fHistRhoPackage[i] = 0;
75 fHistRho[i] = 0;
76 fHistRCPhiEta[i] = 0;
77 fHistRhoVsRCPt[i] = 0;
78 fHistRCPt[i] = 0;
3531e13d 79 fHistDeltaPtDeltaPhi[i] = 0;
38d2189d 80 fHistRCPhiEtaExLJ[i] = 0;
81 fHistRhoVsRCPtExLJ[i] = 0;
82 fHistRCPtExLJ[i] = 0;
3531e13d 83 fHistDeltaPtDeltaPhiExLJ[i] = 0;
38d2189d 84 fHistRCPhiEtaRand[i] = 0;
85 fHistRhoVsRCPtRand[i] = 0;
86 fHistRCPtRand[i] = 0;
3531e13d 87 fHistDeltaPtDeltaPhiRand[i] = 0;
38d2189d 88 fHistJetPtRaw[i] = 0;
89 fHistJetPt[i] = 0;
90 fHistJetEtaPhi[i] = 0;
91 fHistJetPtArea[i] = 0;
92 fHistJetPtConstituents[i] = 0;
b43cf414 93 fHistJetEtaRho[i] = 0;
38d2189d 94 fHistJetPsiTPCPt[i] = 0;
95 fHistJetPsiVZEROAPt[i] = 0;
96 fHistJetPsiVZEROCPt[i] = 0;
97 fHistDeltaPhiVZEROA[i] = 0;
98 fHistDeltaPhiVZEROC[i] = 0;
99 fHistDeltaPhiTPC[i] = 0;
100 }
101 // default constructor
102}
103//_____________________________________________________________________________
104AliAnalysisTaskRhoVnModulation::AliAnalysisTaskRhoVnModulation(const char* name, runModeType type) : AliAnalysisTaskEmcalJet(name, kTRUE),
b43cf414 105 fDebug(0), fInitialized(0), fFillQAHistograms(kTRUE), fCentralityClasses(0), fFitModulationType(kNoFit), fUsePtWeight(kTRUE), fDetectorType(kTPC), fFitModulationOptions("Q"), fRunModeType(type), fDataType(kESD), fRandom(0), fMappedRunNumber(0), fInCentralitySelection(-1), fFitModulation(0), fMinPvalue(0), fNameJetClones(0), fNamePicoTrackClones(0), fNameRho(0), fAbsVertexZ(10), fHistCentrality(0), fHistVertexz(0), fHistRunnumbersPhi(0), fHistRunnumbersEta(0), fMinDisanceRCtoLJ(0), fRandomConeRadius(0.4), fOutputList(0), fOutputListGood(0), fOutputListBad(0), fHistAnalysisSummary(0), fHistSwap(0), fProfVn(0), fHistPsi2(0), fHistPsi2Spread(0), fHistPsiVZEROA(0), fHistPsiVZEROC(0), fHistPsiTPC(0),
38d2189d 106 fHistRhoVsMult(0), fHistRhoVsCent(0), fHistRhoAVsMult(0), fHistRhoAVsCent(0) {
107 for(Int_t i(0); i < 10; i++) {
108 fHistPicoTrackPt[i] = 0;
38d2189d 109 fHistPicoCat1[i] = 0;
110 fHistPicoCat2[i] = 0;
111 fHistPicoCat3[i] = 0;
112 /* fHistClusterPt[i] = 0; */
113 /* fHistClusterPhi[i] = 0; */
114 /* fHistClusterEta[i] = 0; */
115 /* fHistClusterCorrPt[i] = 0; */
116 /* fHistClusterCorrPhi[i] = 0; */
117 /* fHistClusterCorrEta[i] = 0; */
118 fHistRhoPackage[i] = 0;
119 fHistRho[i] = 0;
120 fHistRCPhiEta[i] = 0;
121 fHistRhoVsRCPt[i] = 0;
122 fHistRCPt[i] = 0;
3531e13d 123 fHistDeltaPtDeltaPhi[i] = 0;
38d2189d 124 fHistRCPhiEtaExLJ[i] = 0;
125 fHistRhoVsRCPtExLJ[i] = 0;
126 fHistRCPtExLJ[i] = 0;
3531e13d 127 fHistDeltaPtDeltaPhiExLJ[i] = 0;
38d2189d 128 fHistRCPhiEtaRand[i] = 0;
129 fHistRhoVsRCPtRand[i] = 0;
130 fHistRCPtRand[i] = 0;
3531e13d 131 fHistDeltaPtDeltaPhiRand[i] = 0;
38d2189d 132 fHistJetPtRaw[i] = 0;
133 fHistJetPt[i] = 0;
134 fHistJetEtaPhi[i] = 0;
135 fHistJetPtArea[i] = 0;
136 fHistJetPtConstituents[i] = 0;
b43cf414 137 fHistJetEtaRho[i] = 0;
38d2189d 138 fHistJetPsiTPCPt[i] = 0;
139 fHistJetPsiVZEROAPt[i] = 0;
140 fHistJetPsiVZEROCPt[i] = 0;
141 fHistDeltaPhiVZEROA[i] = 0;
142 fHistDeltaPhiVZEROC[i] = 0;
143 fHistDeltaPhiTPC[i] = 0;
144 }
145 // constructor
146 DefineInput(0, TChain::Class());
147 DefineOutput(1, TList::Class());
148 switch (fRunModeType) {
149 case kLocal : {
150 gStyle->SetOptFit(1);
151 DefineOutput(2, TList::Class());
152 DefineOutput(3, TList::Class());
153 } break;
154 default: fDebug = -1; // suppress debug info explicitely when not running locally
155 }
156}
157//_____________________________________________________________________________
158AliAnalysisTaskRhoVnModulation::~AliAnalysisTaskRhoVnModulation()
159{
160 // destructor
3531e13d 161 if(fOutputList) delete fOutputList;
162 if(fOutputListGood) delete fOutputListGood;
163 if(fOutputListBad) delete fOutputListBad;
164 if(fFitModulation) delete fFitModulation;
165 if(fHistSwap) delete fHistSwap;
166 if(fCentralityClasses) delete fCentralityClasses;
38d2189d 167}
168//_____________________________________________________________________________
169Bool_t AliAnalysisTaskRhoVnModulation::InitializeAnalysis()
170{
171 // initialize the anaysis
172 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
173 if(fMinDisanceRCtoLJ==0) fMinDisanceRCtoLJ = .5*fJetRadius;
174 if(dynamic_cast<AliAODEvent*>(InputEvent())) fDataType = kAOD; // determine the datatype
175 else if(dynamic_cast<AliESDEvent*>(InputEvent())) fDataType = kESD;
b43cf414 176 fHistAnalysisSummary->SetBinContent(36, (int)fDataType);
38d2189d 177 if(!fRandom) fRandom = new TRandom3(0); // get a randomized if one hasn't been user-supplied
178 switch (fFitModulationType) {
179 case kNoFit : { SetModulationFit(new TF1("fix_kNoFit", "[0]", 0, TMath::TwoPi())); } break;
180 case kV2 : {
181 SetModulationFit(new TF1("fit_kV2", "[0]*([1]+[2]*[3]*TMath::Cos([2]*(x-[4])))", 0, TMath::TwoPi()));
182 fFitModulation->SetParameter(0, 0.); // normalization
183 fFitModulation->SetParameter(3, 0.2); // v2
184 fFitModulation->FixParameter(1, 1.); // constant
185 fFitModulation->FixParameter(2, 2.); // constant
186 } break;
187 case kV3: {
188 SetModulationFit(new TF1("fit_kV3", "[0]*([1]+[2]*[3]*TMath::Cos([2]*(x-[4])))", 0, TMath::TwoPi()));
189 fFitModulation->SetParameter(0, 0.); // normalization
190 fFitModulation->SetParameter(3, 0.2); // v3
191 fFitModulation->FixParameter(1, 1.); // constant
192 fFitModulation->FixParameter(2, 3.); // constant
193 } break;
3531e13d 194 default : { // for the combined fit and the 'direct fourier series' we use v2 and v3
195 SetModulationFit(new TF1("fit_kCombined", "[0]*([1]+[2]*([3]*TMath::Cos([2]*(x-[4]))+[7]*TMath::Cos([5]*(x-[6]))))", 0, TMath::TwoPi()));
38d2189d 196 fFitModulation->SetParameter(0, 0.); // normalization
197 fFitModulation->SetParameter(3, 0.2); // v2
198 fFitModulation->FixParameter(1, 1.); // constant
199 fFitModulation->FixParameter(2, 2.); // constant
200 fFitModulation->FixParameter(5, 3.); // constant
201 fFitModulation->SetParameter(7, 0.2); // v3
202 } break;
38d2189d 203 }
204 switch (fRunModeType) {
205 case kGrid : { fFitModulationOptions += "N0"; } break;
206 default : break;
207 }
208 return kTRUE;
209}
210//_____________________________________________________________________________
211TH1F* AliAnalysisTaskRhoVnModulation::BookTH1F(const char* name, const char* x, Int_t bins, Double_t min, Double_t max, Int_t c)
212{
213 // book a TH1F and connect it to the output container
214 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
215 if(!fOutputList) return 0x0;
3531e13d 216 TString title(name);
217 if(c!=-1) { // format centrality dependent histograms accordingly
218 name = Form("%s_%i", name, c);
219 title += Form("_%i-%i", fCentralityClasses->At(c), fCentralityClasses->At(1+c));
220 }
221 title += Form(";%s;[counts]", x);
222 TH1F* histogram = new TH1F(name, title.Data(), bins, min, max);
38d2189d 223 histogram->Sumw2();
224 fOutputList->Add(histogram);
225 return histogram;
226}
227//_____________________________________________________________________________
228TH2F* 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)
229{
230 // book a TH2F and connect it to the output container
231 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
232 if(!fOutputList) return 0x0;
3531e13d 233 TString title(name);
234 if(c!=-1) { // format centrality dependent histograms accordingly
235 name = Form("%s_%i", name, c);
236 title += Form("_%i-%i", fCentralityClasses->At(c), fCentralityClasses->At(1+c));
237 }
238 title += Form(";%s;%s", x, y);
239 TH2F* histogram = new TH2F(name, title.Data(), binsx, minx, maxx, binsy, miny, maxy);
38d2189d 240 histogram->Sumw2();
241 fOutputList->Add(histogram);
242 return histogram;
243}
244//_____________________________________________________________________________
245void AliAnalysisTaskRhoVnModulation::UserCreateOutputObjects()
246{
247 // create output objects
248 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
249 fOutputList = new TList();
250 fOutputList->SetOwner(kTRUE);
3531e13d 251 if(!fCentralityClasses) { // classes must be defined at this point
252 Int_t c[] = {0, 20, 40, 60, 80, 100};
253 fCentralityClasses = new TArrayI(sizeof(c)/sizeof(c[0]), c);
254 }
38d2189d 255 // global QA
b43cf414 256 fHistCentrality = BookTH1F("fHistCentrality", "centrality", 102, -2, 100);
38d2189d 257 fHistVertexz = BookTH1F("fHistVertexz", "vertex z (cm)", 100, -12, 12);
258
259 // pico track kinematics
3531e13d 260 for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i++) {
38d2189d 261 fHistPicoTrackPt[i] = BookTH1F("fHistPicoTrackPt", "p_{t} [GeV/c]", 100, 0, 50, i);
38d2189d 262 if(fFillQAHistograms) {
b43cf414 263 fHistPicoCat1[i] = BookTH2F("fHistPicoCat1", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i);
264 fHistPicoCat2[i] = BookTH2F("fHistPicoCat2", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i);
265 fHistPicoCat3[i] = BookTH2F("fHistPicoCat3", "#eta", "#phi", 50, -1, 1, 50, 0, TMath::TwoPi(), i);
38d2189d 266 }
267 // emcal kinematics
268 /* fHistClusterPt[i] = BookTH1F("fHistClusterPt", "p_{t} [GeV/c]", 100, 0, 100, i); */
269 /* fHistClusterPhi[i] = BookTH1F("fHistClusterPhi", "#phi", 100, 0, TMath::TwoPi(), i); */
270 /* fHistClusterEta[i] = BookTH1F("fHistClusterEta", "#eta", 100, -5, 5); */
271
272 // emcal kinematics after hadronic correction
273 /* fHistClusterCorrPt[i] = BookTH1F("fHistClusterCorrPt", "p_{t} [GeV/c]", 100, 0, 100, i); */
274 /* fHistClusterCorrPhi[i] = BookTH1F("fHistClusterCorrPhi", "#phi", 100, 0, TMath::TwoPi(), i); */
275 /* fHistClusterCorrEta[i] = BookTH1F("fHistClusterCorrEta", "#eta", 100, -5, 5, i); */
276 }
277
278 // event plane estimates and quality
279 fHistPsi2 = new TProfile("fHistPsi2", "fHistPsi2", 3, 0, 3);
280 fHistPsi2->Sumw2();
281 fHistPsi2Spread = new TProfile("fHistPsi2Spread", "fHistPsi2Spread", 3, 0, 3);
282 fHistPsi2Spread->Sumw2();
283 fHistPsi2->GetXaxis()->SetBinLabel(1, "<#Psi_{2, VZEROA}>");
284 fHistPsi2->GetXaxis()->SetBinLabel(2, "<#Psi_{2, VZEROC}>");
285 fHistPsi2->GetXaxis()->SetBinLabel(3, "<#Psi_{2, TPC}>");
286 fHistPsi2Spread->GetXaxis()->SetBinLabel(1, "<#Psi_{2, VZEROA} - #Psi_{2, VZEROC}>");
287 fHistPsi2Spread->GetXaxis()->SetBinLabel(2, "<#Psi_{2, VZEROC} - #Psi_{2, TPC}>");
288 fHistPsi2Spread->GetXaxis()->SetBinLabel(3, "<#Psi_{2, VZEROC} - #Psi_{2, TPC}>");
289 fOutputList->Add(fHistPsi2);
290 fOutputList->Add(fHistPsi2Spread);
291 fHistPsiVZEROA = BookTH1F("fHistPsiVZEROA", "#Psi_{VZEROA}", 100, -.5*TMath::Pi(), .5*TMath::Pi());
292 fHistPsiVZEROC = BookTH1F("fHistPsiVZEROC", "#Psi_{VZEROC}", 100, -.5*TMath::Pi(), .5*TMath::Pi());
293 fHistPsiTPC = BookTH1F("fHistPsiTPC", "#Psi_{TPC}", 100, -.5*TMath::Pi(), .5*TMath::Pi());
294
295 // background
3531e13d 296 for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i ++) {
38d2189d 297 fHistRhoPackage[i] = BookTH1F("fHistRhoPackage", "#rho [GeV/c]", 100, 0, 150, i);
298 fHistRho[i] = BookTH1F("fHistRho", "#rho [GeV/c]", 100, 0, 150, i);
299 }
300 fHistRhoVsMult = BookTH2F("fHistRhoVsMult", "multiplicity", "#rho [GeV/c]", 100, 0, 4000, 100, 0, 250);
301 fHistRhoVsCent = BookTH2F("fHistRhoVsCent", "centrality", "#rho [GeV/c]", 100, 0, 100, 100, 0, 250);
302 fHistRhoAVsMult = BookTH2F("fHistRhoAVsMult", "multiplicity", "#rho * A (jet) [GeV/c]", 100, 0, 4000, 100, 0, 50);
303 fHistRhoAVsCent = BookTH2F("fHistRhoAVsCent", "centrality", "#rho * A (jet) [GeV/c]", 100, 0, 100, 100, 0, 50);
304
305 // delta pt distributions
3531e13d 306 for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i ++) {
38d2189d 307 fHistRCPhiEta[i] = BookTH2F("fHistRCPhiEta", "#phi (RC)", "#eta (RC)", 100, 0, TMath::TwoPi(), 100, -1, 1, i);
b43cf414 308 fHistRhoVsRCPt[i] = BookTH2F("fHistRhoVsRCPt", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i);
38d2189d 309 fHistRCPt[i] = BookTH1F("fHistRCPt", "p_{t} (RC) [GeV/c]", 130, -20, 150, i);
3531e13d 310 fHistDeltaPtDeltaPhi[i] = BookTH2F("fHistDeltaPtDeltaPhi", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 100, 0, TMath::TwoPi(), 100, -50, 100);
38d2189d 311 fHistRCPhiEtaExLJ[i] = BookTH2F("fHistRCPhiEtaExLJ", "#phi (RC)", "#eta (RC)", 100, 0, TMath::TwoPi(), 100, -1, 1, i);
b43cf414 312 fHistRhoVsRCPtExLJ[i] = BookTH2F("fHistRhoVsRCPtExLJ", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i);
38d2189d 313 fHistRCPtExLJ[i] = BookTH1F("fHistRCPtExLJ", "p_{t} (RC) [GeV/c]", 130, -20, 150, i);
3531e13d 314 fHistDeltaPtDeltaPhiExLJ[i] = BookTH2F("fHistDeltaPtDeltaPhiExLJ", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 100, 0, TMath::TwoPi(), 100, -50, 100);
38d2189d 315 fHistRCPhiEtaRand[i] = BookTH2F("fHistRCPhiEtaRand", "#phi (RC)", "#eta (RC)", 100, 0, TMath::TwoPi(), 100, -1, 1, i);
b43cf414 316 fHistRhoVsRCPtRand[i] = BookTH2F("fHistRhoVsRCPtRand", "p_{t} (RC) [GeV/c]", "#rho * A (RC) [GeV/c]", 100, 0, 300, 100, 0, 350, i);
38d2189d 317 fHistRCPtRand[i] = BookTH1F("fHistRCPtRand", "p_{t} (RC) [GeV/c]", 130, -20, 150, i);
3531e13d 318 fHistDeltaPtDeltaPhiRand[i] = BookTH2F("fHistDeltaPtDeltaPhiRand", "#phi - #Psi_{TPC}", "#delta p_{t} [GeV/c]", 100, 0, TMath::TwoPi(), 100, -50, 100);
38d2189d 319 // jet histograms (after kinematic cuts)
320 fHistJetPtRaw[i] = BookTH1F("fHistJetPtRaw", "p_{t} RAW [GeV/c]", 200, -50, 150, i);
b43cf414 321 fHistJetPt[i] = BookTH1F("fHistJetPt", "p_{t} [GeV/c]", 350, -100, 250, i);
38d2189d 322 fHistJetEtaPhi[i] = BookTH2F("fHistJetEtaPhi", "#eta", "#phi", 100, -1, 1, 100, 0, TMath::TwoPi(), i);
b43cf414 323 fHistJetPtArea[i] = BookTH2F("fHistJetPtArea", "p_{t} [GeV/c]", "Area", 350, -100, 250, 60, 0, 0.3, i);
324 fHistJetPtConstituents[i] = BookTH2F("fHistJetPtConstituents", "p_{t} [GeV/c]", "Area", 350, -100, 250, 60, 0, 150, i);
325 fHistJetEtaRho[i] = BookTH2F("fHistJetEtaRho", "#eta", "#rho", 100, -1, 1, 100, 0, 300, i);
38d2189d 326 // in plane and out of plane spectra
b43cf414 327 fHistJetPsiTPCPt[i] = BookTH2F("fHistJetPsiTPCPt", "#phi_{jet} - #Psi_{TPC}", "p_{t} [GeV/c]", 100, 0., TMath::TwoPi(), 700, -100, 250, i);
328 fHistJetPsiVZEROAPt[i] = BookTH2F("fHistJetPsiVZEROAPt", "#phi_{jet} - #Psi_{VZEROA}", "p_{t} [GeV/c]", 100, 0., TMath::TwoPi(), 700, -100, 250, i);
329 fHistJetPsiVZEROCPt[i] = BookTH2F("fHistJetPsiVZEROCPt", "#phi_{jet} - #Psi_{VZEROC}", "p_{t} [GeV/c]", 100, 0., TMath::TwoPi(), 700, -100, 250, i);
38d2189d 330 // phi minus psi
331 fHistDeltaPhiVZEROA[i] = BookTH1F("fHistDeltaPhiVZEROA", "#phi_{jet} - #Psi_{VZEROA}", 100, 0, TMath::TwoPi(), i);
332 fHistDeltaPhiVZEROC[i] = BookTH1F("fHistDeltaPhiVZEROC", "#phi_{jet} - #Psi_{VZEROC}", 100, 0, TMath::TwoPi(), i);
333 fHistDeltaPhiTPC[i] = BookTH1F("fHistDeltaPhiTPC", "#phi_{jet} - #Psi_{TPC}", 100, 0, TMath::TwoPi(), i);
334 }
335
336 // analysis summary histrogram, saves all relevant analysis settigns
337 fHistAnalysisSummary = BookTH1F("fHistAnalysisSummary", "flag", 37, -0.5, 37.5);
b43cf414 338 fHistAnalysisSummary->GetXaxis()->SetBinLabel(1, "fJetRadius");
38d2189d 339 fHistAnalysisSummary->SetBinContent(1, fJetRadius);
340 fHistAnalysisSummary->GetXaxis()->SetBinLabel(2, "fPtBiasJetTrack");
341 fHistAnalysisSummary->SetBinContent(2, fPtBiasJetTrack);
342 fHistAnalysisSummary->GetXaxis()->SetBinLabel(3, "fPtBiasJetClus");
343 fHistAnalysisSummary->SetBinContent(3, fPtBiasJetClus);
344 fHistAnalysisSummary->GetXaxis()->SetBinLabel(4, "fJetPtCut");
345 fHistAnalysisSummary->SetBinContent(4, fJetPtCut);
346 fHistAnalysisSummary->GetXaxis()->SetBinLabel(5, "fJetAreaCut");
347 fHistAnalysisSummary->SetBinContent(5, fJetAreaCut);
348 fHistAnalysisSummary->GetXaxis()->SetBinLabel(6, "fPercAreaCut");
349 fHistAnalysisSummary->SetBinContent(6, fPercAreaCut);
350 fHistAnalysisSummary->GetXaxis()->SetBinLabel(7, "fAreaEmcCut");
351 fHistAnalysisSummary->SetBinContent(7, fAreaEmcCut);
352 fHistAnalysisSummary->GetXaxis()->SetBinLabel(8, "fJetMinEta");
353 fHistAnalysisSummary->SetBinContent(8, fJetMinEta);
354 fHistAnalysisSummary->GetXaxis()->SetBinLabel(9, "fJetMaxEta");
355 fHistAnalysisSummary->SetBinContent(9, fJetMaxEta);
356 fHistAnalysisSummary->GetXaxis()->SetBinLabel(10, "fJetMinPhi");
357 fHistAnalysisSummary->SetBinContent(10, fJetMinPhi);
358 fHistAnalysisSummary->GetXaxis()->SetBinLabel(11, "fJetMaxPhi");
359 fHistAnalysisSummary->SetBinContent(11, fJetMaxPhi);
360 fHistAnalysisSummary->GetXaxis()->SetBinLabel(12, "fMaxClusterPt");
361 fHistAnalysisSummary->SetBinContent(12, fMaxClusterPt);
362 fHistAnalysisSummary->GetXaxis()->SetBinLabel(13, "fMaxTrackPt");
363 fHistAnalysisSummary->SetBinContent(13, fMaxTrackPt);
364 fHistAnalysisSummary->GetXaxis()->SetBinLabel(14, "fLeadingHadronType");
365 fHistAnalysisSummary->SetBinContent(14, fLeadingHadronType);
366 fHistAnalysisSummary->GetXaxis()->SetBinLabel(15, "fAnaType");
367 fHistAnalysisSummary->SetBinContent(15, fAnaType);
368 fHistAnalysisSummary->GetXaxis()->SetBinLabel(16, "fForceBeamType");
369 fHistAnalysisSummary->SetBinContent(16, fForceBeamType);
370 fHistAnalysisSummary->GetXaxis()->SetBinLabel(17, "fMinCent");
371 fHistAnalysisSummary->SetBinContent(17, fMinCent);
372 fHistAnalysisSummary->GetXaxis()->SetBinLabel(18, "fMaxCent");
373 fHistAnalysisSummary->SetBinContent(18, fMaxCent);
374 fHistAnalysisSummary->GetXaxis()->SetBinLabel(19, "fMinVz");
375 fHistAnalysisSummary->SetBinContent(19, fMinVz);
376 fHistAnalysisSummary->GetXaxis()->SetBinLabel(20, "fMaxVz");
377 fHistAnalysisSummary->SetBinContent(20, fMaxVz);
378 fHistAnalysisSummary->GetXaxis()->SetBinLabel(21, "fOffTrigger");
379 fHistAnalysisSummary->SetBinContent(21, fOffTrigger);
380 fHistAnalysisSummary->GetXaxis()->SetBinLabel(22, "fClusPtCut");
381 fHistAnalysisSummary->SetBinContent(22, fClusPtCut);
382 fHistAnalysisSummary->GetXaxis()->SetBinLabel(23, "fTrackPtCut");
383 fHistAnalysisSummary->SetBinContent(23, fTrackPtCut);
384 fHistAnalysisSummary->GetXaxis()->SetBinLabel(24, "fTrackMinEta");
385 fHistAnalysisSummary->SetBinContent(24, fTrackMinEta);
386 fHistAnalysisSummary->GetXaxis()->SetBinLabel(25, "fTrackMaxEta");
387 fHistAnalysisSummary->SetBinContent(25, fTrackMaxEta);
388 fHistAnalysisSummary->GetXaxis()->SetBinLabel(26, "fTrackMinPhi");
389 fHistAnalysisSummary->SetBinContent(26, fTrackMinPhi);
390 fHistAnalysisSummary->GetXaxis()->SetBinLabel(27, "fTrackMaxPhi");
391 fHistAnalysisSummary->SetBinContent(27, fTrackMaxPhi);
392 fHistAnalysisSummary->GetXaxis()->SetBinLabel(28, "fClusTimeCutLow");
393 fHistAnalysisSummary->SetBinContent(28, fClusTimeCutLow);
394 fHistAnalysisSummary->GetXaxis()->SetBinLabel(29, "fClusTimeCutUp");
395 fHistAnalysisSummary->SetBinContent(29, fClusTimeCutUp);
396 fHistAnalysisSummary->GetXaxis()->SetBinLabel(30, "fMinPtTrackInEmcal");
397 fHistAnalysisSummary->SetBinContent(30, fMinPtTrackInEmcal);
398 fHistAnalysisSummary->GetXaxis()->SetBinLabel(31, "fEventPlaneVsEmcal");
399 fHistAnalysisSummary->SetBinContent(31, fEventPlaneVsEmcal);
400 fHistAnalysisSummary->GetXaxis()->SetBinLabel(32, "fMinEventPlane");
401 fHistAnalysisSummary->SetBinContent(32, fMaxEventPlane);
402 fHistAnalysisSummary->GetXaxis()->SetBinLabel(33, "fRandomConeRadius");
403 fHistAnalysisSummary->SetBinContent(33, fRandomConeRadius);
404 fHistAnalysisSummary->GetXaxis()->SetBinLabel(34, "fitModulationType");
405 fHistAnalysisSummary->SetBinContent(34, (int)fFitModulationType);
406 fHistAnalysisSummary->GetXaxis()->SetBinLabel(35, "runModeType");
407 fHistAnalysisSummary->SetBinContent(35, (int)fRunModeType);
408 fHistAnalysisSummary->GetXaxis()->SetBinLabel(36, "data type");
38d2189d 409 fHistAnalysisSummary->GetXaxis()->SetBinLabel(37, "iterator");
410 fHistAnalysisSummary->SetBinContent(37, 1.);
411
412 if(fFillQAHistograms) {
413 fHistRunnumbersEta = new TH2F("fHistRunnumbersEta", "fHistRunnumbersEta", 100, -.5, 99.5, 100, -1.1, 1.1);
414 fHistRunnumbersEta->Sumw2();
415 fOutputList->Add(fHistRunnumbersEta);
416 fHistRunnumbersPhi = new TH2F("fHistRunnumbersPhi", "fHistRunnumbersPhi", 100, -.5, 99.5, 100, -0.2, TMath::TwoPi()+0.2);
417 fHistRunnumbersPhi->Sumw2();
418 fOutputList->Add(fHistRunnumbersPhi);
419 }
420
421 fHistSwap = new TH1F("fHistSwap", "fHistSwap", 20, 0, TMath::TwoPi());
422 fHistSwap->Sumw2();
423 fProfVn = new TProfile("fProfVn", "fProfVn", 2, -0.5, 1.5);
424 fProfVn->GetXaxis()->SetBinLabel(1, "v_{2}(EBYE)");
425 fProfVn->GetXaxis()->SetBinLabel(2, "v_{2}(EBYE)");
426
427 fOutputList->Add(fProfVn);
428 PostData(1, fOutputList);
429
430 switch (fRunModeType) {
431 case kLocal : {
432 fOutputListGood = new TList();
433 fOutputListGood->SetOwner(kTRUE);
434 fOutputListBad = new TList();
435 fOutputListBad->SetOwner(kTRUE);
436 PostData(2, fOutputListGood);
437 PostData(3, fOutputListBad);
438 } break;
439 default: break;
440 }
38d2189d 441}
442//_____________________________________________________________________________
443Bool_t AliAnalysisTaskRhoVnModulation::Run()
444{
445 // user exec: execute once for each event
446 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
447 if(!fInitialized) fInitialized = InitializeAnalysis();
448 // reject the event if expected data is missing
449 if(!PassesCuts(InputEvent())) return kFALSE;
450 if(!(fTracks||fJets||fRho)) return kFALSE;
3531e13d 451 if(!fCaloClusters && fDebug > 0) printf(" > Warning: couldn't retreive calo clusters! < \n");
38d2189d 452 // [0][0] psi2a [1,0] psi2c
453 // [0][1] psi3a [1,1] psi3c
454 Double_t vzero[2][2];
455 CalculateEventPlaneVZERO(vzero);
456 // [0] psi2 [1] psi3
457 Double_t tpc[2];
458 CalculateEventPlaneTPC(tpc);
459
460 // arrays which will hold the fit parameters
461 Double_t fitParameters[] = {0,0,0,0,0,0,0,0,0};
462 Double_t psi2(-1), psi3(-1);
463 switch (fDetectorType) { // determine the detector type for the rho fit
b43cf414 464 case kTPC : { psi2 = tpc[0]; psi3 = tpc[1]; } break;
465 case kVZEROA : { psi2 = vzero[0][0]; psi3 = vzero[0][1]; } break;
466 case kVZEROC : { psi2 = vzero[1][0]; psi3 = vzero[1][1]; } break;
38d2189d 467 default : break;
468 }
469
470 switch (fFitModulationType) { // do the fits
471 case kNoFit : { fFitModulation->FixParameter(0, RhoVal()); } break;
472 case kV2 : {
473 CorrectRho(fitParameters, psi2, psi3);
474 fProfVn->Fill((double)0, fFitModulation->GetParameter(3));
475 } break;
476 case kV3 : {
477 CorrectRho(fitParameters, psi2, psi3);
478 fProfVn->Fill((double)1, fFitModulation->GetParameter(3));
479 } break;
3531e13d 480 case kUser : {
481 CorrectRho(fitParameters, psi2, psi3);
482 } break;
483 default : {
38d2189d 484 CorrectRho(fitParameters, psi2, psi3);
485 fProfVn->Fill((double)0, fFitModulation->GetParameter(3));
486 fProfVn->Fill((double)1, fFitModulation->GetParameter(7));
487 } break;
38d2189d 488 }
489 // fill a number of histograms
490 FillHistogramsAfterSubtraction(vzero, tpc);
491
492 // send the output to the connected output container
493 PostData(1, fOutputList);
494 switch (fRunModeType) {
495 case kLocal : {
496 PostData(2, fOutputListGood);
497 PostData(3, fOutputListBad);
498 } break;
499 default: break;
500 }
501 return kTRUE;
502}
503//_____________________________________________________________________________
504void AliAnalysisTaskRhoVnModulation::CalculateEventPlaneVZERO(Double_t vzero[2][2]) const
505{
506 // grab the UNCALIBRATED vzero event plane
507 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
508 Double_t qxa2(0), qya2(0), qxc2(0), qyc2(0); // for psi2
509 Double_t qxa3(0), qya3(0), qxc3(0), qyc3(0); // for psi3
510 for(Int_t iVZERO(0); iVZERO < 64; iVZERO++) {
511 Double_t phi(TMath::PiOver4()*(.5+iVZERO%8)), /* eta(0), */ weight(InputEvent()->GetVZEROEqMultiplicity(iVZERO));
512// (iVZERO<32) ? eta = -3.45+.5*(iVZERO/8) : eta = 4.8-.6*((iVZERO/8)-4);
513 if(iVZERO<32) {
514 qxa2 += weight*TMath::Cos(2.*phi);
515 qya2 += weight*TMath::Sin(2.*phi);
516 qxa3 += weight*TMath::Cos(3.*phi);
517 qya3 += weight*TMath::Sin(3.*phi);
518 }
519 else {
520 qxc2 += weight*TMath::Cos(2.*phi);
521 qyc2 += weight*TMath::Sin(2.*phi);
522 qxc3 += weight*TMath::Cos(3.*phi);
523 qyc3 += weight*TMath::Sin(3.*phi);
524 }
525 }
526 vzero[0][0] = .5*TMath::ATan2(qya2, qxa2);
527 vzero[1][0] = .5*TMath::ATan2(qyc2, qxc2);
528 vzero[0][1] = (1./3.)*TMath::ATan2(qya3, qxa3);
529 vzero[1][1] = (1./3.)*TMath::ATan2(qyc3, qxc3);
530}
531//_____________________________________________________________________________
532void AliAnalysisTaskRhoVnModulation::CalculateEventPlaneTPC(Double_t* tpc) const
533{
534 // grab the TPC event plane
535 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
536 Double_t qx2(0), qy2(0); // for psi2
537 Double_t qx3(0), qy3(0); // for psi3
538 if(fTracks) {
539 Int_t iTracks(fTracks->GetEntriesFast());
540 for(Int_t iTPC(0); iTPC < iTracks; iTPC++) {
541 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(iTPC));
542 if(!PassesCuts(track)) continue;
543 qx2+= TMath::Cos(2.*track->Phi());
544 qy2+= TMath::Sin(2.*track->Phi());
545 qx3+= TMath::Cos(3.*track->Phi());
546 qy3+= TMath::Sin(3.*track->Phi());
547 }
548 }
549 tpc[0] = .5*TMath::ATan2(qy2, qx2);
550 tpc[1] = (1./3.)*TMath::ATan2(qy3, qx3);
551}
552//_____________________________________________________________________________
553void AliAnalysisTaskRhoVnModulation::CalculateRandomCone(Float_t &pt, Float_t &eta, Float_t &phi,
554 AliEmcalJet* jet, Bool_t randomize) const
555{
556 // get a random cone
557 if(fDebug > 1) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
558 pt = 0; eta = 0; phi = 0;
559 Float_t etaJet(999), phiJet(999), dJet(999); // no jet: same as jet very far away
560 if(jet) { // if a leading jet is given, use its kinematic properties
561 etaJet = jet->Eta();
562 phiJet = jet->Phi();
563 }
564 // force the random cones to at least be within detector acceptance
565 Float_t minPhi(fJetMinPhi), maxPhi(fJetMaxPhi);
566 if(maxPhi > TMath::TwoPi()) maxPhi = TMath::TwoPi();
567 if(minPhi < 0 ) minPhi = 0;
568 Float_t diffRcRJR(TMath::Abs(fRandomConeRadius-fJetRadius));
569 // construct a random cone and see if it's far away enough from the leading jet
570 Int_t attempts(1000);
571 while(kTRUE) {
572 attempts--;
573 eta = gRandom->Uniform(fJetMinEta+diffRcRJR, fJetMaxEta-diffRcRJR);
574 phi = gRandom->Uniform(minPhi, maxPhi);
575
576 dJet = TMath::Sqrt((etaJet-eta)*(etaJet-eta)+(phiJet-phi)*(phiJet-phi));
577 if(dJet > fMinDisanceRCtoLJ) break;
578 else if (attempts == 0) {
579 printf(" > No random cone after 1000 tries, giving up ... !\n");
580 return;
581 }
582 }
583 if(fTracks) {
584 Int_t iTracks(fTracks->GetEntriesFast());
585 for(Int_t i(0); i < iTracks; i++) {
586 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
587 if(!PassesCuts(track)) continue;
588 Float_t etaTrack(track->Eta()), phiTrack(track->Phi()), ptTrack(track->Pt());
589 // if requested, randomize eta and phi to destroy any correlated fluctuations
590 if(randomize) {
591 etaTrack = gRandom->Uniform(fTrackMinEta, fTrackMaxEta);
592 phiTrack = gRandom->Uniform(minPhi, maxPhi);
593 }
594 // get distance from cone
595 if(TMath::Abs(phiTrack-phi) > TMath::Abs(phiTrack - phi + TMath::TwoPi())) phiTrack+=TMath::TwoPi();
596 if(TMath::Abs(phiTrack-phi) > TMath::Abs(phiTrack - phi - TMath::TwoPi())) phiTrack-=TMath::TwoPi();
597 if(TMath::Sqrt(TMath::Abs((etaTrack-eta)*(etaTrack-eta)+(phiTrack-phi)*(phiTrack-phi))) <= fRandomConeRadius) pt+=ptTrack;
598 }
599 }
600}
601//_____________________________________________________________________________
602void AliAnalysisTaskRhoVnModulation::CorrectRho(Double_t* params, Double_t psi2, Double_t psi3) const
603{
604 // get rho' -> rho(phi)
3531e13d 605 // two routines are available
606 // [1] fitting a fourier expansion to the de/dphi distribution
607 // [2] getting vn from a fourier series around dn/dphi (see below for info)
38d2189d 608 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
609 TString detector("");
610 switch (fDetectorType) {
611 case kTPC : detector+="TPC";
612 break;
613 case kVZEROA : detector+="VZEROA";
614 break;
615 case kVZEROC : detector+="VZEROC";
616 break;
617 default: break;
618 }
619 Int_t iTracks(fTracks->GetEntriesFast());
3531e13d 620 if(iTracks <= 0 || RhoVal() <= 0 ) return; // no use fitting an empty event ...
621 fHistSwap->Reset(); // clear the histogram
38d2189d 622 for(Int_t i(0); i < iTracks; i++) {
623 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
624 if(!PassesCuts(track) || track->Pt() > 5 || track->Pt() < 0.15) continue;
b43cf414 625 if(fUsePtWeight) fHistSwap->Fill(track->Phi(), track->Pt());
626 else fHistSwap->Fill(track->Phi());
38d2189d 627 }
628 fFitModulation->SetParameter(0, RhoVal());
629 switch (fFitModulationType) {
b43cf414 630 case kNoFit : { fFitModulation->FixParameter(0, RhoVal() );
631 } break;
3531e13d 632 case kV2 : {
633 fFitModulation->FixParameter(4, psi2);
634 } break;
635 case kV3 : {
636 fFitModulation->FixParameter(4, psi3);
637 } break;
38d2189d 638 case kCombined : {
639 fFitModulation->FixParameter(4, psi2);
640 fFitModulation->FixParameter(6, psi3);
641 } break;
3531e13d 642 case kFourierSeries : {
643 // in this approach, an explicit calculation will be made of vn = sqrt(xn^2+yn^2)
644 // where x[y] = Integrate[r(phi)cos[sin](n phi)dphi, 0, 2pi]
645 Double_t cos2(0), sin2(0), cos3(0), sin3(0), sumPt(0);
646 for(Int_t i(0); i < iTracks; i++) {
647 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
648 if(!PassesCuts(track) || track->Pt() > 5 || track->Pt() < 0.15) continue;
649 sumPt += track->Pt();
650 cos2 += track->Pt()*TMath::Cos(2*PhaseShift(track->Phi()-psi2));
651 sin2 += track->Pt()*TMath::Sin(2*PhaseShift(track->Phi()-psi2));
652 cos3 += track->Pt()*TMath::Cos(3*PhaseShift(track->Phi()-psi3));
653 sin3 += track->Pt()*TMath::Sin(3*PhaseShift(track->Phi()-psi3));
654 }
655 fFitModulation->SetParameter(3, TMath::Sqrt(cos2*cos2+sin2*sin2)/RhoVal());
656 fFitModulation->SetParameter(4, psi2);
657 fFitModulation->SetParameter(6, psi3);
658 fFitModulation->SetParameter(7, TMath::Sqrt(cos3*cos3+sin3*sin3)/RhoVal());
659 }
38d2189d 660 default : break;
661 }
662 fHistSwap->Fit(fFitModulation, fFitModulationOptions.Data(), "", 0, TMath::TwoPi());
3531e13d 663 if(ChiSquare(fFitModulation->GetNDF(), fFitModulation->GetChisquare()) <= fMinPvalue) { // if we don't trust the fit
664 switch (fFitModulationType) {
665 case kNoFit : break; // nothing to do
666 case kUser : break; // FIXME not implemented yet
667 case kCombined : fFitModulation->SetParameter(7, 0); // no break
668 default : { // needs to be done if there was a fit
669 fFitModulation->SetParameter(3, 0);
670 fFitModulation->SetParameter(0, RhoVal());
671 } break;
672 }
673 }
38d2189d 674 for(Int_t i(0); i < fFitModulation->GetNpar(); i++) params[i] = fFitModulation->GetParameter(i);
675 // for LOCAL didactic purposes, save the best and the worst fits
676 // this routine can produce a lot of output histograms and will not work on GRID
3531e13d 677 // since the output will become unmergeable (i.e. different nodes may produce conflicting output)
38d2189d 678 switch (fRunModeType) {
38d2189d 679 case kLocal : {
680 static Int_t didacticCounterBest(0);
681 static Int_t didacticCounterWorst(0);
682 static Double_t bestFitP(.05); // threshold for significance
683 static Double_t worstFitP(.05);
684 Double_t p(ChiSquare(fFitModulation->GetNDF(), fFitModulation->GetChisquare()));
685 if(p > bestFitP || p > 0.12) {
686 TProfile* didacticProfile = (TProfile*)fHistSwap->Clone(Form("Fit_%i_p_%.3f_cen_%i_%s", didacticCounterBest, p, fInCentralitySelection, detector.Data()));
3531e13d 687 TF1* didactifFit = (TF1*)fFitModulation->Clone(Form("fit_%i_p_%.3f_cen_%i_%s", didacticCounterBest, p, fInCentralitySelection, detector.Data()));
688 didacticProfile->GetListOfFunctions()->Add(didactifFit);
38d2189d 689 fOutputListGood->Add(didacticProfile);
690 didacticCounterBest++;
691 bestFitP = p;
692 }
693 else if(p < worstFitP) {
694 TProfile* didacticProfile = (TProfile*)fHistSwap->Clone(Form("Fit_%i_p_%.3f_cen_%i_%s", didacticCounterWorst, p, fInCentralitySelection, detector.Data() ));
3531e13d 695 TF1* didactifFit = (TF1*)fFitModulation->Clone(Form("fit_%i_p_%.3f_cen_%i_%s", didacticCounterWorst, p, fInCentralitySelection, detector.Data()));
696 didacticProfile->GetListOfFunctions()->Add(didactifFit);
38d2189d 697 fOutputListBad->Add(didacticProfile);
698 didacticCounterWorst++;
699 worstFitP = p;
700 }
701 } break;
702 default : break;
703 }
704}
705//_____________________________________________________________________________
706Bool_t AliAnalysisTaskRhoVnModulation::PassesCuts(AliVEvent* event)
707{
708 // event cuts
709 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
710 if(!event) return kFALSE;
711 if(TMath::Abs(InputEvent()->GetPrimaryVertex()->GetZ()) > 10.) return kFALSE;
712 // aod and esd specific checks
713 switch (fDataType) {
714 case kESD: {
715 AliESDEvent* esdEvent = static_cast<AliESDEvent*>(InputEvent());
716 if( (!esdEvent) || (TMath::Abs(esdEvent->GetPrimaryVertexSPD()->GetZ() - esdEvent->GetPrimaryVertex()->GetZ()) > .5) ) return kFALSE;
717 } break;
718 case kAOD: {
719 AliAODEvent* aodEvent = static_cast<AliAODEvent*>(InputEvent());
720 if( (!aodEvent) || (TMath::Abs(aodEvent->GetPrimaryVertexSPD()->GetZ() - aodEvent->GetPrimaryVertex()->GetZ()) > .5) ) return kFALSE;
721 } break;
722 default: break;
723 }
724 fCent = InputEvent()->GetCentrality()->GetCentralityPercentile("V0M");
725 if(fCent <= 0 || fCent >= 100 || TMath::Abs(fCent-InputEvent()->GetCentrality()->GetCentralityPercentile("TRK")) > 5.) return kFALSE;
3531e13d 726 // determine centrality class
727 for(Int_t i(0); i < fCentralityClasses->GetSize()-1; i++) {
728 if(fCent > fCentralityClasses->At(i) && fCent < fCentralityClasses->At(1+i)) {
729 fInCentralitySelection = i;
730 break; }
731 }
38d2189d 732 if(fFillQAHistograms) FillQAHistograms(event);
733 return kTRUE;
734}
735//_____________________________________________________________________________
736Bool_t AliAnalysisTaskRhoVnModulation::PassesCuts(const AliVCluster* cluster) const
737{
738 // cluster cuts
739 if(fDebug > 1) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
740 if(!cluster) return kFALSE;
741 return kTRUE;
742}
743//_____________________________________________________________________________
38d2189d 744void AliAnalysisTaskRhoVnModulation::FillHistogramsAfterSubtraction(Double_t vzero[2][2], Double_t* tpc) const
745{
746 // fill histograms
747 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
748 FillTrackHistograms();
749 /* FillClusterHistograms(); */
750 FillJetHistograms(vzero, tpc);
751 /* FillCorrectedClusterHistograms(); */
752 FillEventPlaneHistograms(vzero, tpc);
753 FillRhoHistograms();
3531e13d 754 FillDeltaPtHistograms(tpc);
38d2189d 755 FillDeltaPhiHistograms(vzero, tpc);
756}
757//_____________________________________________________________________________
758void AliAnalysisTaskRhoVnModulation::FillTrackHistograms() const
759{
760 // fill track histograms
761 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
762 Int_t iTracks(fTracks->GetEntriesFast());
763 for(Int_t i(0); i < iTracks; i++) {
764 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(i));
765 if(!PassesCuts(track)) continue;
766 fHistPicoTrackPt[fInCentralitySelection]->Fill(track->Pt());
38d2189d 767 if(fFillQAHistograms) FillQAHistograms(track);
768 }
769 return;
770}
771//_____________________________________________________________________________
772void AliAnalysisTaskRhoVnModulation::FillClusterHistograms() const
773{
774 // fill cluster histograms
775 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
776 /* Int_t iClusters(fCaloClusters->GetEntriesFast());
777 for(Int_t i(0); i < iClusters; i++) {
778 AliVCluster* cluster = static_cast<AliVCluster*>(fCaloClusters->At(iClusters));
779 if (!PassesCuts(cluster)) continue;
780 TLorentzVector clusterLorentzVector;
781 cluster->GetMomentum(clusterLorentzVector, const_cast<Double_t*>(fVertex));
782 fHistClusterPt[fInCentralitySelection]->Fill(clusterLorentzVector.Pt());
783 fHistClusterEta[fInCentralitySelection]->Fill(clusterLorentzVector.Eta());
784 fHistClusterPhi[fInCentralitySelection]->Fill(clusterLorentzVector.Phi());
785 }
786 return; */
787}
788//_____________________________________________________________________________
789void AliAnalysisTaskRhoVnModulation::FillCorrectedClusterHistograms() const
790{
791 // fill clusters after hadronic correction FIXME implement
792 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
793 return;
794}
795//_____________________________________________________________________________
796void AliAnalysisTaskRhoVnModulation::FillEventPlaneHistograms(Double_t vzero[2][2], Double_t* tpc) const
797{
798 // fill event plane histograms
799 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
800 fHistPsi2->Fill(0.5, vzero[0][0]);
801 fHistPsi2->Fill(1.5, vzero[1][0]);
802 fHistPsi2->Fill(2.5, tpc[0]);
803 fHistPsiVZEROA->Fill(vzero[0][0]);
804 fHistPsiVZEROC->Fill(vzero[1][0]);
805 fHistPsiTPC->Fill(tpc[0]);
806 fHistPsi2Spread->Fill(0.5, vzero[0][0]-vzero[1][0]);
807 fHistPsi2Spread->Fill(1.5, vzero[0][0]-tpc[0]);
808 fHistPsi2Spread->Fill(2.5, vzero[1][0]-tpc[0]);
809 return;
810}
811//_____________________________________________________________________________
812void AliAnalysisTaskRhoVnModulation::FillRhoHistograms() const
813{
814 // fill rho histograms
815 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
816 fHistRhoPackage[fInCentralitySelection]->Fill(RhoVal()); // save the rho estimate from the emcal jet package
817 // get multiplicity FIXME inefficient
818 Int_t iTracks(fTracks->GetEntriesFast()), mult(0), iJets(fJets->GetEntriesFast());
819 for(Int_t i(0); i < iTracks; i ++) { if(PassesCuts(static_cast<AliVTrack*>(fTracks->At(i)))) mult++; }
820 Double_t rho(RhoVal(TMath::Pi(), TMath::Pi(), fRho->GetVal()));
821 fHistRho[fInCentralitySelection]->Fill(rho);
822 fHistRhoVsMult->Fill(mult, rho);
823 fHistRhoVsCent->Fill(fCent, rho);
824 for(Int_t i(0); i < iJets; i++) {
825 AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(i));
826 if(!PassesCuts(jet)) continue;
827 fHistRhoAVsMult->Fill(mult, rho * jet->Area());
828 fHistRhoAVsCent->Fill(fCent, rho * jet->Area());
829 }
830 return;
831}
832//_____________________________________________________________________________
3531e13d 833void AliAnalysisTaskRhoVnModulation::FillDeltaPtHistograms(Double_t* tpc) const
38d2189d 834{
835 // fill delta pt histograms
836 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
837 static Int_t sJets[9999] = {-1};
838 GetSortedArray(sJets, fJets);
839// if(sJets[0] <= 0) return;
840 Int_t i(0), maxCones(20);
841 AliEmcalJet* leadingJet(0x0);
842 do { // get the leading jet
843 leadingJet = static_cast<AliEmcalJet*>(fJets->At(sJets[i]));
844 i++;
845 }
846 while (!PassesCuts(leadingJet)&&i<fJets->GetEntriesFast());
847 if(!leadingJet && fDebug > 0) printf(" > failed to retrieve leading jet ! < \n");
848 const Float_t areaRC = fRandomConeRadius*fRandomConeRadius*TMath::Pi();
849 // we're retrieved the leading jet, now get a random cone
850 for(i = 0; i < maxCones; i++) {
851 Float_t pt(0), eta(0), phi(0);
852 // get a random cone without constraints on leading jet position
853 CalculateRandomCone(pt, eta, phi, 0x0);
854 if(pt > 0) {
855 fHistRCPhiEta[fInCentralitySelection]->Fill(phi, eta);
856 fHistRhoVsRCPt[fInCentralitySelection]->Fill(pt, RhoVal(phi, fJetRadius, fRho->GetVal())*areaRC);
857 fHistRCPt[fInCentralitySelection]->Fill(pt);
3531e13d 858 fHistDeltaPtDeltaPhi[fInCentralitySelection]->Fill(PhaseShift(phi-tpc[0]), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal()));
38d2189d 859 }
860 // get a random cone excluding leading jet area
861 CalculateRandomCone(pt, eta, phi, leadingJet);
862 if(pt > 0) {
863 fHistRCPhiEtaExLJ[fInCentralitySelection]->Fill(phi, eta);
864 fHistRhoVsRCPtExLJ[fInCentralitySelection]->Fill(pt, RhoVal(phi, fJetRadius, fRho->GetVal())*areaRC);
865 fHistRCPtExLJ[fInCentralitySelection]->Fill(pt);
3531e13d 866 fHistDeltaPtDeltaPhiExLJ[fInCentralitySelection]->Fill(PhaseShift(phi-tpc[0]), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal()));
38d2189d 867 }
868 // get a random cone in an event with randomized phi and eta
869 CalculateRandomCone(pt, eta, phi, 0x0, kTRUE);
870 if( pt > 0) {
871 fHistRCPhiEtaRand[fInCentralitySelection]->Fill(phi, eta);
872 fHistRhoVsRCPtRand[fInCentralitySelection]->Fill(pt, RhoVal(phi, fJetRadius, fRho->GetVal())*areaRC);
873 fHistRCPtRand[fInCentralitySelection]->Fill(pt);
3531e13d 874 fHistDeltaPtDeltaPhiRand[fInCentralitySelection]->Fill(PhaseShift(phi-tpc[0]), pt - areaRC*RhoVal(phi, fJetRadius, fRho->GetVal()));
38d2189d 875 }
876 }
877}
878//_____________________________________________________________________________
879void AliAnalysisTaskRhoVnModulation::FillJetHistograms(Double_t vzero[2][2], Double_t* tpc) const
880{
881 // fill jet histograms
882 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
883 Int_t iJets(fJets->GetEntriesFast());
884 for(Int_t i(0); i < iJets; i++) {
885 AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(i));
886 if(!PassesCuts(jet)) continue;
887 Double_t pt(jet->Pt()), area(jet->Area()), eta(jet->Eta()), phi(jet->Phi());
888 Double_t rho(RhoVal(phi, fJetRadius, fRho->GetVal()));
889 fHistJetPtRaw[fInCentralitySelection]->Fill(pt);
890 fHistJetPt[fInCentralitySelection]->Fill(pt-area*rho);
891 fHistJetEtaPhi[fInCentralitySelection]->Fill(eta, phi);
892 fHistJetPtArea[fInCentralitySelection]->Fill(pt-area*rho, area);
893 Double_t dPhiA = PhaseShift(phi-vzero[0][0]);
894 Double_t dPhiC = PhaseShift(phi-vzero[1][0]);
895 Double_t dPhiTPC = PhaseShift(phi-tpc[0]);
38d2189d 896 fHistJetPsiTPCPt[fInCentralitySelection]->Fill(dPhiTPC, pt-area*rho);
897 fHistJetPsiVZEROAPt[fInCentralitySelection]->Fill(dPhiA, pt-area*rho);
898 fHistJetPsiVZEROCPt[fInCentralitySelection]->Fill(dPhiC, pt-area*rho);
3531e13d 899 fHistJetPtConstituents[fInCentralitySelection]->Fill(pt-area*rho, jet->Nch());
b43cf414 900 fHistJetEtaRho[fInCentralitySelection]->Fill(eta, pt/area);
38d2189d 901 }
902}
903//_____________________________________________________________________________
904void AliAnalysisTaskRhoVnModulation::FillDeltaPhiHistograms(Double_t vzero[2][2], Double_t* tpc) const
905{
906 // fill phi minus psi histograms
907 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
908 if(fTracks) {
909 Int_t iTracks(fTracks->GetEntriesFast());
910 for(Int_t iTPC(0); iTPC < iTracks; iTPC++) {
911 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(iTPC));
912 if(!PassesCuts(track)) continue;
913 fHistDeltaPhiVZEROA[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-vzero[0][0]));
914 fHistDeltaPhiVZEROC[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-vzero[1][0]));
915 fHistDeltaPhiTPC[fInCentralitySelection]->Fill(PhaseShift(track->Phi()-tpc[0]));
916 }
917 }
918}
919//_____________________________________________________________________________
920void AliAnalysisTaskRhoVnModulation::FillQAHistograms(AliVTrack* vtrack) const
921{
922 // fill qa histograms for pico tracks
923 if(!vtrack) return;
924 AliPicoTrack* track = static_cast<AliPicoTrack*>(vtrack);
925 fHistRunnumbersPhi->Fill(fMappedRunNumber, track->Phi());
926 fHistRunnumbersEta->Fill(fMappedRunNumber, track->Eta());
38d2189d 927 Int_t type((int)(track->GetTrackType()));
928 switch (type) {
929 case 0:
930 fHistPicoCat1[fInCentralitySelection]->Fill(track->Eta(), track->Phi());
931 break;
932 case 1:
933 fHistPicoCat2[fInCentralitySelection]->Fill(track->Eta(), track->Phi());
934 break;
935 case 2:
936 fHistPicoCat3[fInCentralitySelection]->Fill(track->Eta(), track->Phi());
937 break;
938 default: break;
939 }
940}
941//_____________________________________________________________________________
942void AliAnalysisTaskRhoVnModulation::FillQAHistograms(AliVEvent* vevent)
943{
944 // fill qa histograms for events
945 if(!vevent) return;
946 fHistVertexz->Fill(vevent->GetPrimaryVertex()->GetZ());
947 fHistCentrality->Fill(fCent);
948 Int_t runNumber(InputEvent()->GetRunNumber());
949 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};
b43cf414 950 for(fMappedRunNumber = 0; fMappedRunNumber < 64; fMappedRunNumber++) {
38d2189d 951 if(runs[fMappedRunNumber]==runNumber) break;
952 }
953}
954//_____________________________________________________________________________
955void AliAnalysisTaskRhoVnModulation::Terminate(Option_t *)
956{
957 // terminate
958 switch (fRunModeType) {
959 case kLocal : {
960 printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
961 if(fFillQAHistograms) {
962 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};
963 for(Int_t i(0); i < 64; i++) {
964 fHistRunnumbersPhi->GetXaxis()->SetBinLabel(i+1, Form("%i", runs[i]));
965 fHistRunnumbersEta->GetXaxis()->SetBinLabel(i+1, Form("%i", runs[i]));
966 }
967 fHistRunnumbersPhi->GetXaxis()->SetBinLabel(65, "undetermined");
968 fHistRunnumbersEta->GetXaxis()->SetBinLabel(65, "undetermined");
969 }
970 AliAnalysisTaskRhoVnModulation::Dump();
971 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));
972 } break;
973 default : break;
974 }
975}
976//_____________________________________________________________________________