]>
Commit | Line | Data |
---|---|---|
eeb1e952 | 1 | void ConfigWeightFactors(AliAnalysisTaskHFE *task, Bool_t syst = kFALSE, Int_t collType = 1){ |
d84c68e9 | 2 | // |
3 | // Set weighting factors for nonHFE backgrounds | |
eeb1e952 | 4 | // Option "collType": 0 for pp 2.76 TeV; 1 for pp 7 TeV; 2 for PbPb |
d84c68e9 | 5 | // |
d84c68e9 | 6 | //Get the correction factors for Non-HF electron yields from a root-file |
7 | Double_t elecBackGroundWeight[11][6][44][3];//centrality, species, momentum, background level | |
8 | for(Int_t iCent = 0; iCent < 11; iCent++){ | |
9 | for(Int_t iSpecies = 0; iSpecies < 6; iSpecies++){ | |
10 | for(Int_t iBin = 0; iBin < 44; iBin++){ | |
11 | for(Int_t iError = 0; iError < 3; iError++){ | |
12 | elecBackGroundWeight[iCent][iSpecies][iBin][iError] = 0; | |
13 | } | |
14 | } | |
15 | } | |
16 | } | |
17 | const Char_t *backNameMC[6] = {"pion","eta","omega","phi","etap","rho"}; | |
eeb1e952 | 18 | TFile *weightFile = TFile::Open(Form("%s/util/hfe/nonHFEcorrect.root", gSystem->Getenv("TRAIN_ROOT"))); |
d84c68e9 | 19 | if(weightFile){ |
20 | if(syst){ | |
eeb1e952 | 21 | TH1F *hRelErr[2][2];//errors for pion yields, which form the correlated component of the relative error for all other decaying mesons, except for eta, which are parameterized independently |
22 | if(collType == 1){ | |
23 | hRelErr[0][0] = (TH1F*)weightFile->Get("hErrorspionLower"); | |
24 | hRelErr[0][1] = (TH1F*)weightFile->Get("hErrorspionUpper"); | |
25 | hRelErr[1][0] = (TH1F*)weightFile->Get("hErrorsetaLower"); | |
26 | hRelErr[1][1] = (TH1F*)weightFile->Get("hErrorsetaUpper"); | |
27 | } | |
28 | else if(collType == 0){ | |
29 | hRelErr[0][0] = (TH1F*)weightFile->Get("hErrors_2.76TeV_pionLower"); | |
30 | hRelErr[0][1] = (TH1F*)weightFile->Get("hErrors_2.76TeV_pionUpper"); | |
31 | //hRelErr[1][0] = (TH1F*)weightFile->Get("hErrors_2.76TeV_etaLower"); | |
32 | //hRelErr[1][1] = (TH1F*)weightFile->Get("hErrors_2.76TeV_etaUpper"); | |
33 | } | |
d84c68e9 | 34 | } |
35 | for(Int_t iCent = 0; iCent < 11; iCent++){//centrality bins | |
36 | for(Int_t iSpecies = 0; iSpecies < 6; iSpecies++){//species of decaying mesons | |
37 | TH1F *hRatio = 0x0; | |
eeb1e952 | 38 | if(collType == 1){ |
d84c68e9 | 39 | hRatio = (TH1F*)weightFile->Get(Form("hRatio%s",backNameMC[iSpecies])); |
40 | } | |
eeb1e952 | 41 | else if(collType == 0){ |
42 | hRatio = (TH1F*)weightFile->Get(Form("hRatio_2.76TeV_%s",backNameMC[iSpecies])); | |
43 | } | |
d84c68e9 | 44 | else{ |
45 | if((iCent == 1)||(iCent == 4)){ | |
46 | hRatio = (TH1F*)weightFile->Get(Form("hRatio%s%d",backNameMC[iSpecies],iCent-1)); | |
47 | } | |
48 | else if(iCent > 7){ | |
eeb1e952 | 49 | hRatio = (TH1F*)weightFile->Get(Form("hRatio%s7",backNameMC[iSpecies])); |
d84c68e9 | 50 | } |
51 | else{ | |
52 | hRatio = (TH1F*)weightFile->Get(Form("hRatio%s%d",backNameMC[iSpecies],iCent)); | |
53 | } | |
54 | } | |
55 | for(Int_t iBin = 1; iBin < 45; iBin++){//momentum bin of mother meson | |
56 | if(iCent == 0){ | |
eeb1e952 | 57 | elecBackGroundWeight[iCent][iSpecies][iBin-1][0] = hRatio->GetBinContent(iBin); |
58 | if(syst && (collType < 2)){ | |
d84c68e9 | 59 | for(Int_t iError = 0; iError < 2; iError++){//0: best estimate, 1,2: lower, upper uncertainty level |
eeb1e952 | 60 | if((iSpecies == 1) && (collType == 1)) |
61 | elecBackGroundWeight[iCent][iSpecies][iBin-1][iError+1]=elecBackGroundWeight[iCent][iSpecies][iBin-1][0]*(1+hRelErr[1][iError]->GetBinContent(iBin)); | |
62 | else | |
63 | elecBackGroundWeight[iCent][iSpecies][iBin-1][iError+1]=elecBackGroundWeight[iCent][iSpecies][iBin-1][0]*(1+hRelErr[0][iError]->GetBinContent(iBin));//Addition of relative errors from histograms with "+", because lower errors are defined as negative numbers in the reference histograms! | |
d84c68e9 | 64 | } |
65 | } | |
66 | } | |
67 | else{ | |
eeb1e952 | 68 | if(collType == 2){ |
69 | elecBackGroundWeight[iCent][iSpecies][iBin-1][0] = hRatio->GetBinContent(iBin); | |
d84c68e9 | 70 | } |
71 | } | |
72 | } | |
73 | } | |
74 | } | |
75 | weightFile->Close(); | |
76 | } | |
77 | else{ | |
eeb1e952 | 78 | printf("No reference file for background electron weighting found!\n"); |
d84c68e9 | 79 | } |
80 | ||
eeb1e952 | 81 | const Double_t binLimit[45] = {0.1,0.112797,0.127231,0.143512,0.161877,0.182592,0.205957,0.232313,0.262041,0.295573,0.333397,0.37606,0.424183,0.478465,0.539692,0.608754,0.686654,0.774523,0.873636,0.985432,1.11153,1.25377,1.41421,1.59519,1.79932,2.02957,2.28928,2.58223,2.91267,3.2854,3.70582,4.18004,4.71494,5.3183,5.99886,6.76651,7.6324,8.60909,9.71076,10.9534,12.3551,13.9361,15.7195,17.731,20};//bin limits from the measured pi0 spectrum |
d84c68e9 | 82 | |
eeb1e952 | 83 | for(Int_t iCent = 0; iCent < 11; iCent++){//centrality bins |
84 | for(Int_t iBin = 1; iBin < 45; iBin++){//for all centralities, pt bins and all meson decays, set weighting factors for daughter electrons | |
85 | task->SetBinLimits(iBin-1,binLimit[iBin-1]); | |
86 | for(Int_t iSpecies = 0; iSpecies < 6; iSpecies++){ | |
87 | for(Int_t iError = 0; iError < 3; iError++) | |
88 | task->SetElecBackGroundFactors(iBin-1, iSpecies, iCent, iError, elecBackGroundWeight[iCent][iSpecies][iBin-1][iError]); | |
89 | } | |
d84c68e9 | 90 | } |
91 | } | |
92 | } |