2 void plTpcEffCorrect(
bool print=
true){
4 gStyle->SetOptStat(100000000);
5 const float PI=TMath::Pi();
9 TString core=
"/star/data05/scratch/stevens4/wAnalysisOut/apsXsec/";
10 TFile *fdQcd = TFile::Open(
"outMC/tpcEffic/uncorrected/rcf10016.wana.hist.root");
12 TFile *fdData = TFile::Open(core+
"forJoe/data/run9setABCD.wana.hist.root");
13 TFile *fdCorrected = TFile::Open(
"/star/data05/scratch/stevens4/wAnalysisOut/apsXsec/feb01/data/run9setABCD.wana.hist.root");
21 hQcd=(TH2F*)fdQcd->Get(
"muTr2D1pt5"); assert(hQcd);
22 hData=(TH2F*)fdData->Get(
"muTr2D1pt5"); assert(hData);
23 hCorr=(TH2F*)fdCorrected->Get(
"muTr2D1pt5weight"); assert(hCorr);
26 hQcdRebin=(TH2F*) hQcd->Clone();
27 hDataRebin=(TH2F*) hData->Clone();
28 hCorrRebin=(TH2F*) hCorr->Clone();
29 hQcdRebin->Rebin2D(10,10); hDataRebin->Rebin2D(10,10);
30 hCorrRebin->Rebin2D(10,10);
35 Lx=hQcd->GetListOfFunctions();
37 for(
int i=0; i<9; i++){
38 float binlim=(i*.22)-.88;
39 ln=
new TLine(binlim,-PI,binlim,PI);
40 ln->SetLineColor(kRed);
48 hRatio=(TH2F*) hQcdRebin->Clone();
49 hRatio->Divide(hDataRebin);
54 gStyle->SetOptStat(1011);
55 hRatio->ProjectionY(
"hRatioFin1",1,2);
56 hRatio->ProjectionY(
"hRatioFin2",3,4);
57 hRatio->ProjectionY(
"hRatioFin3",5,6);
58 hRatio->ProjectionY(
"hRatioFin4",7,8);
59 hRatio->ProjectionY(
"hRatioFin5",9,10);
60 hRatioFin1->SetMinimum(0);hRatioFin1->SetMaximum(0.25); hRatioFin1->SetTitle(
"Ratio MC/Data tracks eta<-0.66");
61 hRatioFin2->SetMinimum(0);hRatioFin2->SetMaximum(0.25); hRatioFin2->SetTitle(
"Ratio MC/Data tracks -0.66<eta<-0.22");
62 hRatioFin3->SetMinimum(0); hRatioFin3->SetMaximum(0.25); hRatioFin3->SetTitle(
"Ratio MC/Data tracks |eta|<0.22");
63 hRatioFin4->SetMinimum(0);hRatioFin4->SetMaximum(0.25); hRatioFin4->SetTitle(
"Ratio MC/Data tracks 0.22<eta<0.66");
64 hRatioFin5->SetMinimum(0);hRatioFin5->SetMaximum(0.25); hRatioFin5->SetTitle(
"Ratio MC/Data tracks eta>0.66");
65 c3=
new TCanvas(
"cc",
"cc",1500,500);
81 hRatio->ProjectionY(
"hRatioA",1,1); hRatioAll[0]=hRatioA;
82 hRatio->ProjectionY(
"hRatioB",2,2); hRatioAll[1]=hRatioB;
83 hRatio->ProjectionY(
"hRatioC",3,3); hRatioAll[2]=hRatioC;
84 hRatio->ProjectionY(
"hRatioH",8,8); hRatioAll[7]=hRatioH;
85 hRatio->ProjectionY(
"hRatioI",9,9); hRatioAll[8]=hRatioI;
86 hRatio->ProjectionY(
"hRatioJ",10,10); hRatioAll[9]=hRatioJ;
88 float normal[10]={0.07,0.075,0.08,0,0,0,0,0.08,0.075,0.07};
90 if(print) c=
new TCanvas(
"aa",
"aa",800,600);
91 for(
int j=0; j<10; j++){
92 if(j>2 && j<7)
continue;
93 hRatioAll[j]->SetTitle(Form(
"Eta bin %c: Ratio of tracks QCD MC to run 9 data (track pt > 5)",
'A'+j));
94 hRatioAll[j]->SetMinimum(0); hRatioAll[j]->SetLineWidth(2);
95 Lx=hRatioAll[j]->GetListOfFunctions(); hRatioAll[j]->SetStats(
false);
96 ln=
new TLine(-PI,normal[j],PI,normal[j]);
97 ln->SetLineColor(kRed); ln->SetLineWidth(2);
100 hRatioAll[j]->Draw();
101 c->Print(Form(
"etabin%c.png",
'A'+j));
111 float efficSec[10][24];
112 for(
int i=0;i<10;i++){
113 for(
int l=0;l<24;l++){
120 for(
int ieta=0; ieta<10; ieta++){
121 if(ieta>2 && ieta<7)
continue;
122 for(
int iphi=0; iphi<24; iphi++){
123 float binVal=hRatioAll[ieta]->GetBinContent(iphi+1);
124 effic[ieta][iphi]=binVal/normal[ieta];
126 phiRad=hRatioAll[ieta]->GetXaxis()->GetBinCenter(iphi+1);
129 if(ieta<3) etaDet=-1;
130 else if(ieta>6) etaDet=1;
131 const float PI=TMath::Pi();
133 float phi=phiRad/PI*180;
141 sec=13+(int)( x/30.);
144 efficSec[ieta][sec-1]+=effic[ieta][iphi]/2;
146 #if 0 //print weight arrays to use on data in W algo
147 cout<<
"mWeight"<<ieta+1<<
"={";
148 for(
int isec=0; isec<24; isec++){
150 cout<<efficSec[ieta][isec]<<
",";
155 for(
int isec=0; isec<24; isec++){
156 if(efficSec[ieta][isec]!=0) efficSec[ieta][isec]=1/efficSec[ieta][isec];
168 hCorr->Rebin2D(10,10);
169 hRatioCorr=(TH2F*) hQcdRebin->Clone();
170 hRatioCorr->Divide(hCorrRebin);
174 hCorr->ProjectionX(
"h1",1,1);
175 hCorr->ProjectionX(
"h24",24,24);
177 hMidCorr[11]=h1;hMidCorr[11]->Add(h24);
180 if(print2) c2=
new TCanvas(
"bb",
"bb",800,600);
181 for(
int iphi=1; iphi<22; iphi+=2){
182 hCorr->ProjectionX(Form(
"h",iphi+1),iphi+1,iphi+2);
183 hMidCorr[(iphi-1)/2]=h;
186 float phiRad=hCorr->GetYaxis()->GetBinCenter(iphi+1);
188 const float PI=TMath::Pi();
189 int sec1=0;
int sec2=0;
190 float phi=phiRad/PI*180;
193 sec1=1+(int)( x/30.);
196 sec2=13+(int)( x/30.);
201 float etaVal[10];
float etaEffic[10];
202 for(
int ieta=0; ieta<10; ieta++)
203 etaVal[ieta]=hMidCorr[(iphi-1)/2]->GetBinContent(ieta+1);
204 float midRapVal=(etaVal[2]+etaVal[7])/2;
205 if(sec2==13)
float midRapVal=etaVal[2];
206 for(
int ieta2=3; ieta2<7; ieta2++){
207 etaEffic[ieta2]=etaVal[ieta2]/midRapVal;
216 efficSec[ieta2][sec-1]=etaEffic[ieta2];
221 Lx=h->GetListOfFunctions();
223 ln=
new TLine(-0.44,midRapVal,0.44,midRapVal);
224 ln->SetLineColor(kRed); ln->SetLineWidth(2);
226 h->SetMinimum(0); h->SetFillColor(kBlue);
228 h->SetTitle(Form(
"Sectors %d and %d Tracks vs Eta",sec1,sec2));
234 for(
int ieta=0; ieta<10; ieta++)
235 etaVal[ieta]=hMidCorr[11]->GetBinContent(ieta+1);
236 float midRapVal=(etaVal[2]+etaVal[7])/2;
238 hMidCorr[11]->SetTitle(
"Sectors 9 and 15 Tracks vs Eta");
239 hMidCorr[11]->Draw(); hMidCorr[11]->SetMinimum(0); c2->Print(
"sec9_15.ps");
240 Lx=h->GetListOfFunctions();
241 ln=
new TLine(-PI,midRapVal,PI,midRapVal);
242 ln->SetLineColor(kRed);
245 for(
int ieta2=3; ieta2<7; ieta2++){
246 etaEffic[ieta2]=etaVal[ieta2]/midRapVal;
255 efficSec[ieta2][sec-1]=etaEffic[ieta2];
260 for(
int jeta=0;jeta<10;jeta++){
261 cout<<
"float mWeight"<<jeta+1<<
"={";
262 for(
int jsec=0;jsec<24;jsec++){
264 cout<<efficSec[jeta][jsec]<<
",";