]>
Commit | Line | Data |
---|---|---|
88d02ae4 | 1 | Float_t QAPlotsBoth( AliSpectraBothHistoManager* hman_data, AliSpectraBothHistoManager* hman_mc, |
2 | AliSpectraBothEventCuts* ecuts_data, AliSpectraBothEventCuts* ecuts_mc, | |
3 | AliSpectraBothTrackCuts* tcuts_data, AliSpectraBothTrackCuts* tcuts_mc, | |
3a71f081 | 4 | TList * flistqa,TList * flistcanvas,Bool_t fullicorr=kTRUE) |
88d02ae4 | 5 | { |
6 | TString pidmethods[3]={"TPC","TOF","TPCTOF"}; | |
7 | Double_t neventsdata = ecutsdata->NumberOfPhysSelEvents(); | |
8 | Double_t neventsmc = ecutsmc->NumberOfPhysSelEvents(); | |
9 | ||
eb9ebb0a | 10 | |
11 | ||
88d02ae4 | 12 | for(Int_t ipart=0;ipart<3;ipart++) |
13 | { | |
eb9ebb0a | 14 | |
88d02ae4 | 15 | for(Int_t imethod=0;imethod<3;imethod++) |
16 | { | |
17 | TH2F *nsig_data = (TH2F*)((TH2F*)hman_data->GetNSigHistogram(Form("hHistNSig%sPt%s",Particle[ipart].Data(),pidmethods[imethod].Data())))->Clone(); | |
18 | // nsig_data->RebinX(20); | |
19 | // nsig_data->RebinY(4); | |
20 | // nsig_data->Sumw2(); | |
21 | ||
22 | TH2F *nsig_mc = (TH2F*)((TH2F*)hman_mc->GetNSigHistogram(Form("hHistNSig%sPt%s",Particle[ipart].Data(),pidmethods[imethod].Data())))->Clone(); | |
23 | //nsig_mc->RebinX(20); | |
24 | // nsig_mc->RebinY(4); | |
25 | // nsig_mc->Sumw2(); | |
26 | ||
27 | Int_t ibin=1; | |
28 | Float_t binsize=nsig_mc->GetXaxis()->GetBinWidth(1); | |
eb9ebb0a | 29 | |
30 | TH1F* maxposdata=(TH1F*)nsig_data->ProjectionX(Form("%s%sdatamaxpos",Particle[ipart].Data(),pidmethods[imethod].Data()),-1,-1)); | |
31 | maxposdata->Reset(); | |
32 | maxposdata->SetTitle(";p_{T} (GeV/c);max in (-2,2)"); | |
33 | TH1F* maxposmc=(TH1F*)nsig_data->ProjectionX(Form("%s%smcmaxpos",Particle[ipart].Data(),pidmethods[imethod].Data()),-1,-1)); | |
34 | maxposmc->Reset(); | |
35 | maxposmc->SetTitle(";p_{T} (GeV/c);max in (-2,2)"); | |
36 | ||
37 | ||
88d02ae4 | 38 | while (ibin*binsize<3.0) |
39 | { | |
40 | // TCanvas* c=new TCanvas(Form("canvas%s%s%d",Particle[ipart].Data(),pidmethods[imethod].Data(),ibin),Form("canvas%s%s%d",Particle[ipart].Data(),pidmethods[imethod].Data(),ibin),700,500); | |
41 | ||
42 | TH1F *nsig_data_Proj1=(TH1F*)nsig_data->ProjectionY(Form("%s%sdata[%.2f,%.2f]",Particle[ipart].Data(),pidmethods[imethod].Data(),nsig_data->GetXaxis()->GetBinLowEdge(ibin),nsig_data->GetXaxis()->GetBinUpEdge(ibin)),ibin,ibin)); | |
43 | TH1F *nsig_mc_Proj1=(TH1F*)nsig_mc->ProjectionY(Form("%s%smc[%.2f,%.2f]",Particle[ipart].Data(),pidmethods[imethod].Data(),nsig_mc->GetXaxis()->GetBinLowEdge(ibin),nsig_mc->GetXaxis()->GetBinUpEdge(ibin)),ibin,ibin)); | |
44 | nsig_data_Proj1->GetXaxis()->SetRangeUser(-3,3); | |
45 | nsig_data_Proj1->SetLineColor(kRed); | |
46 | if(nsig_data_Proj1->Integral()<1&&nsig_mc_Proj1->Integral()<1) | |
47 | { | |
48 | ibin++; | |
49 | continue; | |
50 | } | |
eb9ebb0a | 51 | // nsig_data_Proj1->Sumw2(); |
88d02ae4 | 52 | // nsig_mc_Proj1->Sumw2(); |
53 | //nsig_data_Proj1->GetXaxis()->SetRangeUser(-5,5); | |
54 | ||
55 | //c->cd()->SetLogy(); | |
56 | //nsig_data_Proj1->Draw(); | |
57 | //nsig_mc_Proj1->Draw("same"); | |
eb9ebb0a | 58 | nsig_data_Proj1->GetXaxis()->SetRange(nsig_data_Proj1->GetXaxis()->FindBin(-2.0),nsig_data_Proj1->GetXaxis()->FindBin(2.0)); |
59 | if(nsig_data_Proj1->GetMaximumBin()<=nsig_data_Proj1->GetXaxis()->FindBin(2.0)&&nsig_data_Proj1->GetMaximumBin()>=nsig_data_Proj1->GetXaxis()->FindBin(-2.0)) | |
60 | { | |
61 | maxposdata->SetBinContent(ibin,nsig_data_Proj1->GetXaxis()->GetBinCenter(nsig_data_Proj1->GetMaximumBin())); | |
62 | maxposdata->SetBinError(ibin,nsig_data_Proj1->GetXaxis()->GetBinWidth(nsig_data_Proj1->GetMaximumBin())/2.0); | |
63 | } | |
a4ca64e3 | 64 | //cout<<Form("%s%sdatamaxpos",Particle[ipart].Data(),pidmethods[imethod].Data())<<" "<<nsig_data_Proj1->GetMaximumBin()<<" "<<nsig_data_Proj1->GetXaxis()->FindBin(2.0)<<" "<<nsig_data_Proj1->GetXaxis()->FindBin(-2.0)<<" "<<nsig_data_Proj1->GetXaxis()->GetBinCenter(nsig_data_Proj1->GetMaximumBin())<<" "<<ibin<<endl; |
eb9ebb0a | 65 | |
66 | nsig_data_Proj1->GetXaxis()->SetRange(0,nsig_data_Proj1->GetXaxis()->GetNbins()); | |
67 | ||
68 | nsig_mc_Proj1->GetXaxis()->SetRange(nsig_mc_Proj1->GetXaxis()->FindBin(-2.0),nsig_mc_Proj1->GetXaxis()->FindBin(2.0)); | |
69 | if(nsig_mc_Proj1->GetMaximumBin()<=nsig_mc_Proj1->GetXaxis()->FindBin(2.0)&&nsig_mc_Proj1->GetMaximumBin()>=nsig_mc_Proj1->GetXaxis()->FindBin(-2.0)) | |
70 | { | |
71 | maxposmc->SetBinContent(ibin,nsig_mc_Proj1->GetXaxis()->GetBinCenter(nsig_mc_Proj1->GetMaximumBin())); | |
72 | maxposmc->SetBinError(ibin,nsig_mc_Proj1->GetXaxis()->GetBinWidth(nsig_mc_Proj1->GetMaximumBin())/2.0); | |
73 | } | |
a4ca64e3 | 74 | // cout<<Form("%s%smcmaxpos",Particle[ipart].Data(),pidmethods[imethod].Data())<<" "<<nsig_mc_Proj1->GetMaximumBin()<<" "<<nsig_mc_Proj1->GetXaxis()->FindBin(2.0)<<" "<<nsig_mc_Proj1->GetXaxis()->FindBin(-2.0)<<" "<<ibin<<" "<<nsig_mc_Proj1->GetXaxis()->GetBinCenter(nsig_mc_Proj1->GetMaximumBin())<<endl; |
eb9ebb0a | 75 | |
76 | nsig_mc_Proj1->GetXaxis()->SetRange(0,nsig_mc_Proj1->GetXaxis()->GetNbins()); | |
77 | ||
1e6bff53 | 78 | if(neventsdata>0.0&&neventsmc>0.0) |
79 | { | |
50c532c4 | 80 | nsig_data_Proj1->Sumw2(); |
81 | nsig_mc_Proj1->Sumw2(); | |
1e6bff53 | 82 | nsig_data_Proj1->Scale(1.0/neventsdata); |
83 | nsig_mc_Proj1->Scale(1.0/neventsmc); | |
84 | } | |
eb9ebb0a | 85 | |
33d374d5 | 86 | flistqa->Add(nsig_data_Proj1); |
87 | flistqa->Add(nsig_mc_Proj1); | |
88d02ae4 | 88 | ibin++; |
89 | } | |
eb9ebb0a | 90 | flistqa->Add(maxposmc); |
91 | flistqa->Add(maxposdata); | |
88d02ae4 | 92 | } |
93 | } | |
94 | TH1F* fHistoVtxAftSeldata=(TH1F*)ecuts_data->GetHistoVtxAftSel(); | |
95 | TH1F* fHistoVtxAftSelmc=(TH1F*)ecuts_mc->GetHistoVtxAftSel(); | |
547e52a0 | 96 | Int_t binstartx=1; |
97 | while(fHistoVtxAftSeldata->GetBinContent(binstartx)<1&&binstartx<fHistoVtxAftSeldata->GetXaxis()->GetNbins()) | |
98 | binstartx++; | |
99 | binstartx++; | |
33d374d5 | 100 | flistcanvas->Add(plot_on_canvas("vertex",fHistoVtxAftSeldata,fHistoVtxAftSelmc)); |
3a71f081 | 101 | /* |
102 | ||
88d02ae4 | 103 | TF1* fdata=new TF1("dataveretxfit","gausn"); |
104 | TF1* fmc=new TF1("mcveretxfit","gausn"); | |
547e52a0 | 105 | //we strat fit a second not empty bin |
106 | Float_t minfit=fHistoVtxAftSeldata->GetXaxis()->GetBinCenter(binstartx); | |
107 | cout<<"fit starts "<<minfit<<endl; | |
108 | fHistoVtxAftSeldata->Fit("dataveretxfit","0","",minfit,-1.0*minfit); | |
109 | fHistoVtxAftSelmc->Fit("mcveretxfit","0","",minfit,-1.0*minfit); | |
88d02ae4 | 110 | Float_t datavertexratio=fHistoVtxAftSeldata->Integral(-1,-1,"width")/fdata->GetParameter(0); |
111 | Float_t mcvertexratio=fHistoVtxAftSelmc->Integral(-1,-1,"width")/fmc->GetParameter(0); | |
3a71f081 | 112 | */ |
113 | //Event cut histo | |
114 | TH1I* histodata=ecuts_data->GetHistoCuts(); | |
115 | TH1I* histomc=ecuts_mc->GetHistoCuts(); | |
88d02ae4 | 116 | |
3a71f081 | 117 | Int_t events_data=histodata->GetBinContent(3); |
118 | Int_t events_mc=histomc->GetBinContent(3); | |
119 | ||
120 | if(events_data==0&&events_mc==0) | |
121 | return 0; | |
88d02ae4 | 122 | |
3a71f081 | 123 | |
124 | Float_t datavertexratio=((Float_t)(events_data))/((Float_t)histodata->GetBinContent(4)); | |
125 | Float_t mcvertexratio=((Float_t)(events_mc))/((Float_t)histomc->GetBinContent(4)); | |
88d02ae4 | 126 | TH1F* fHistoEtaAftSeldata=(TH1F*)ecuts_data->GetHistoEtaAftSel(); |
127 | TH1F* fHistoEtaAftSelmc=(TH1F*)ecuts_mc->GetHistoEtaAftSel(); | |
33d374d5 | 128 | flistcanvas->Add(plot_on_canvas("ETA",fHistoEtaAftSeldata,fHistoEtaAftSelmc)); |
88d02ae4 | 129 | |
130 | ||
131 | TH1F* fITSclustershistdata=(TH1F*)tcuts_data->GetHistoNclustersITS(); | |
132 | TH1F* fITSclustershistmc=(TH1F*)tcuts_mc->GetHistoNclustersITS(); | |
133 | ||
33d374d5 | 134 | flistcanvas->Add(plot_on_canvas("NITS",fITSclustershistdata,fITSclustershistmc)); |
88d02ae4 | 135 | cout<<" data "<<datavertexratio<<" mc "<<mcvertexratio<<endl; |
136 | ||
137 | TH2F* hmul=(TH2F*)hman_mc->GetGenMulvsRawMulHistogram("hHistGenMulvsRawMul"); | |
138 | hmul->Sumw2(); | |
139 | TCanvas* cbc=new TCanvas("broken chunks","broken chunks",1200,600); | |
140 | cbc->Divide(2,1); | |
141 | cbc->cd(1); | |
142 | hmul->Draw(); | |
143 | cbc->cd(2); | |
144 | TH1F* nonzero=(TH1F*)hmul->ProjectionX("nonzerotracks",2,-1); | |
145 | nonzero->SetMarkerColor(kRed); | |
146 | nonzero->SetMarkerStyle(21); | |
147 | TH1F* binzero=(TH1F*)hmul->ProjectionX("binzerotracks",1,1); | |
148 | binzero->SetMarkerColor(kBlack); | |
149 | binzero->SetMarkerStyle(22); | |
150 | binzero->Sumw2(); | |
151 | nonzero->Sumw2(); | |
152 | binzero->Divide(nonzero); | |
153 | TF1* badchunk=new TF1("badchunkfit","pol0",10,40); | |
154 | binzero->Fit("badchunkfit","R"); | |
155 | Float_t badchunksfraction=badchunk->GetParameter(0); | |
547e52a0 | 156 | cout<<"Bad chunks "<<badchunksfraction<<endl; |
88d02ae4 | 157 | binzero->Draw("E1"); |
33d374d5 | 158 | flistcanvas->Add(cbc); |
3a71f081 | 159 | if(TMath::Abs(hmul->GetEntries()/events_mc-1.0)>0.001) |
160 | cout<<"MC merging problem"<<endl; | |
161 | if(TMath::Abs(hman_data->GetGenMulvsRawMulHistogram("hHistGenMulvsRawMul")->GetEntries()/events_data-1.0)>0.001) | |
162 | cout<<"Data merging problem"<<endl; | |
88d02ae4 | 163 | |
3a71f081 | 164 | if(fullicorr) |
165 | return (1.0-badchunksfraction)*mcvertexratio/datavertexratio; | |
166 | else | |
167 | return (1.0-badchunksfraction)*mcvertexratio; | |
88d02ae4 | 168 | } |
169 | TCanvas* plot_on_canvas(TString name, TH1* h1,TH1* h2) | |
170 | { | |
171 | TCanvas* cvrt=new TCanvas(name.Data(),name.Data(),600,600); | |
172 | cvrt->cd(); | |
173 | h1->SetLineColor(kRed); | |
174 | h2->SetLineColor(kBlue); | |
175 | h1->Sumw2(); | |
176 | h2->Sumw2(); | |
177 | TLegend *lvtr=new TLegend(0.2,0.2,0.5,0.3,"","NDC"); | |
178 | lvtr->SetLineColor(kWhite); | |
179 | lvtr->AddEntry(h1,"data","l"); | |
180 | lvtr->AddEntry(h2,"MC","l"); | |
1e6bff53 | 181 | if(h1->GetBinContent(h1->GetXaxis()->FindBin(0.0))>0.0&&h2->GetBinContent(h2->GetXaxis()->FindBin(0.0))>0.0) |
182 | { | |
183 | h1->Scale(1.0/h1->GetBinContent(h1->GetXaxis()->FindBin(0.0))); | |
184 | h2->Scale(1.0/h2->GetBinContent(h2->GetXaxis()->FindBin(0.0))); | |
185 | } | |
88d02ae4 | 186 | h1->DrawCopy("L"); |
187 | h2->DrawCopy("Lsame"); | |
188 | lvtr->Draw(); | |
189 | return cvrt; | |
190 | } | |
191 |