]>
Commit | Line | Data |
---|---|---|
03a02aca | 1 | //========================================================================================== |
2 | // Before using the macro makeWeights.C you should already have available the output .root | |
3 | // files from various methods from the previous run over data (without any weights). When | |
4 | // calling this macro you must specify the analysis type and the method from which output | |
5 | // file you would like to make the weights for the next run (for the cumulants, GFC and QC, | |
6 | // you must also specify the order): | |
bc1a7705 | 7 | // |
8 | // 1. type of analysis can be: ESD, AOD, MC, ESDMC0 or ESDMC1; | |
9 | // | |
10 | // 2. method can be: MCEP, LYZ1, LYZ2, LYZEP, FQD, GFC or QC; | |
11 | // | |
12 | // 3. cumulant order can be: 2nd, 4th, 6th or 8th. | |
03a02aca | 13 | //========================================================================================== |
bc1a7705 | 14 | |
03a02aca | 15 | void makeWeights(TString type="ESD", TString method="GFC", TString cumulantOrder="4th") |
bc1a7705 | 16 | { |
17 | //load needed libraries: | |
18 | gSystem->AddIncludePath("-I$ROOTSYS/include"); | |
19 | gSystem->Load("libTree.so"); | |
20 | ||
21 | //for AliRoot | |
22 | gSystem->AddIncludePath("-I$ALICE_ROOT/include"); | |
23 | gSystem->Load("libANALYSIS.so"); | |
29b61d43 | 24 | gSystem->Load("libPWG2flowCommon.so"); |
25 | cerr<<"libPWG2flowCommon.so loaded ..."<<endl; | |
bc1a7705 | 26 | |
27 | //open the output file from the first run of the specified method: | |
28 | TString inputFileName = "output"; | |
29 | TFile* file = NULL; | |
30 | file = TFile::Open(((((inputFileName.Append(method.Data())).Append("analysis")).Append(type.Data())).Append(".root")).Data(), "READ"); | |
31 | ||
32 | //accessing the results: | |
33 | TString cobj = "cobj"; | |
34 | TString afc = "AliFlowCommonHist"; | |
35 | TString afcr = "AliFlowCommonHistResults"; | |
36 | ||
37 | TList *pList = NULL; | |
38 | AliFlowCommonHist *commonHist = NULL; | |
39 | AliFlowCommonHistResults *commonHistRes = NULL; | |
40 | ||
41 | if(file) | |
42 | { | |
43 | file->GetObject((cobj.Append(method.Data()).Data()),pList); | |
44 | if(pList) | |
45 | { | |
46 | if(!(method=="GFC"||method=="QC")) | |
47 | { | |
48 | commonHist = dynamic_cast<AliFlowCommonHist*> (pList->FindObject((afc.Append(method.Data())).Data())); | |
49 | commonHistRes = dynamic_cast<AliFlowCommonHistResults*> (pList->FindObject((afcr.Append(method.Data())).Data())); | |
50 | }else if(method=="GFC") | |
51 | { | |
52 | commonHist = dynamic_cast<AliFlowCommonHist*> (pList->FindObject((afc.Append(method.Data())).Data())); | |
53 | commonHistRes = dynamic_cast<AliFlowCommonHistResults*> (pList->FindObject((((afcr.Append(cumulantOrder.Data()).Append("Order")).Append(method.Data())).Data()))); | |
54 | }else | |
55 | { | |
56 | commonHist = dynamic_cast<AliFlowCommonHist*> (pList->FindObject(((afc.Append(cumulantOrder.Data())).Append("Order")).Append(method.Data()))); | |
57 | commonHistRes = dynamic_cast<AliFlowCommonHistResults*> (pList->FindObject((((afcr.Append(cumulantOrder.Data()).Append("Order")).Append(method.Data())).Data()))); | |
58 | } | |
59 | }//end of if(pList) | |
60 | }//end of if(file) | |
61 | ||
03a02aca | 62 | //making the output file and creating the TList to hold the histograms with weights: |
63 | TFile* outputFile = new TFile("weights.root","RECREATE"); | |
64 | TList* listWeights = new TList(); | |
bc1a7705 | 65 | //common control histos: |
66 | if(commonHist) | |
67 | { | |
68 | //azimuthal acceptance: | |
69 | (commonHist->GetHistPhiInt())->SetName("phi_weights"); | |
70 | //normalizing: | |
71 | Double_t norm=(commonHist->GetHistPhiInt())->Integral(); | |
72 | if(norm) | |
73 | { | |
74 | (commonHist->GetHistPhiInt())->Scale(1./norm); | |
75 | } | |
03a02aca | 76 | listWeights->Add(commonHist->GetHistPhiInt()); |
77 | }else{cout<<" WARNING: the common control histos from the 1st run were not accessed."<<endl;} | |
bc1a7705 | 78 | //common results histos: |
79 | if(commonHistRes) | |
80 | { | |
03a02aca | 81 | //diff. flow (pt): |
bc1a7705 | 82 | (commonHistRes->GetHistDiffFlowPtPOI())->SetName("pt_weights"); |
03a02aca | 83 | listWeights->Add(commonHistRes->GetHistDiffFlowPtPOI()); |
84 | //diff. flow (eta): | |
bc1a7705 | 85 | (commonHistRes->GetHistDiffFlowEtaPOI())->SetName("eta_weights"); |
03a02aca | 86 | listWeights->Add(commonHistRes->GetHistDiffFlowEtaPOI()); |
87 | }else{cout<<" WARNING: the common results histos from the 1st run were not accessed."<<endl;} | |
bc1a7705 | 88 | |
03a02aca | 89 | outputFile->WriteObject(listWeights,"weights","SingleKey"); |
90 | ||
91 | delete listWeights; | |
92 | delete outputFile; | |
bc1a7705 | 93 | } |
03a02aca | 94 | |
95 | ||
96 |