]>
Commit | Line | Data |
---|---|---|
489d5531 | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in 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. * | |
83bc3e95 | 14 | **************************************************************************/ |
15 | ||
489d5531 | 16 | /* $Id$ */ |
17 | ||
83bc3e95 | 18 | /*************************************************************** |
19 | * Only in this class nested loops are used for flow analysis. * | |
20 | * Nested loops are used to evaluate: * | |
21 | * * | |
5c078806 | 22 | * a) Distribution of relative angle difference (phi1-phi2); * |
23 | * b) Cross-check the results for mixed harmonics. * | |
83bc3e95 | 24 | * * |
25 | * Author: Ante Bilandzic (abilandzic@gmail.com) * | |
489d5531 | 26 | ***************************************************************/ |
27 | ||
28 | #define AliFlowAnalysisWithNestedLoops_cxx | |
29 | ||
30 | #include "Riostream.h" | |
31 | #include "AliFlowCommonConstants.h" | |
32 | #include "AliFlowCommonHist.h" | |
33 | #include "AliFlowCommonHistResults.h" | |
34 | ||
35 | #include "TMath.h" | |
36 | #include "TFile.h" | |
37 | #include "TList.h" | |
38 | #include "TProfile.h" | |
39 | ||
40 | #include "AliFlowEventSimple.h" | |
41 | #include "AliFlowTrackSimple.h" | |
42 | #include "AliFlowAnalysisWithNestedLoops.h" | |
43 | ||
44 | class TH1; | |
ecac11c2 | 45 | class TList; |
489d5531 | 46 | ClassImp(AliFlowAnalysisWithNestedLoops) |
47 | ||
83bc3e95 | 48 | //================================================================================================================ |
49 | ||
489d5531 | 50 | AliFlowAnalysisWithNestedLoops::AliFlowAnalysisWithNestedLoops(): |
83bc3e95 | 51 | fHistList(NULL), |
489d5531 | 52 | fHistListName(NULL), |
83bc3e95 | 53 | fAnalysisLabel(NULL), |
489d5531 | 54 | fAnalysisSettings(NULL), |
5c078806 | 55 | fPrintOnTheScreen(kTRUE), |
83bc3e95 | 56 | fCommonHists(NULL), |
489d5531 | 57 | fnBinsPhi(0), |
58 | fPhiMin(0), | |
59 | fPhiMax(0), | |
60 | fPhiBinWidth(0), | |
61 | fnBinsPt(0), | |
62 | fPtMin(0), | |
63 | fPtMax(0), | |
64 | fPtBinWidth(0), | |
65 | fnBinsEta(0), | |
66 | fEtaMin(0), | |
67 | fEtaMax(0), | |
83bc3e95 | 68 | fEtaBinWidth(0), |
489d5531 | 69 | fWeightsList(NULL), |
70 | fUsePhiWeights(kFALSE), | |
71 | fUsePtWeights(kFALSE), | |
72 | fUseEtaWeights(kFALSE), | |
73 | fUseParticleWeights(NULL), | |
74 | fPhiWeights(NULL), | |
75 | fPtWeights(NULL), | |
83bc3e95 | 76 | fEtaWeights(NULL), |
5c078806 | 77 | fListRAD(NULL), |
78 | fEvaluateNestedLoopsForRAD(kTRUE), | |
79 | fRelativeAngleDistribution(NULL), | |
80 | fListMH(NULL), | |
81 | fEvaluateNestedLoopsForMH(kFALSE), | |
82 | fCorrelatorIntegerMH(1), | |
83 | fCrossCheckInPtSumBinNo(4), | |
84 | fCrossCheckInPtDiffBinNo(5) | |
489d5531 | 85 | { |
86 | // Constructor. | |
5c078806 | 87 | |
88 | // Base list to hold all output objects: | |
83bc3e95 | 89 | fHistList = new TList(); |
489d5531 | 90 | fHistListName = new TString("cobjNL"); |
91 | fHistList->SetName(fHistListName->Data()); | |
83bc3e95 | 92 | fHistList->SetOwner(kTRUE); |
93 | ||
489d5531 | 94 | // List to hold histograms with phi, pt and eta weights: |
83bc3e95 | 95 | fWeightsList = new TList(); |
96 | ||
5c078806 | 97 | // List to hold objects relevant for relative angle distributions: |
98 | fListRAD = new TList(); | |
99 | ||
100 | // List holding objects relevant for debugging and cross-checking of MH class: | |
101 | fListMH = new TList(); | |
102 | ||
103 | // Initialize all arrays: | |
104 | this->InitializeArraysForMH(); | |
489d5531 | 105 | |
106 | } // AliFlowAnalysisWithNestedLoops::AliFlowAnalysisWithNestedLoops() | |
107 | ||
108 | //================================================================================================================ | |
109 | ||
110 | AliFlowAnalysisWithNestedLoops::~AliFlowAnalysisWithNestedLoops() | |
111 | { | |
112 | // Destructor. | |
113 | ||
114 | delete fHistList; | |
115 | ||
116 | } // end of AliFlowAnalysisWithNestedLoops::~AliFlowAnalysisWithNestedLoops() | |
117 | ||
118 | //================================================================================================================ | |
119 | ||
120 | void AliFlowAnalysisWithNestedLoops::Init() | |
83bc3e95 | 121 | { |
122 | // Initialize and book all objects. | |
123 | ||
124 | // a) Cross check if the user settings make sense before starting; | |
125 | // b) Access all common constants; | |
126 | // c) Book and nest all lists in the base list fHistList; | |
489d5531 | 127 | // d) Book profile holding seetings for analysis with nested loops; |
83bc3e95 | 128 | // e) Book common control histograms; |
129 | // f) Book all objects relevant for distributions; | |
130 | // g) Book and fill histograms to hold phi, pt and eta weights. | |
489d5531 | 131 | |
132 | //save old value and prevent histograms from being added to directory | |
133 | //to avoid name clashes in case multiple analaysis objects are used | |
134 | //in an analysis | |
135 | Bool_t oldHistAddStatus = TH1::AddDirectoryStatus(); | |
136 | TH1::AddDirectory(kFALSE); | |
5c078806 | 137 | |
138 | TH1::SetDefaultSumw2(); | |
489d5531 | 139 | |
140 | this->CrossCheckSettings(); | |
83bc3e95 | 141 | this->AccessConstants(); |
142 | this->BookAndNestAllLists(); | |
5c078806 | 143 | this->BookAndFillProfileHoldingSettings(); |
83bc3e95 | 144 | this->BookCommonHistograms(); |
5c078806 | 145 | this->BookEverythingForRAD(); |
146 | this->BookEverythingForMH(); | |
489d5531 | 147 | this->BookAndFillWeightsHistograms(); |
148 | ||
149 | //restore old status | |
150 | TH1::AddDirectory(oldHistAddStatus); | |
151 | } // end of void AliFlowAnalysisWithNestedLoops::Init() | |
152 | ||
153 | //================================================================================================================ | |
154 | ||
155 | void AliFlowAnalysisWithNestedLoops::Make(AliFlowEventSimple* anEvent) | |
156 | { | |
157 | // Running over data only in this method. | |
83bc3e95 | 158 | |
5c078806 | 159 | // a) Check all pointers used in this method; |
160 | // b) Fill common control histograms; | |
161 | // c) Evaluate nested loops for relative angle distribution; | |
162 | // d) Evaluate nested loops for mixed harmonics. | |
83bc3e95 | 163 | |
83bc3e95 | 164 | this->CheckPointersUsedInMake(); |
83bc3e95 | 165 | fCommonHists->FillControlHistograms(anEvent); |
5c078806 | 166 | if(fEvaluateNestedLoopsForRAD) this->EvaluateNestedLoopsForRAD(anEvent); |
167 | if(fEvaluateNestedLoopsForMH) this->EvaluateNestedLoopsForMH(anEvent); | |
489d5531 | 168 | |
ecac11c2 | 169 | } // end of AliFlowAnalysisWithNestedLoops::Make(AliFlowEventSimple* anEvent) |
5c078806 | 170 | |
489d5531 | 171 | //================================================================================================================ |
172 | ||
173 | void AliFlowAnalysisWithNestedLoops::Finish() | |
174 | { | |
83bc3e95 | 175 | // Calculate the final results. |
176 | ||
177 | // a) Check all pointers used in this method; | |
178 | // b) Access settings for analysis with mixed harmonics; | |
5c078806 | 179 | // c) Print on the screen. |
83bc3e95 | 180 | |
181 | this->CheckPointersUsedInFinish(); | |
489d5531 | 182 | this->AccessSettings(); |
5c078806 | 183 | if(fPrintOnTheScreen) this->PrintOnTheScreen(); |
489d5531 | 184 | |
185 | } // end of AliFlowAnalysisWithNestedLoops::Finish() | |
186 | ||
187 | //================================================================================================================ | |
188 | ||
189 | void AliFlowAnalysisWithNestedLoops::GetOutputHistograms(TList *outputListHistos) | |
190 | { | |
83bc3e95 | 191 | // Get pointers to all objects saved in the output file. |
192 | ||
ecac11c2 | 193 | // a) Get pointers for common control histograms. |
489d5531 | 194 | if(outputListHistos) |
195 | { | |
83bc3e95 | 196 | this->SetHistList(outputListHistos); |
197 | if(!fHistList) | |
198 | { | |
199 | cout<<endl; | |
200 | cout<<" WARNING (NL): fHistList is NULL in AFAWNL::GOH() !!!!"<<endl; | |
201 | cout<<endl; | |
202 | exit(0); | |
203 | } | |
5c078806 | 204 | this->GetPointersForBaseHistograms(); |
83bc3e95 | 205 | this->GetPointersForCommonHistograms(); |
5c078806 | 206 | Bool_t bEvaluateNestedLoopsForRAD = (Bool_t) fAnalysisSettings->GetBinContent(1); // to be improved (not needed here?) |
207 | Bool_t bEvaluateNestedLoopsForMH = (Bool_t) fAnalysisSettings->GetBinContent(2); // to be improved (not needed here?) | |
208 | if(bEvaluateNestedLoopsForRAD) this->GetPointersForRAD(); | |
209 | if(bEvaluateNestedLoopsForMH) this->GetPointersForMH(); | |
83bc3e95 | 210 | } else |
211 | { | |
212 | cout<<endl; | |
213 | cout<<" WARNING (NL): outputListHistos is NULL in AFAWNL::GOH() !!!!"<<endl; | |
214 | cout<<endl; | |
215 | exit(0); | |
216 | } | |
489d5531 | 217 | |
218 | } // end of void AliFlowAnalysisWithNestedLoops::GetOutputHistograms(TList *outputListHistos) | |
219 | ||
83bc3e95 | 220 | //================================================================================================================ |
221 | ||
5c078806 | 222 | void AliFlowAnalysisWithNestedLoops::GetPointersForBaseHistograms() |
223 | { | |
224 | // Get pointers to base histograms. | |
225 | ||
226 | TString analysisSettingsName = "fAnalysisSettings"; | |
227 | TProfile *analysisSettings = dynamic_cast<TProfile*>(fHistList->FindObject(analysisSettingsName.Data())); | |
228 | if(analysisSettings) | |
229 | { | |
230 | this->SetAnalysisSettings(analysisSettings); | |
231 | } else | |
232 | { | |
233 | cout<<endl; | |
234 | cout<<" WARNING (NL): analysisSettings is NULL in AFAWNL::GPFBH() !!!!"<<endl; | |
235 | cout<<endl; | |
236 | exit(0); | |
237 | } | |
238 | ||
239 | } // end of void AliFlowAnalysisWithNestedLoops::GetPointersForBaseHistograms() | |
240 | ||
241 | //================================================================================================================ | |
242 | ||
489d5531 | 243 | void AliFlowAnalysisWithNestedLoops::GetPointersForCommonHistograms() |
244 | { | |
245 | // Get pointers to common control histograms. | |
246 | ||
247 | TString commonHistsName = "AliFlowCommonHistNL"; | |
248 | AliFlowCommonHist *commonHist = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHistsName.Data())); | |
83bc3e95 | 249 | if(commonHist) |
250 | { | |
251 | this->SetCommonHists(commonHist); | |
252 | } else | |
253 | { | |
254 | cout<<endl; | |
255 | cout<<" WARNING (NL): commonHist is NULL in AFAWNL::GPFCH() !!!!"<<endl; | |
256 | cout<<endl; | |
257 | exit(0); | |
258 | } | |
259 | ||
260 | } // end of void AliFlowAnalysisWithNestedLoops::GetPointersForCommonHistograms() | |
261 | ||
262 | //================================================================================================================ | |
263 | ||
5c078806 | 264 | void AliFlowAnalysisWithNestedLoops::GetPointersForRAD() |
489d5531 | 265 | { |
5c078806 | 266 | // Get pointers to objects relevant for relative angle distributions. |
489d5531 | 267 | |
5c078806 | 268 | TList *listRAD = NULL; |
269 | listRAD = dynamic_cast<TList*>(fHistList->FindObject("Relative Angle Distribution")); | |
270 | if(!listRAD) | |
489d5531 | 271 | { |
5c078806 | 272 | cout<<"WARNING: listRAD is NULL in AFAWNL::GPFRAD() !!!!"<<endl; |
489d5531 | 273 | exit(0); |
83bc3e95 | 274 | } |
5c078806 | 275 | |
489d5531 | 276 | TString relativeAngleDistributionName = "fRelativeAngleDistribution"; |
5c078806 | 277 | TH1D *relativeAngleDistribution = dynamic_cast<TH1D*>(listRAD->FindObject(relativeAngleDistributionName.Data())); |
489d5531 | 278 | if(relativeAngleDistribution) |
279 | { | |
280 | this->SetRelativeAngleDistribution(relativeAngleDistribution); | |
83bc3e95 | 281 | } |
282 | ||
5c078806 | 283 | } // end of void AliFlowAnalysisWithNestedLoops::GetPointersForRAD() |
284 | ||
285 | //================================================================================================================ | |
286 | ||
287 | void AliFlowAnalysisWithNestedLoops::GetPointersForMH() | |
288 | { | |
289 | // Get pointers to objects evaluated with nested loops. | |
290 | ||
291 | TList *listMH = NULL; | |
292 | listMH = dynamic_cast<TList*>(fHistList->FindObject("Mixed Harmonics")); | |
293 | if(!listMH) | |
294 | { | |
295 | cout<<"WARNING: listMH is NULL in AFAWNL::GPFMH() !!!!"<<endl; | |
296 | exit(0); | |
297 | } | |
298 | ||
299 | TString psdFlag[2] = {"PtSum","PtDiff"}; | |
300 | for(Int_t sd=0;sd<2;sd++) | |
301 | { | |
302 | TProfile *p3pCorrelatorVsPtSumDiffDirectPro = dynamic_cast<TProfile*>(listMH->FindObject(Form("f3pCorrelatorDirectVs%s",psdFlag[sd].Data()))); | |
303 | if(p3pCorrelatorVsPtSumDiffDirectPro) | |
304 | { | |
305 | this->Set3pCorrelatorVsPtSumDiffDirectPro(p3pCorrelatorVsPtSumDiffDirectPro,sd); | |
306 | } | |
307 | } // end of for(Int_t sd=0;sd<2;sd++) | |
308 | ||
309 | } // end of void AliFlowAnalysisWithNestedLoops::GetPointersForMH() | |
489d5531 | 310 | |
83bc3e95 | 311 | //================================================================================================================ |
312 | ||
489d5531 | 313 | void AliFlowAnalysisWithNestedLoops::WriteHistograms(TString outputFileName) |
314 | { | |
315 | // Store the final results in output .root file. | |
316 | TFile *output = new TFile(outputFileName.Data(),"RECREATE"); | |
317 | fHistList->Write(fHistList->GetName(),TObject::kSingleKey); | |
318 | delete output; | |
319 | } | |
320 | ||
321 | //================================================================================================================ | |
83bc3e95 | 322 | |
323 | void AliFlowAnalysisWithNestedLoops::WriteHistograms(TDirectoryFile *outputFileName) | |
324 | { | |
325 | // Store the final results in output .root file. | |
326 | fHistList->SetName("cobjNL"); | |
327 | fHistList->SetOwner(kTRUE); | |
328 | outputFileName->Add(fHistList); | |
329 | outputFileName->Write(outputFileName->GetName(),TObject::kSingleKey); | |
330 | } | |
331 | ||
332 | //================================================================================================================ | |
333 | ||
489d5531 | 334 | void AliFlowAnalysisWithNestedLoops::BookAndNestAllLists() |
83bc3e95 | 335 | { |
336 | // Book and nest all list in base list fHistList. | |
337 | ||
338 | // Weights: | |
489d5531 | 339 | fWeightsList->SetName("Weights"); |
340 | fWeightsList->SetOwner(kTRUE); | |
83bc3e95 | 341 | fHistList->Add(fWeightsList); |
5c078806 | 342 | // List for Relative Angle Distribution: |
343 | fListRAD->SetName("Relative Angle Distribution"); | |
344 | fListRAD->SetOwner(kTRUE); | |
345 | if(fEvaluateNestedLoopsForRAD) fHistList->Add(fListRAD); | |
346 | // List for Mixed Harmonics: | |
347 | fListMH->SetName("Mixed Harmonics"); | |
348 | fListMH->SetOwner(kTRUE); | |
349 | if(fEvaluateNestedLoopsForMH) fHistList->Add(fListMH); | |
83bc3e95 | 350 | |
351 | } // end of void AliFlowAnalysisWithNestedLoops::BookAndNestAllLists() | |
352 | ||
353 | //================================================================================================================ | |
354 | ||
5c078806 | 355 | void AliFlowAnalysisWithNestedLoops::BookAndFillProfileHoldingSettings() |
83bc3e95 | 356 | { |
357 | // Book profile to hold all analysis settings. | |
358 | ||
489d5531 | 359 | TString analysisSettingsName = "fAnalysisSettings"; |
5c078806 | 360 | fAnalysisSettings = new TProfile(analysisSettingsName.Data(),"Settings for analysis with nested loops",6,0,6); |
361 | fAnalysisSettings->GetXaxis()->SetLabelSize(0.035); | |
362 | fAnalysisSettings->GetXaxis()->SetBinLabel(1,"Nested loops for RAD?"); | |
363 | fAnalysisSettings->Fill(0.5,(Int_t)fEvaluateNestedLoopsForRAD); | |
364 | fAnalysisSettings->GetXaxis()->SetBinLabel(2,"Nested loops for MH?"); | |
365 | fAnalysisSettings->Fill(1.5,(Int_t)fEvaluateNestedLoopsForMH); | |
366 | fAnalysisSettings->GetXaxis()->SetBinLabel(3,"Integer n in cos(n(2#phi_{1}-#psi_{2}-#psi_{3}))"); | |
367 | fAnalysisSettings->Fill(2.5,(Int_t)fCorrelatorIntegerMH); | |
368 | fAnalysisSettings->GetXaxis()->SetBinLabel(4,"Print on the screen?"); | |
369 | fAnalysisSettings->Fill(3.5,(Int_t)fPrintOnTheScreen); | |
370 | fAnalysisSettings->GetXaxis()->SetBinLabel(5,"fCrossCheckInPtSumBinNo"); | |
371 | fAnalysisSettings->Fill(4.5,fCrossCheckInPtSumBinNo); | |
372 | fAnalysisSettings->GetXaxis()->SetBinLabel(6,"fCrossCheckInPtDiffBinNo"); | |
373 | fAnalysisSettings->Fill(5.5,fCrossCheckInPtDiffBinNo); | |
83bc3e95 | 374 | fHistList->Add(fAnalysisSettings); |
375 | ||
5c078806 | 376 | } // end of void AliFlowAnalysisWithNestedLoops::BookAndFillProfileHoldingSettings() |
489d5531 | 377 | |
83bc3e95 | 378 | //================================================================================================================ |
379 | ||
489d5531 | 380 | void AliFlowAnalysisWithNestedLoops::BookCommonHistograms() |
381 | { | |
83bc3e95 | 382 | // Book common control histograms and common histograms for final results. |
489d5531 | 383 | |
384 | TString commonHistsName = "AliFlowCommonHistNL"; | |
385 | fCommonHists = new AliFlowCommonHist(commonHistsName.Data()); | |
386 | fHistList->Add(fCommonHists); | |
387 | ||
388 | } // end of void AliFlowAnalysisWithNestedLoops::BookCommonHistograms() | |
83bc3e95 | 389 | |
390 | //================================================================================================================ | |
391 | ||
5c078806 | 392 | void AliFlowAnalysisWithNestedLoops::BookEverythingForRAD() |
489d5531 | 393 | { |
5c078806 | 394 | // Book all objects relevant calculation of relative angle distribution. |
83bc3e95 | 395 | |
489d5531 | 396 | TString relativeAngleDistributionName = "fRelativeAngleDistribution"; |
83bc3e95 | 397 | fRelativeAngleDistribution = new TH1D(relativeAngleDistributionName.Data(),"Relative angle distribution",720,-TMath::TwoPi(),TMath::TwoPi()); |
398 | fRelativeAngleDistribution->GetYaxis()->SetTitle("#frac{dN}{#Delta #phi}"); | |
399 | fRelativeAngleDistribution->GetXaxis()->SetTitle("#Delta #phi"); | |
5c078806 | 400 | fListRAD->Add(fRelativeAngleDistribution); |
83bc3e95 | 401 | |
5c078806 | 402 | } // end fo void AliFlowAnalysisWithNestedLoops::BookEverythingForRAD() |
489d5531 | 403 | |
83bc3e95 | 404 | //================================================================================================================ |
405 | ||
489d5531 | 406 | void AliFlowAnalysisWithNestedLoops::AccessConstants() |
407 | { | |
408 | // Access needed common constants from AliFlowCommonConstants. | |
409 | ||
410 | fnBinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi(); | |
411 | fPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin(); | |
412 | fPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax(); | |
413 | if(fnBinsPhi) fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi; | |
414 | fnBinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt(); | |
415 | fPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin(); | |
416 | fPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax(); | |
417 | if(fnBinsPt) fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt; | |
418 | fnBinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta(); | |
419 | fEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin(); | |
420 | fEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax(); | |
421 | if(fnBinsEta) fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta; | |
422 | ||
83bc3e95 | 423 | } // end of void AliFlowAnalysisWithNestedLoops::AccessConstants() |
424 | ||
489d5531 | 425 | //================================================================================================================ |
426 | ||
427 | void AliFlowAnalysisWithNestedLoops::CrossCheckSettings() | |
428 | { | |
429 | // Cross-check if the user settings make sense. | |
430 | ||
431 | } // end of void AliFlowAnalysisWithNestedLoops::CrossCheckSettings() | |
432 | ||
433 | //================================================================================================================ | |
434 | ||
435 | void AliFlowAnalysisWithNestedLoops::BookAndFillWeightsHistograms() | |
436 | { | |
437 | // Book and fill (by accessing file "weights.root") histograms which hold phi, pt and eta weights. | |
438 | ||
439 | if(!fWeightsList) | |
440 | { | |
441 | cout<<"WARNING: fWeightsList is NULL in AFAWNL::BAFWH() !!!!"<<endl; | |
442 | exit(0); | |
443 | } | |
444 | // Profile to hold flags for weights: | |
445 | TString fUseParticleWeightsName = "fUseParticleWeightsNL"; | |
446 | fUseParticleWeights = new TProfile(fUseParticleWeightsName.Data(),"0 = particle weight not used, 1 = particle weight used ",3,0,3); | |
447 | fUseParticleWeights->SetLabelSize(0.06); | |
448 | (fUseParticleWeights->GetXaxis())->SetBinLabel(1,"w_{#phi}"); | |
449 | (fUseParticleWeights->GetXaxis())->SetBinLabel(2,"w_{p_{T}}"); | |
450 | (fUseParticleWeights->GetXaxis())->SetBinLabel(3,"w_{#eta}"); | |
451 | fUseParticleWeights->Fill(0.5,(Int_t)fUsePhiWeights); | |
452 | fUseParticleWeights->Fill(1.5,(Int_t)fUsePtWeights); | |
453 | fUseParticleWeights->Fill(2.5,(Int_t)fUseEtaWeights); | |
454 | fWeightsList->Add(fUseParticleWeights); | |
455 | // Phi-weights: | |
456 | if(fUsePhiWeights) | |
457 | { | |
458 | if(fWeightsList->FindObject("phi_weights")) | |
459 | { | |
460 | fPhiWeights = dynamic_cast<TH1F*>(fWeightsList->FindObject("phi_weights")); | |
461 | if(TMath::Abs(fPhiWeights->GetBinWidth(1)-fPhiBinWidth)>pow(10.,-6.)) | |
462 | { | |
83bc3e95 | 463 | cout<<endl; |
489d5531 | 464 | cout<<"WARNING (NL): Inconsistent binning in histograms for phi-weights throughout the code."<<endl; |
83bc3e95 | 465 | cout<<endl; |
489d5531 | 466 | exit(0); |
467 | } | |
468 | } else | |
469 | { | |
470 | cout<<"WARNING (NL): fWeightsList->FindObject(\"phi_weights\") is NULL in AFAWNL::BAFWH() !!!!"<<endl; | |
471 | exit(0); | |
472 | } | |
473 | } // end of if(fUsePhiWeights) | |
474 | // Pt-weights: | |
475 | if(fUsePtWeights) | |
476 | { | |
477 | if(fWeightsList->FindObject("pt_weights")) | |
478 | { | |
479 | fPtWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("pt_weights")); | |
480 | if(TMath::Abs(fPtWeights->GetBinWidth(1)-fPtBinWidth)>pow(10.,-6.)) | |
481 | { | |
83bc3e95 | 482 | cout<<endl; |
489d5531 | 483 | cout<<"WARNING (NL): Inconsistent binning in histograms for pt-weights throughout the code."<<endl; |
83bc3e95 | 484 | cout<<endl; |
489d5531 | 485 | exit(0); |
486 | } | |
487 | } else | |
488 | { | |
489 | cout<<"WARNING (NL): fWeightsList->FindObject(\"pt_weights\") is NULL in AFAWNL::BAFWH() !!!!"<<endl; | |
490 | exit(0); | |
491 | } | |
492 | } // end of if(fUsePtWeights) | |
493 | // Eta-weights: | |
494 | if(fUseEtaWeights) | |
495 | { | |
496 | if(fWeightsList->FindObject("eta_weights")) | |
497 | { | |
498 | fEtaWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("eta_weights")); | |
499 | if(TMath::Abs(fEtaWeights->GetBinWidth(1)-fEtaBinWidth)>pow(10.,-6.)) | |
500 | { | |
83bc3e95 | 501 | cout<<endl; |
489d5531 | 502 | cout<<"WARNING (NL): Inconsistent binning in histograms for eta-weights throughout the code."<<endl; |
83bc3e95 | 503 | cout<<endl; |
489d5531 | 504 | exit(0); |
505 | } | |
506 | } else | |
507 | { | |
508 | cout<<"WARNING: fUseEtaWeights && fWeightsList->FindObject(\"eta_weights\") is NULL in AFAWNL::BAFWH() !!!!"<<endl; | |
509 | exit(0); | |
510 | } | |
511 | } // end of if(fUseEtaWeights) | |
512 | ||
83bc3e95 | 513 | } // end of AliFlowAnalysisWithNestedLoops::BookAndFillWeightsHistograms() |
514 | ||
515 | //================================================================================================================ | |
489d5531 | 516 | |
517 | void AliFlowAnalysisWithNestedLoops::CheckPointersUsedInMake() | |
518 | { | |
519 | // Check pointers used in method Make(). | |
83bc3e95 | 520 | |
5c078806 | 521 | if(fEvaluateNestedLoopsForRAD) CheckPointersForRAD("Make"); |
522 | if(fEvaluateNestedLoopsForMH) CheckPointersForMH("Make"); | |
489d5531 | 523 | |
83bc3e95 | 524 | } // end of AliFlowAnalysisWithNestedLoops::CheckPointersUsedInMake() |
525 | ||
526 | //================================================================================================================ | |
489d5531 | 527 | |
528 | void AliFlowAnalysisWithNestedLoops::CheckPointersUsedInFinish() | |
529 | { | |
83bc3e95 | 530 | // Check pointers used in method Finish(). |
5c078806 | 531 | |
532 | if(fEvaluateNestedLoopsForRAD) CheckPointersForRAD("Finish"); | |
533 | if(fEvaluateNestedLoopsForMH) CheckPointersForMH("Finish"); | |
489d5531 | 534 | |
535 | } // end of AliFlowAnalysisWithNestedLoops::CheckPointersUsedInFinish() | |
83bc3e95 | 536 | |
537 | //================================================================================================================ | |
489d5531 | 538 | |
5c078806 | 539 | void AliFlowAnalysisWithNestedLoops::CheckPointersForRAD(TString where) |
540 | { | |
541 | // Check pointers relevant for calculation of relative angle distribution. | |
542 | ||
543 | if(!fRelativeAngleDistribution) | |
544 | { | |
545 | cout<<endl; | |
546 | cout<<" WARNING (NL): !fRelativeAngleDistribution is NULL in "<<where.Data()<<"() !!!!"<<endl; | |
547 | cout<<endl; | |
548 | exit(0); | |
549 | } | |
550 | ||
551 | if(strcmp(where.Data(),"Make") == 0) | |
552 | { | |
553 | // Check pointers used only in method Make(): | |
554 | // ... | |
555 | } | |
556 | else if(strcmp(where.Data(),"Finish") == 0) | |
557 | { | |
558 | // Check pointers used only in method Finish(): | |
559 | // ... | |
560 | } | |
561 | ||
562 | } // end of void AliFlowAnalysisWithNestedLoops::CheckPointersForRAD(TString where) | |
563 | ||
564 | //================================================================================================================ | |
565 | ||
566 | void AliFlowAnalysisWithNestedLoops::CheckPointersForMH(TString where) | |
567 | { | |
568 | // Check pointers relevant for calculation of mixed harmonics. | |
569 | ||
570 | for(Int_t sd=0;sd<2;sd++) | |
571 | { | |
572 | if(!(f3pCorrelatorVsPtSumDiffDirectPro[sd])) | |
573 | { | |
574 | cout<<endl; | |
575 | cout<<" WARNING (NL): !"<<Form("f3pCorrelatorVsPtSumDiffDirectPro[%d]",sd)<<" is NULL in "<<where.Data()<<"() !!!!"<<endl; | |
576 | cout<<endl; | |
577 | exit(0); | |
578 | } | |
579 | } | |
580 | ||
581 | if(strcmp(where.Data(),"Make") == 0) | |
582 | { | |
583 | // Check pointers used only in method Make(): | |
584 | // ... | |
585 | } | |
586 | else if(strcmp(where.Data(),"Finish") == 0) | |
587 | { | |
588 | // Check pointers used only in method Finish(): | |
589 | // ... | |
590 | } | |
591 | ||
592 | } // end of void AliFlowAnalysisWithNestedLoops::CheckPointersForMH(TString where) | |
593 | ||
594 | //================================================================================================================ | |
595 | ||
489d5531 | 596 | void AliFlowAnalysisWithNestedLoops::AccessSettings() |
597 | { | |
5c078806 | 598 | // Access the settings for analysis. |
599 | ||
600 | fEvaluateNestedLoopsForRAD = (Bool_t)fAnalysisSettings->GetBinContent(1); | |
601 | fEvaluateNestedLoopsForMH = (Bool_t)fAnalysisSettings->GetBinContent(2); | |
602 | fCorrelatorIntegerMH = (Int_t)fAnalysisSettings->GetBinContent(3); | |
603 | fPrintOnTheScreen = (Bool_t)fAnalysisSettings->GetBinContent(4); | |
604 | fCrossCheckInPtSumBinNo = (Int_t)fAnalysisSettings->GetBinContent(5); | |
605 | fCrossCheckInPtDiffBinNo = (Int_t)fAnalysisSettings->GetBinContent(6); | |
489d5531 | 606 | |
83bc3e95 | 607 | } // end of AliFlowAnalysisWithNestedLoops::AccessSettings() |
608 | ||
609 | //================================================================================================================ | |
5c078806 | 610 | |
611 | void AliFlowAnalysisWithNestedLoops::InitializeArraysForMH() | |
612 | { | |
613 | // Initialize arrays mixed harmonics calculations. | |
614 | ||
615 | for(Int_t sd=0;sd<2;sd++) // sum or difference | |
616 | { | |
617 | f3pCorrelatorVsPtSumDiffDirectPro[sd] = NULL; | |
618 | } | |
619 | ||
620 | } // end of AliFlowAnalysisWithNestedLoops::InitializeArraysForMH() | |
621 | ||
622 | //================================================================================================================ | |
623 | ||
624 | void AliFlowAnalysisWithNestedLoops::BookEverythingForMH() | |
625 | { | |
626 | // Book all objects relevant for mixed harmonics. | |
627 | ||
628 | if(fEvaluateNestedLoopsForMH) | |
629 | { | |
630 | TString psdFlag[2] = {"PtSum","PtDiff"}; | |
631 | TString psdTitleFlag[2] = {"(p_{t,1}+p_{t,2})/2","#left|p_{t,1}-p_{t,2}#right|"}; | |
632 | //TString s3pCorrelatorVsPtSumDiffDirectProName = "f3pCorrelatorVsPtSumDiffDirectPro"; | |
633 | for(Int_t sd=0;sd<2;sd++) | |
634 | { | |
635 | // to be improved: hardwired ,fnBinsPt,0.,fPtMax): | |
636 | f3pCorrelatorVsPtSumDiffDirectPro[sd] = new TProfile(Form("f3pCorrelatorDirectVs%s",psdFlag[sd].Data()),"",fnBinsPt,0.,fPtMax); | |
637 | //f3pCorrelatorVsPtSumDiffDirectPro[sd]->SetLabelSize(0.05); | |
638 | //f3pCorrelatorVsPtSumDiffDirectPro[sd]->SetMarkerStyle(25); | |
639 | f3pCorrelatorVsPtSumDiffDirectPro[sd]->GetXaxis()->SetTitle(psdTitleFlag[sd].Data()); | |
640 | fListMH->Add(f3pCorrelatorVsPtSumDiffDirectPro[sd]); | |
641 | } | |
642 | } // end of if(fEvaluateNestedLoopsForMH) | |
643 | ||
644 | } // end of AliFlowAnalysisWithNestedLoops::BookEverythingForMH() | |
645 | ||
646 | //================================================================================================================ | |
647 | ||
648 | void AliFlowAnalysisWithNestedLoops::EvaluateNestedLoopsForRAD(AliFlowEventSimple *anEvent) | |
649 | { | |
650 | // Evaluate nested loops needed for calculation of relative angle distribution. | |
651 | ||
652 | Double_t dPhi1=0., dPhi2=0.; // azimuthal angles in the laboratory frame | |
653 | AliFlowTrackSimple *aftsTrack = NULL; // simple track | |
654 | ||
655 | // Loop over data and store for each distinct pair phi1-phi2 in fRelativeAngleDistribution: | |
656 | Int_t nPrim = anEvent->NumberOfTracks(); // nPrim = total number of primary tracks, i.e. nPrim = nRP + nPOI + rest, where: | |
657 | // nRP = # of particles used to determine the reaction plane ("Reference Particles"); | |
658 | // nPOI = # of particles of interest for a detailed flow analysis ("Particles of Interest"); | |
659 | // rest = # of particles which are not niether RPs nor POIs. | |
660 | // Start nested loops over data: | |
661 | for(Int_t i=0;i<nPrim;i++) | |
662 | { | |
663 | aftsTrack=anEvent->GetTrack(i); | |
664 | if(aftsTrack) | |
665 | { | |
666 | if(!aftsTrack->InRPSelection()) continue; // consider only tracks which are RPs | |
667 | dPhi1 = aftsTrack->Phi(); | |
668 | for(Int_t j=0;j<nPrim;j++) | |
669 | { | |
670 | if(j==i) continue; // eliminating trivial contribution from autocorrelation | |
671 | aftsTrack=anEvent->GetTrack(j); | |
672 | if(aftsTrack) | |
673 | { | |
674 | if(!aftsTrack->InRPSelection()) continue; // consider only tracks which are RPs | |
675 | dPhi2 = aftsTrack->Phi(); | |
676 | // Fill the histogram: | |
677 | fRelativeAngleDistribution->Fill(dPhi1-dPhi2); | |
678 | } | |
679 | } // end of for(Int_t j=0;j<nPrim;j++) | |
680 | } else // to if(aftsTrack) | |
681 | { | |
682 | cout<<endl; | |
683 | cout<<" WARNING (NL): No particle! (i.e. aftsTrack is a NULL pointer in AFAWNL::Make().)"<<endl; | |
684 | cout<<endl; | |
685 | } | |
686 | } // end of for(Int_t i=0;i<nPrim;i++) | |
687 | ||
688 | } // end of void AliFlowAnalysisWithNestedLoops::EvaluateNestedLoopsForRAD(AliFlowEventSimple *anEvent) | |
689 | ||
690 | //================================================================================================================ | |
691 | ||
692 | void AliFlowAnalysisWithNestedLoops::EvaluateNestedLoopsForMH(AliFlowEventSimple *anEvent) | |
693 | { | |
694 | // Evaluate nested loops needed for calculation of mixed harmonics. | |
695 | // Remark: phi label azimuthal angle of RP particle and psi label azimuthal angle of POI particle. | |
696 | ||
697 | Int_t nPrim = anEvent->NumberOfTracks(); | |
698 | AliFlowTrackSimple *aftsTrack = NULL; | |
699 | Double_t phi1=0.,psi2=0.,psi3=0.; // angles in the correlator cos[n(2phi1-psi2-psi3)] | |
700 | Double_t pt2=0.,pt3=0.; // transverse momenta of psi2 and psi3 | |
701 | Int_t n = fCorrelatorIntegerMH; | |
702 | // Evaluting differential correlator cos[n(2phi1-psi2-psi3)] with three nested loops: | |
703 | for(Int_t i1=0;i1<nPrim;i1++) | |
704 | { | |
705 | aftsTrack=anEvent->GetTrack(i1); | |
706 | // RP condition (first particle in the correlator must be RP): | |
707 | if(!(aftsTrack->InRPSelection())) continue; | |
708 | phi1 = aftsTrack->Phi(); | |
709 | for(Int_t i2=0;i2<nPrim;i2++) | |
710 | { | |
711 | if(i2==i1) continue; | |
712 | aftsTrack = anEvent->GetTrack(i2); | |
713 | // POI condition (second particle in the correlator must be POI): | |
714 | if(!(aftsTrack->InPOISelection())) continue; | |
715 | psi2 = aftsTrack->Phi(); | |
716 | pt2 = aftsTrack->Pt(); | |
717 | for(Int_t i3=0;i3<nPrim;i3++) | |
718 | { | |
719 | if(i3==i1||i3==i2) continue; | |
720 | aftsTrack=anEvent->GetTrack(i3); | |
721 | // POI condition (third particle in the correlator must be POI): | |
722 | if(!(aftsTrack->InPOISelection())) continue; | |
723 | psi3 = aftsTrack->Phi(); | |
724 | pt3 = aftsTrack->Pt(); | |
725 | // Evaluate and store differential correlator cos[n(2phi1-psi2-psi3)]: | |
726 | Double_t ptSum = (pt2+pt3)/2.; | |
727 | Double_t ptDiff = TMath::Abs(pt2-pt3); | |
728 | Double_t diff3pCorrelator = TMath::Cos(n*(2.*phi1-psi2-psi3)); | |
729 | f3pCorrelatorVsPtSumDiffDirectPro[0]->Fill(ptSum,diff3pCorrelator,1.); | |
730 | f3pCorrelatorVsPtSumDiffDirectPro[1]->Fill(ptDiff,diff3pCorrelator,1.); | |
731 | } // end of for(Int_t i3=0;i3<nPrim;i3++) | |
732 | } // end of for(Int_t i2=0;i2<nPrim;i2++) | |
733 | } // end of for(Int_t i1=0;i1<nPrim;i1++) | |
734 | ||
735 | } // end of void AliFlowAnalysisWithNestedLoops::EvaluateNestedLoopsForMH(AliFlowEventSimple *anEvent) | |
736 | ||
737 | //================================================================================================================ | |
738 | ||
739 | void AliFlowAnalysisWithNestedLoops::PrintOnTheScreen() | |
740 | { | |
741 | // Print on the screen. | |
742 | ||
743 | cout<<endl; | |
744 | cout<<"****************************************************"<<endl; | |
745 | cout<<"****************************************************"<<endl; | |
746 | cout<<" Nested Loops "<<endl; | |
747 | cout<<endl; | |
748 | ||
749 | if(fEvaluateNestedLoopsForRAD) | |
750 | { | |
751 | cout<<" Evaluated for relative angle distribution."<<endl; | |
752 | } | |
753 | ||
754 | if(fEvaluateNestedLoopsForMH) | |
755 | { | |
756 | cout<<" Evaluated for mixed harmonics."<<endl; | |
757 | if(fCorrelatorIntegerMH!=1) | |
758 | { | |
759 | cout<< " cos["<<fCorrelatorIntegerMH<<"(2phi1-psi2-psi3)] = "<<endl; | |
760 | } else | |
761 | { | |
762 | cout<< " cos(2phi1-psi2-psi3) = "<<endl; | |
763 | } | |
764 | cout<< " a) in pt sum bin "<<fCrossCheckInPtSumBinNo<<": "<< | |
765 | f3pCorrelatorVsPtSumDiffDirectPro[0]->GetBinContent(fCrossCheckInPtSumBinNo)<< | |
766 | " +/- "<<f3pCorrelatorVsPtSumDiffDirectPro[0]->GetBinError(fCrossCheckInPtSumBinNo)<<endl; | |
767 | cout<< " b) in pt diff bin "<<fCrossCheckInPtDiffBinNo<<": "<< | |
768 | f3pCorrelatorVsPtSumDiffDirectPro[1]->GetBinContent(fCrossCheckInPtDiffBinNo)<< | |
769 | " +/- "<<f3pCorrelatorVsPtSumDiffDirectPro[1]->GetBinError(fCrossCheckInPtDiffBinNo)<<endl; | |
770 | } | |
771 | ||
772 | if(!fEvaluateNestedLoopsForRAD && !fEvaluateNestedLoopsForMH) | |
773 | { | |
774 | cout<<" Not evaluated."<<endl; | |
775 | } | |
776 | cout<<endl; | |
777 | cout<<"****************************************************"<<endl; | |
778 | cout<<"****************************************************"<<endl; | |
779 | cout<<endl; | |
780 | ||
781 | } // end of void AliFlowAnalysisWithNestedLoops::PrintOnTheScreen() | |
782 | ||
783 |