File indexing completed on 2024-04-06 12:26:30
0001
0002
0003
0004
0005
0006
0007 {
0008 int NBINS=32;
0009
0010 TFile *resfile=new TFile("resolution.root");
0011 float tibrms[NBINS],tobrms[NBINS],tidrms[NBINS],tecrms[NBINS];
0012 float tibrmserror[NBINS],tobrmserror[NBINS],tidrmserror[NBINS],tecrmserror[NBINS];
0013 TH1F *tibres[NBINS],*tobres[NBINS],*tidres[NBINS],*tecres[NBINS];
0014 TH1F *allres[NBINS];
0015 float allrms[NBINS],allrmserror[NBINS];
0016 for(int i=0;i<NBINS;i++){
0017 TH1F *tibres[i]=(TH1F*)resfile->Get(Form("mTIBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0018 TH1F *tobres[i]=(TH1F*)resfile->Get(Form("mTOBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0019 TH1F *tidres[i]=(TH1F*)resfile->Get(Form("mTIDres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0020 TH1F *tecres[i]=(TH1F*)resfile->Get(Form("mTECres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0021 allres[i]=(TH1F*)tibres[i]->Clone(Form("Allres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0022 allres[i]->Add(tobres[i]);
0023 allres[i]->Add(tidres[i]);
0024 allres[i]->Add(tecres[i]);
0025 tibres[i]->Fit("gaus");
0026 tobres[i]->Fit("gaus");
0027 tidres[i]->Fit("gaus");
0028 tecres[i]->Fit("gaus");
0029 allres[i]->Fit("gaus");
0030 tibrms[i]=tibres[i]->GetRMS();
0031 tibrmserror[i]=tibres[i]->GetRMSError();
0032 tobrms[i]=tobres[i]->GetRMS();
0033 tobrmserror[i]=tobres[i]->GetRMSError();
0034 tidrms[i]=tidres[i]->GetRMS();
0035 tidrmserror[i]=tidres[i]->GetRMSError();
0036 tecrms[i]=tecres[i]->GetRMS();
0037 tecrmserror[i]=tecres[i]->GetRMSError();
0038 allrms[i]=allres[i]->GetRMS();
0039 allrmserror[i]=allres[i]->GetRMSError();
0040 }
0041 float proj[NBINS],proje[NBINS];
0042 for (int i=0;i<NBINS;i++){proj[i]=float(i)/4+0.125; proje[i]=0;};
0043 TGraphErrors *TIB=new TGraphErrors(NBINS,proj,tibrms,proje,tibrmserror);
0044 TGraphErrors *TOB=new TGraphErrors(NBINS,proj,tobrms,proje,tobrmserror);
0045 TGraphErrors *TID=new TGraphErrors(NBINS,proj,tidrms,proje,tidrmserror);
0046 TGraphErrors *TEC=new TGraphErrors(NBINS,proj,tecrms,proje,tecrmserror);
0047 TGraphErrors *ALL=new TGraphErrors(NBINS,proj,allrms,proje,allrmserror);
0048
0049
0050
0051
0052
0053 TProfile *tiberr=(TProfile*)resfile->Get("mTIBtksqrterrvsprojx");
0054 TProfile *toberr=(TProfile*)resfile->Get("mTOBtksqrterrvsprojx");
0055 TProfile *tiderr=(TProfile*)resfile->Get("mTIDtksqrterrvsprojx");
0056 TProfile *tecerr=(TProfile*)resfile->Get("mTECtksqrterrvsprojx");
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 TCanvas * plot=new TCanvas("resolution","resolution");
0077 plot->Divide(2,2);
0078 plot->cd(1);
0079 TIB->SetMaximum(0.4);
0080 TIB->SetMinimum(0.);
0081 TIB->GetHistogram()->GetXaxis()->SetRangeUser(0,4);
0082 TIB->Draw("ap");
0083
0084 TLine *l=new TLine(0,1./sqrt(12),4,1./sqrt(12));
0085 l->SetLineColor(3);
0086 l->Draw("same");
0087
0088 tiberr->SetMarkerColor(2);
0089 tiberr->SetLineColor(2);
0090 tiberr->Draw("same");
0091
0092
0093
0094
0095 plot->cd(2);
0096 TOB->SetMaximum(0.4);
0097 TOB->SetMinimum(0.);
0098 TOB->GetHistogram()->GetXaxis()->SetRangeUser(0,4);
0099 TOB->Draw("ap");
0100
0101 TLine *l=new TLine(0,1./sqrt(12),4,1./sqrt(12));
0102 l->SetLineColor(3);
0103 l->Draw("same");
0104 toberr->SetMarkerColor(2);
0105 toberr->SetLineColor(2);
0106
0107 toberr->Draw("same");
0108
0109
0110
0111
0112 plot->cd(3);
0113 TID->SetMaximum(0.4);
0114 TID->SetMinimum(0.);
0115 TID->GetHistogram()->GetXaxis()->SetRangeUser(0,4);
0116 TID->Draw("ap");
0117
0118 TLine *l=new TLine(0,1./sqrt(12),8,1./sqrt(12));
0119 l->SetLineColor(3);
0120 l->Draw("same");
0121
0122 tiderr->SetMarkerColor(2);
0123 tiderr->SetLineColor(2);
0124 tiderr->Draw("same");
0125
0126
0127
0128
0129 plot->cd(4);
0130 TEC->SetMaximum(0.4);
0131 TEC->SetMinimum(0.);
0132 TEC->GetHistogram()->GetXaxis()->SetRangeUser(0,4);
0133 TEC->Draw("ap");
0134
0135 TLine *l=new TLine(0,1./sqrt(12),4,1./sqrt(12));
0136 l->SetLineColor(3);
0137 l->Draw("same");
0138 tecerr->SetMarkerColor(2);
0139 tecerr->SetLineColor(2);
0140 tecerr->Draw("same");
0141
0142
0143
0144
0145 TCanvas * plot2=new TCanvas("resolution2","resolution2");
0146 ALL->SetMaximum(0.4);
0147 ALL->SetMinimum(0.);
0148 ALL->GetHistogram()->GetXaxis()->SetRangeUser(0,4);
0149 ALL->Draw("ap");
0150
0151 TLine *l=new TLine(0,1./sqrt(12),4,1./sqrt(12));
0152 l->SetLineColor(3);
0153 l->Draw("same");
0154 }