Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:14

0001 {
0002   int NBINS=32;
0003   TFile *resfile1=new TFile("resolution_2.5.root");
0004   TFile *resfile2=new TFile("resolution_3.5.root");
0005   TFile *resfile3=new TFile("resolution_4.root");
0006 
0007   float tibrms1[NBINS],tobrms1[NBINS],tidrms1[NBINS],tecrms1[NBINS];
0008   float tibrmserror1[NBINS],tobrmserror1[NBINS],tidrmserror1[NBINS],tecrmserror1[NBINS];
0009 
0010   float tibrms2[NBINS],tobrms2[NBINS],tidrms2[NBINS],tecrms2[NBINS];
0011   float tibrmserror2[NBINS],tobrmserror2[NBINS],tidrmserror2[NBINS],tecrmserror2[NBINS];
0012 
0013   float tibrms3[NBINS],tobrms3[NBINS],tidrms3[NBINS],tecrms3[NBINS];
0014   float tibrmserror3[NBINS],tobrmserror3[NBINS],tidrmserror3[NBINS],tecrmserror3[NBINS];
0015 
0016   TH1F *tibres1[NBINS],*tobres1[NBINS],*tidres1[NBINS],*tecres1[NBINS];
0017   TH1F *allres1[NBINS];
0018   float allrms1[NBINS],allrmserror1[NBINS];
0019 
0020   TH1F *tibres2[NBINS],*tobres2[NBINS],*tidres2[NBINS],*tecres2[NBINS];
0021   TH1F *allres2[NBINS];
0022   float allrms2[NBINS],allrmserror2[NBINS];
0023 
0024   TH1F *tibres3[NBINS],*tobres3[NBINS],*tidres3[NBINS],*tecres3[NBINS];
0025   TH1F *allres3[NBINS];
0026   float allrms3[NBINS],allrmserror3[NBINS];
0027 
0028   float proj[NBINS],proje[NBINS];
0029   TF1 *newparam_old=new TF1("error_param_old","1/sqrt(12)",0.,8);
0030   for(int i=0;i<NBINS;i++){
0031     tibres1[i]=(TH1F*)resfile1->Get(Form("TIBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0032     tobres1[i]=(TH1F*)resfile1->Get(Form("TOBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0033     tidres1[i]=(TH1F*)resfile1->Get(Form("TIDres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0034     tecres1[i]=(TH1F*)resfile1->Get(Form("TECres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0035     allres1[i]=(TH1F*)tibres1[i]->Clone(Form("Allres1_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0036     allres1[i]->Add(tobres1[i]);
0037     allres1[i]->Add(tidres1[i]);
0038     allres1[i]->Add(tecres1[i]);
0039     tibres2[i]=(TH1F*)resfile2->Get(Form("TIBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0040     tobres2[i]=(TH1F*)resfile2->Get(Form("TOBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0041     tidres2[i]=(TH1F*)resfile2->Get(Form("TIDres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0042     tecres2[i]=(TH1F*)resfile2->Get(Form("TECres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0043     allres2[i]=(TH1F*)tibres2[i]->Clone(Form("Allres2_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0044     allres2[i]->Add(tobres2[i]);
0045     allres2[i]->Add(tidres2[i]);
0046     allres2[i]->Add(tecres2[i]);
0047     tibres3[i]=(TH1F*)resfile3->Get(Form("TIBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0048     tobres3[i]=(TH1F*)resfile3->Get(Form("TOBres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0049     tidres3[i]=(TH1F*)resfile3->Get(Form("TIDres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0050     tecres3[i]=(TH1F*)resfile3->Get(Form("TECres_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0051     allres3[i]=(TH1F*)tibres3[i]->Clone(Form("Allres3_%f-%f",i*8./NBINS,i*8./NBINS+8./NBINS));
0052     allres3[i]->Add(tobres3[i]);
0053     allres3[i]->Add(tidres3[i]);
0054     allres3[i]->Add(tecres3[i]);
0055 
0056     //    float range=newparam_old->Eval(float(i)/4+0.125)*sqrt(30);
0057 
0058     float range=10;
0059     tibres1[i]->GetXaxis()->SetRangeUser(-range,range);
0060     tidres1[i]->GetXaxis()->SetRangeUser(-range,range);
0061     tobres1[i]->GetXaxis()->SetRangeUser(-range,range);
0062     tecres1[i]->GetXaxis()->SetRangeUser(-range,range);
0063     allres1[i]->GetXaxis()->SetRangeUser(-range,range);
0064     tibrms1[i]=tibres1[i]->GetRMS();
0065     tibrmserror1[i]=tibres1[i]->GetRMSError();
0066     tobrms1[i]=tobres1[i]->GetRMS();
0067     tobrmserror1[i]=tobres1[i]->GetRMSError();
0068     tidrms1[i]=tidres1[i]->GetRMS();
0069     tidrmserror1[i]=tidres1[i]->GetRMSError();
0070     tecrms1[i]=tecres1[i]->GetRMS();
0071     tecrmserror1[i]=tecres1[i]->GetRMSError();
0072     allrms1[i]=allres1[i]->GetRMS();
0073     allrmserror1[i]=allres1[i]->GetRMSError();
0074     tibres2[i]->GetXaxis()->SetRangeUser(-range,range);
0075     tidres2[i]->GetXaxis()->SetRangeUser(-range,range);
0076     tobres2[i]->GetXaxis()->SetRangeUser(-range,range);
0077     tecres2[i]->GetXaxis()->SetRangeUser(-range,range);
0078     allres2[i]->GetXaxis()->SetRangeUser(-range,range);
0079     tibrms2[i]=tibres2[i]->GetRMS();
0080     tibrmserror2[i]=tibres2[i]->GetRMSError();
0081     tobrms2[i]=tobres2[i]->GetRMS();
0082     tobrmserror2[i]=tobres2[i]->GetRMSError();
0083     tidrms2[i]=tidres2[i]->GetRMS();
0084     tidrmserror2[i]=tidres2[i]->GetRMSError();
0085     tecrms2[i]=tecres2[i]->GetRMS();
0086     tecrmserror2[i]=tecres2[i]->GetRMSError();
0087     allrms2[i]=allres2[i]->GetRMS();
0088     allrmserror2[i]=allres2[i]->GetRMSError();
0089     tibres3[i]->GetXaxis()->SetRangeUser(-range,range);
0090     tidres3[i]->GetXaxis()->SetRangeUser(-range,range);
0091     tobres3[i]->GetXaxis()->SetRangeUser(-range,range);
0092     tecres3[i]->GetXaxis()->SetRangeUser(-range,range);
0093     allres3[i]->GetXaxis()->SetRangeUser(-range,range);
0094     tibrms3[i]=tibres3[i]->GetRMS();
0095     tibrmserror3[i]=tibres3[i]->GetRMSError();
0096     tobrms3[i]=tobres3[i]->GetRMS();
0097     tobrmserror3[i]=tobres3[i]->GetRMSError();
0098     tidrms3[i]=tidres3[i]->GetRMS();
0099     tidrmserror3[i]=tidres3[i]->GetRMSError();
0100     tecrms3[i]=tecres3[i]->GetRMS();
0101     tecrmserror3[i]=tecres3[i]->GetRMSError();
0102     allrms3[i]=allres3[i]->GetRMS();
0103     allrmserror3[i]=allres3[i]->GetRMSError();
0104 
0105     proj[i]=float(i)/4+0.125; proje[i]=0.125;
0106   }
0107     TGraphErrors *TIB1=new TGraphErrors(NBINS,proj,tibrms1,proje,tibrmserror1);
0108     TGraphErrors *TOB1=new TGraphErrors(NBINS,proj,tobrms1,proje,tobrmserror1);
0109     TGraphErrors *TID1=new TGraphErrors(NBINS,proj,tidrms1,proje,tidrmserror1);
0110     TGraphErrors *TEC1=new TGraphErrors(NBINS,proj,tecrms1,proje,tecrmserror1);
0111     TGraphErrors *ALL1=new TGraphErrors(NBINS,proj,allrms1,proje,allrmserror1);
0112 
0113     TGraphErrors *TIB2=new TGraphErrors(NBINS,proj,tibrms2,proje,tibrmserror2);
0114     TGraphErrors *TOB2=new TGraphErrors(NBINS,proj,tobrms2,proje,tobrmserror2);
0115     TGraphErrors *TID2=new TGraphErrors(NBINS,proj,tidrms2,proje,tidrmserror2);
0116     TGraphErrors *TEC2=new TGraphErrors(NBINS,proj,tecrms2,proje,tecrmserror2);
0117     TGraphErrors *ALL2=new TGraphErrors(NBINS,proj,allrms2,proje,allrmserror2);
0118 
0119     TGraphErrors *TIB3=new TGraphErrors(NBINS,proj,tibrms3,proje,tibrmserror3);
0120     TGraphErrors *TOB3=new TGraphErrors(NBINS,proj,tobrms3,proje,tobrmserror3);
0121     TGraphErrors *TID3=new TGraphErrors(NBINS,proj,tidrms3,proje,tidrmserror3);
0122     TGraphErrors *TEC3=new TGraphErrors(NBINS,proj,tecrms3,proje,tecrmserror3);
0123     TGraphErrors *ALL3=new TGraphErrors(NBINS,proj,allrms3,proje,allrmserror3);
0124 
0125     TCanvas * plot1=new TCanvas("resolution_subdetectors","resolution_subdetectors");
0126     plot1->Divide(2,2);
0127     plot1->cd(1);
0128     TIB1->SetMaximum(1);
0129     TIB1->SetMinimum(0.);
0130     TIB1->GetHistogram()->GetXaxis()->SetTitle("Track projection");
0131     TIB1->GetHistogram()->SetTitle("TIB");
0132     TIB1->Draw("ap");
0133     TIB2->SetMarkerColor(2);
0134     TIB2->SetLineColor(2);
0135     TIB3->SetMarkerColor(3);
0136     TIB3->SetLineColor(3);
0137     TIB2->Draw("p");
0138     TIB3->Draw("p");
0139 
0140     plot1->cd(2);
0141     TOB1->SetMaximum(1);
0142     TOB1->SetMinimum(0.);
0143     TOB1->GetHistogram()->GetXaxis()->SetTitle("Track projection");
0144     TOB1->GetHistogram()->SetTitle("TOB");
0145     TOB1->Draw("ap");
0146     TOB2->SetMarkerColor(2);
0147     TOB2->SetLineColor(2);
0148     TOB3->SetMarkerColor(3);
0149     TOB3->SetLineColor(3);
0150     TOB2->Draw("p");
0151     TOB3->Draw("p");
0152 
0153     plot1->cd(3);
0154     TID1->SetMaximum(1);
0155     TID1->SetMinimum(0.);
0156     TID1->GetHistogram()->GetXaxis()->SetTitle("Track projection");
0157     TID1->GetHistogram()->SetTitle("TID");
0158     TID1->Draw("ap");
0159     TID2->SetMarkerColor(2);
0160     TID2->SetLineColor(2);
0161     TID3->SetMarkerColor(3);
0162     TID3->SetLineColor(3);
0163     TID2->Draw("p");
0164     TID3->Draw("p");
0165 
0166     plot1->cd(4);
0167     TEC1->SetMaximum(1);
0168     TEC1->SetMinimum(0.);
0169     TEC1->GetHistogram()->GetXaxis()->SetTitle("Track projection");
0170     TEC1->GetHistogram()->SetTitle("TEC");
0171     TEC1->Draw("ap");
0172     TEC2->SetMarkerColor(2);
0173     TEC2->SetLineColor(2);
0174     TEC3->SetMarkerColor(3);
0175     TEC3->SetLineColor(3);
0176     TEC2->Draw("p");
0177     TEC3->Draw("p");
0178 
0179     TCanvas * plot2=new TCanvas("resolution_all","resolution_all");
0180     plot2->cd();
0181     ALL1->SetMaximum(1);
0182     ALL1->SetMinimum(0.);
0183     ALL1->GetHistogram()->GetXaxis()->SetTitle("Track projection");
0184     ALL1->GetHistogram()->SetTitle("ALL");
0185     ALL1->Draw("ap");
0186     ALL2->SetMarkerColor(2);
0187     ALL2->SetLineColor(2);
0188     ALL3->SetMarkerColor(3);
0189     ALL3->SetLineColor(3);
0190     ALL2->Draw("p");
0191     //    ALL3->Draw("p");
0192   
0193 }