]>
Commit | Line | Data |
---|---|---|
441ea1cf | 1 | // Macro redoFinish.C is typically used after the merging macros (mergeOutput.C or |
021fb870 | 2 | // mergeOutputOnGrid.C) have been used to produce the merged, large statistics |
441ea1cf | 3 | // file of flow analysis. Results stored in merged file are WRONG because after |
021fb870 | 4 | // merging the results from small statistics files are trivially summed up in all |
5 | // histograms. This is taken into account and corrected for with macro redoFinish.C. | |
6 | // Another typical use of the macro redoFinish.C is to repeat the call to Finish() | |
7 | // in all classes, but with different values of some settings which might modify | |
8 | // the final results (Example: redo the Finish() and apply correction for detector | |
9 | // effects in QC code because by default this correction is switched off). | |
10 | ||
441ea1cf | 11 | // Name of the merged, large statistics file obtained with the merging macros: |
50040ed6 | 12 | TString mergedFileName = "mergedAnalysisResults.root"; |
021fb870 | 13 | // Final output file name holding correct final results for large statistics sample: |
441ea1cf | 14 | TString outputFileName = "AnalysisResults.root"; |
499fe731 | 15 | |
021fb870 | 16 | Bool_t bApplyCorrectionForNUA = kFALSE; // apply correction for non-uniform acceptance |
17 | Bool_t bApplyCorrectionForNUAVsM = kFALSE; // apply correction for non-uniform acceptance in each multiplicity bin independently | |
18 | Bool_t bPropagateErrorAlsoFromNIT = kFALSE; // propagate error also from non-isotropic terms | |
b77b6434 | 19 | Bool_t bMinimumBiasReferenceFlow = kTRUE; // store in CRH for reference flow the result obtained wihout rebinning in multiplicity (kTRUE) |
ad87ae62 | 20 | |
499fe731 | 21 | void redoFinish() |
6a6afe42 | 22 | { |
499fe731 | 23 | LoadLibraries(); |
ad87ae62 | 24 | |
441ea1cf | 25 | TString mergedFileFullPathName(gSystem->pwd()); |
26 | mergedFileFullPathName+="/"; | |
27 | mergedFileFullPathName+=mergedFileName.Data(); | |
28 | TFile *mergedFile = NULL; | |
29 | if(gSystem->AccessPathName(mergedFileFullPathName.Data(),kFileExists)) | |
30 | { | |
31 | cout<<endl; | |
32 | cout<<" WARNING: Couldn't find a file: "<<mergedFileName.Data()<<endl; | |
33 | cout<<" in directory "<<gSystem->pwd()<<" !!!!"<<endl; | |
34 | cout<<endl; | |
35 | exit(0); | |
36 | } | |
37 | else | |
38 | { | |
021fb870 | 39 | // Create temporarily copy of <mergedFileName> if neccessary: |
40 | if(!(mergedFileName == outputFileName)) | |
41 | { | |
441ea1cf | 42 | TSystemFile *fileTemp = new TSystemFile(mergedFileFullPathName.Data(),"."); |
43 | fileTemp->Copy("mergedAnalysisResultsTemp.root"); | |
44 | delete fileTemp; | |
021fb870 | 45 | } |
46 | // Access <mergedFileName>: | |
47 | mergedFile = TFile::Open(mergedFileFullPathName.Data(),"UPDATE"); | |
441ea1cf | 48 | } |
49 | ||
50 | // Access from <mergedFileName> the merged TDirectoryFile's for each method and from them the lists holding histograms: | |
499fe731 | 51 | |
52 | TList* mergedFileKeys = mergedFile->GetListOfKeys(); | |
53 | for(Int_t i=0; i<mergedFileKeys->GetEntries(); i++) | |
ad87ae62 | 54 | { |
499fe731 | 55 | TDirectory* directory = dynamic_cast<TDirectory*>(mergedFile->Get(mergedFileKeys->At(i)->GetName())); |
56 | if (!directory) continue; | |
ad87ae62 | 57 | |
441ea1cf | 58 | TList* listTemp = directory->GetListOfKeys(); |
441ea1cf | 59 | for (Int_t icent=0; icent<listTemp->GetEntries(); icent++) |
60 | { | |
61 | TList* list = dynamic_cast<TList*>(directory->Get(listTemp->At(icent)->GetName())); | |
62 | if (!list) continue; | |
63 | ||
64 | //////////////////// | |
499fe731 | 65 | if(TString(list->GetName()).Contains("MCEP")) |
441ea1cf | 66 | { |
67 | AliFlowAnalysisWithMCEventPlane* mcep = new AliFlowAnalysisWithMCEventPlane(); | |
68 | mcep->GetOutputHistograms(list); | |
69 | mcep->Finish(); | |
70 | directory->Add(list,kTRUE); | |
71 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
72 | } | |
73 | // SP: | |
499fe731 | 74 | else if(TString(list->GetName()).Contains("SP")) |
441ea1cf | 75 | { |
76 | AliFlowAnalysisWithScalarProduct* sp = new AliFlowAnalysisWithScalarProduct(); | |
77 | sp->GetOutputHistograms(list); | |
a8197a3e | 78 | sp->GetHistProFlags()->SetBinContent(1,(Int_t)bApplyCorrectionForNUA); |
441ea1cf | 79 | sp->Finish(); |
80 | directory->Add(list,kTRUE); | |
81 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
82 | } | |
83 | // GFC: | |
499fe731 | 84 | else if(TString(list->GetName()).Contains("GFC")) |
441ea1cf | 85 | { |
86 | AliFlowAnalysisWithCumulants* gfc = new AliFlowAnalysisWithCumulants(); | |
87 | gfc->GetOutputHistograms(list); | |
88 | gfc->Finish(); | |
89 | directory->Add(list,kTRUE); | |
90 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
91 | } | |
92 | // QC: | |
499fe731 | 93 | else if(TString(list->GetName()).Contains("QC")) |
441ea1cf | 94 | { |
95 | AliFlowAnalysisWithQCumulants* qc = new AliFlowAnalysisWithQCumulants(); | |
96 | qc->GetOutputHistograms(list); | |
97 | qc->GetIntFlowFlags()->SetBinContent(3,(Int_t)bApplyCorrectionForNUA); | |
98 | qc->GetIntFlowFlags()->SetBinContent(8,(Int_t)bApplyCorrectionForNUAVsM); | |
99 | qc->GetIntFlowFlags()->SetBinContent(9,(Int_t)bPropagateErrorAlsoFromNIT); | |
100 | qc->GetIntFlowFlags()->SetBinContent(11,(Int_t)bMinimumBiasReferenceFlow); | |
101 | qc->Finish(); | |
102 | directory->Add(list,kTRUE); | |
103 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
104 | } | |
105 | // FQD: | |
499fe731 | 106 | else if(TString(list->GetName()).Contains("FQD")) |
441ea1cf | 107 | { |
108 | AliFlowAnalysisWithFittingQDistribution* fqd = new AliFlowAnalysisWithFittingQDistribution(); | |
109 | fqd->GetOutputHistograms(list); | |
110 | fqd->Finish(kTRUE); | |
111 | directory->Add(list,kTRUE); | |
112 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
113 | } | |
114 | // LYZ1SUM: | |
499fe731 | 115 | else if(TString(list->GetName()).Contains("LYZ1SUM")) |
441ea1cf | 116 | { |
117 | AliFlowAnalysisWithLeeYangZeros* lyz1sum = new AliFlowAnalysisWithLeeYangZeros(); | |
118 | lyz1sum->SetFirstRun(kTRUE); | |
119 | lyz1sum->SetUseSum(kTRUE); | |
120 | lyz1sum->GetOutputHistograms(list); | |
121 | lyz1sum->Finish(); | |
122 | directory->Add(list,kTRUE); | |
123 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
124 | } | |
125 | // LYZ2SUM: | |
499fe731 | 126 | else if(TString(list->GetName()).Contains("LYZ2SUM")) |
441ea1cf | 127 | { |
128 | AliFlowAnalysisWithLeeYangZeros* lyz2sum = new AliFlowAnalysisWithLeeYangZeros(); | |
129 | lyz2sum->SetFirstRun(kFALSE); | |
130 | lyz2sum->SetUseSum(kTRUE); | |
131 | lyz2sum->GetOutputHistograms(list); | |
132 | lyz2sum->Finish(); | |
133 | directory->Add(list,kTRUE); | |
134 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
135 | } | |
136 | // LYZ1PROD: | |
499fe731 | 137 | else if(TString(list->GetName()).Contains("LYZ1PROD")) |
441ea1cf | 138 | { |
139 | AliFlowAnalysisWithLeeYangZeros* lyz1prod = new AliFlowAnalysisWithLeeYangZeros(); | |
140 | lyz1prod->SetFirstRun(kTRUE); | |
141 | lyz1prod->SetUseSum(kFALSE); | |
142 | lyz1prod->GetOutputHistograms(list); | |
143 | lyz1prod->Finish(); | |
144 | directory->Add(list,kTRUE); | |
145 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
146 | } | |
147 | // LYZ2PROD: | |
499fe731 | 148 | else if(TString(list->GetName()).Contains("LYZ2PROD")) |
441ea1cf | 149 | { |
150 | AliFlowAnalysisWithLeeYangZeros* lyz2prod = new AliFlowAnalysisWithLeeYangZeros(); | |
151 | lyz2prod->SetFirstRun(kFALSE); | |
152 | lyz2prod->SetUseSum(kFALSE); | |
153 | lyz2prod->GetOutputHistograms(list); | |
154 | lyz2prod->Finish(); | |
155 | directory->Add(list,kTRUE); | |
156 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
157 | } | |
158 | // LYZEP: | |
499fe731 | 159 | else if(TString(list->GetName()).Contains("LYZEP")) |
441ea1cf | 160 | { |
161 | AliFlowAnalysisWithLYZEventPlane* lyzep = new AliFlowAnalysisWithLYZEventPlane(); | |
162 | lyzep->GetOutputHistograms(list); | |
163 | lyzep->Finish(); | |
164 | directory->Add(list,kTRUE); | |
165 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
166 | } | |
167 | // MH: | |
499fe731 | 168 | else if(TString(list->GetName()).Contains("MH")) |
441ea1cf | 169 | { |
170 | AliFlowAnalysisWithMixedHarmonics* mh = new AliFlowAnalysisWithMixedHarmonics(); | |
171 | mh->GetOutputHistograms(list); | |
50040ed6 | 172 | mh->GetAnalysisSettings()->SetBinContent(1,(Int_t)bApplyCorrectionForNUA); |
441ea1cf | 173 | mh->Finish(); |
174 | directory->Add(list,kTRUE); | |
175 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
176 | } | |
177 | // NL: | |
499fe731 | 178 | else if(TString(list->GetName()).Contains("NL")) |
441ea1cf | 179 | { |
180 | AliFlowAnalysisWithNestedLoops* nl = new AliFlowAnalysisWithNestedLoops(); | |
181 | nl->GetOutputHistograms(list); | |
182 | nl->Finish(); | |
183 | directory->Add(list,kTRUE); | |
184 | directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete); | |
185 | } | |
186 | }//for icent | |
499fe731 | 187 | }// |
441ea1cf | 188 | |
189 | // Close the final output file: | |
190 | delete mergedFile; | |
191 | ||
192 | // Giving the final names if neccessary: | |
193 | if(!(mergedFileName == outputFileName)) | |
194 | { | |
195 | TSystemFile *outputFileFinal = new TSystemFile(mergedFileName.Data(),"."); | |
196 | outputFileFinal->Rename(outputFileName.Data()); | |
197 | delete outputFileFinal; | |
198 | TSystemFile *mergedFileFinal = new TSystemFile("mergedAnalysisResultsTemp.root","."); | |
199 | mergedFileFinal->Rename(mergedFileName.Data()); | |
200 | delete mergedFileFinal; | |
201 | } // end of if(!(mergedFileName == outputFileName)) | |
202 | ||
203 | cout<<endl; | |
9455e15e | 204 | |
021fb870 | 205 | } // end of void redoFinish(Int_t mode=mLocal) |
441ea1cf | 206 | |
499fe731 | 207 | void LoadLibraries() |
441ea1cf | 208 | { |
6a6afe42 | 209 | //-------------------------------------- |
210 | // Load the needed libraries most of them already loaded by aliroot | |
211 | //-------------------------------------- | |
ad87ae62 | 212 | //gSystem->Load("libTree"); |
5d040cf3 | 213 | gSystem->Load("libGeom"); |
214 | gSystem->Load("libVMC"); | |
215 | gSystem->Load("libXMLIO"); | |
216 | gSystem->Load("libPhysics"); | |
441ea1cf | 217 | |
499fe731 | 218 | // for AliRoot |
219 | gSystem->Load("libANALYSIS"); | |
220 | gSystem->Load("libANALYSISalice"); | |
221 | gSystem->Load("libPWG2flowCommon"); | |
222 | gSystem->Load("libPWG2flowTasks"); | |
ad87ae62 | 223 | } // end of void LoadLibrariesRF(const libModes mode) |
6a6afe42 | 224 | |
441ea1cf | 225 |