File indexing completed on 2024-04-06 12:26:30
0001
0002
0003
0004
0005
0006
0007 {
0008 int NBINS=32;
0009 TFile *resfile=new TFile("resolution_new.root");
0010
0011 float tibrms[NBINS],tobrms[NBINS],tidrms[NBINS],tecrms[NBINS];
0012 float tibsigma[NBINS],tobsigma[NBINS],tidsigma[NBINS],tecsigma[NBINS];
0013 float tibrmserror[NBINS],tobrmserror[NBINS],tidrmserror[NBINS],tecrmserror[NBINS];
0014 float tibsigmaerror[NBINS],tobsigmaerror[NBINS],tidsigmaerror[NBINS],tecsigmaerror[NBINS];
0015 TH1F *tibres[NBINS],*tobres[NBINS],*tidres[NBINS],*tecres[NBINS];
0016 TH1F *allres[NBINS];
0017 float allrms[NBINS],allrmserror[NBINS];
0018 float allsigma[NBINS],allsigmaerror[NBINS];
0019 for(int i=0;i<NBINS;i++){
0020 cout<<Form("CPEtest/TIBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS)<<endl;
0021 tibres[i]=(TH1F*)resfile->Get(Form("CPEtest/TIBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0022 tobres[i]=(TH1F*)resfile->Get(Form("CPEtest/TOBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0023 tidres[i]=(TH1F*)resfile->Get(Form("CPEtest/TIDres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0024 tecres[i]=(TH1F*)resfile->Get(Form("CPEtest/TECres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0025 allres[i]=(TH1F*)tibres[i]->Clone(Form("Allres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0026 allres[i]->Add(tobres[i]);
0027 allres[i]->Add(tidres[i]);
0028 allres[i]->Add(tecres[i]);
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 TF1 *param_old=new TF1("error_param_old","[0]*x*exp(-x*[1])+[2]",0.,4);
0045 TF1 *newparam_old=new TF1("error_newparam_old","1/sqrt(12)",0.,4);
0046 param_old->SetParameter(0,-3.39e-01);
0047 param_old->SetParameter(1,9.0e-01);
0048 param_old->SetParameter(2,2.79e-01);
0049 newparam_old->SetLineColor(kRed);
0050 float range=newparam_old->Eval(float(i)/4+0.125)*sqrt(30);
0051 tibres[i]->GetXaxis()->SetRangeUser(-range,range);
0052 tidres[i]->GetXaxis()->SetRangeUser(-range,range);
0053 tobres[i]->GetXaxis()->SetRangeUser(-range,range);
0054 tecres[i]->GetXaxis()->SetRangeUser(-range,range);
0055 allres[i]->GetXaxis()->SetRangeUser(-range,range);
0056 tibrms[i]=tibres[i]->GetRMS();
0057 tibrmserror[i]=tibres[i]->GetRMSError();
0058 tobrms[i]=tobres[i]->GetRMS();
0059 tobrmserror[i]=tobres[i]->GetRMSError();
0060 tidrms[i]=tidres[i]->GetRMS();
0061 tidrmserror[i]=tidres[i]->GetRMSError();
0062 tecrms[i]=tecres[i]->GetRMS();
0063 tecrmserror[i]=tecres[i]->GetRMSError();
0064 allrms[i]=allres[i]->GetRMS();
0065 allrmserror[i]=allres[i]->GetRMSError();
0066 }
0067 float proj[NBINS],proje[NBINS];
0068 for (int i=0;i<NBINS;i++){proj[i]=float(i)/4+0.125; proje[i]=0.;};
0069 TGraphErrors *TIB=new TGraphErrors(NBINS/2,proj,tibrms,proje,tibrmserror);
0070 TGraphErrors *TOB=new TGraphErrors(NBINS/2,proj,tobrms,proje,tobrmserror);
0071 TGraphErrors *TID=new TGraphErrors(NBINS/2,proj,tidrms,proje,tidrmserror);
0072 TGraphErrors *TEC=new TGraphErrors(NBINS/2,proj,tecrms,proje,tecrmserror);
0073 TGraphErrors *ALL=new TGraphErrors(NBINS/2,proj,allrms,proje,allrmserror);
0074
0075 TF1 *errparamtib=new TF1("error_paramtib","((x-[0])*(x-[0])*([1]-[2])/([0]*[0])+[2])",0.01,4);
0076 errparamtib->SetParameter(0,38.07*0.032);
0077 errparamtib->SetParameter(1,0.3184);
0078 errparamtib->SetParameter(2,0.09828);
0079 TF1 *errparamtob=new TF1("error_paramtob","((x-[0])*(x-[0])*([1]-[2])/([0]*[0])+[2])",0.01,4);
0080 errparamtob->SetParameter(0,38.07*0.05);
0081 errparamtob->SetParameter(1,0.3184);
0082 errparamtob->SetParameter(2,0.09828);
0083
0084
0085 TF1 *newparam=new TF1("error_param","[0]*x*exp(-x*[1])+[2]",0.,4);
0086
0087
0088 newparam->SetParameter(0,-0.339);
0089 newparam->SetParameter(1,0.9);
0090 newparam->SetParameter(2,0.279);
0091
0092 gROOT->SetStyle("Plain");
0093
0094
0095 TCanvas * plot=new TCanvas("resolution","resolution");
0096 plot->Divide(2,2,0.001,0.001);
0097 plot->cd(1);
0098 TIB->SetMaximum(0.4);
0099 TIB->SetMinimum(0.);
0100 TIB->GetHistogram()->GetXaxis()->SetTitle("W_{track}");
0101 TIB->GetHistogram()->GetYaxis()->SetTitle("Resolution");
0102 TIB->GetHistogram()->SetTitle("TIB");
0103 TIB->GetHistogram()->GetXaxis()->SetRangeUser(0,4);
0104 TIB->Draw("ap");
0105
0106 TLine *l=new TLine(0,1./sqrt(12),4,1./sqrt(12));
0107 l->SetLineColor(3);
0108 l->SetLineWidth(2);
0109
0110
0111
0112
0113
0114 plot->cd(2);
0115 TOB->SetMaximum(0.4);
0116 TOB->SetMinimum(0.);
0117 TOB->GetHistogram()->GetXaxis()->SetTitle("W_{track}");
0118 TOB->GetHistogram()->GetYaxis()->SetTitle("Resolution");
0119 TOB->GetHistogram()->GetXaxis()->SetRangeUser(0,4);
0120 TOB->GetHistogram()->SetTitle("TOB");
0121 TOB->Draw("ap");
0122
0123 TLine *l=new TLine(0,1./sqrt(12),4,1./sqrt(12));
0124 l->SetLineColor(3);
0125 l->SetLineWidth(2);
0126
0127
0128
0129
0130
0131 plot->cd(3);
0132 TID->SetMaximum(0.4);
0133 TID->SetMinimum(0.);
0134 TID->GetHistogram()->GetXaxis()->SetTitle("W_{track}");
0135 TID->GetHistogram()->GetYaxis()->SetTitle("Resolution");
0136 TID->GetHistogram()->GetXaxis()->SetRangeUser(0,4);
0137 TID->GetHistogram()->SetTitle("TID");
0138 TID->Draw("ap");
0139
0140 TLine *l=new TLine(0,1./sqrt(12),4,1./sqrt(12));
0141 l->SetLineColor(3);
0142
0143
0144
0145
0146
0147 plot->cd(4);
0148 TEC->SetMaximum(0.4);
0149 TEC->SetMinimum(0.);
0150 TEC->GetHistogram()->GetXaxis()->SetTitle("W_{track}");
0151 TEC->GetHistogram()->GetYaxis()->SetTitle("Resolution");
0152 TEC->GetHistogram()->GetXaxis()->SetRangeUser(0,4);
0153 TEC->GetHistogram()->SetTitle("TEC");
0154 TEC->Draw("ap");
0155
0156 TLine *l=new TLine(0,1./sqrt(12),4,1./sqrt(12));
0157 l->SetLineColor(3);
0158 l->SetLineWidth(2);
0159
0160
0161
0162 gStyle->SetOptFit(1111);
0163
0164 TCanvas * plot2=new TCanvas("resolution2","resolution2");
0165 ALL->SetMaximum(0.4);
0166 ALL->SetMinimum(0.);
0167 ALL->GetHistogram()->SetTitle("Hit resolution");
0168 ALL->GetHistogram()->SetMarkerStyle(20);
0169 ALL->GetHistogram()->GetXaxis()->SetTitle("Track projection (n. strip)");
0170 ALL->GetHistogram()->GetYaxis()->SetTitle("Resolution (units of pitch)");
0171 ALL->GetHistogram()->GetXaxis()->SetRangeUser(0,4);
0172 ALL->Draw("ap");
0173 ALL->Fit(newparam);
0174 TLine *l=new TLine(0,1./sqrt(12),4,1./sqrt(12));
0175 l->SetLineColor(3);
0176
0177 param_old->SetLineColor(kRed);
0178 param_old->Draw("same");
0179 }