Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:04

0001 {
0002 gStyle->SetNdivisions(5);
0003 gStyle->SetCanvasBorderMode(0); 
0004 gStyle->SetPadBorderMode(1);
0005 gStyle->SetOptTitle(1);
0006 gStyle->SetStatFont(42);
0007 gStyle->SetCanvasColor(10);
0008 gStyle->SetPadColor(0);
0009 gStyle->SetTitleFont(62,"xy");
0010 gStyle->SetLabelFont(62,"xy");
0011 gStyle->SetTitleFontSize(0.05);
0012 gStyle->SetTitleSize(0.045,"xy");
0013 gStyle->SetLabelSize(0.05,"xy");
0014 gStyle->SetHistFillStyle(1001);
0015 gStyle->SetHistFillColor(0);
0016 gStyle->SetHistLineStyle(1);
0017 gStyle->SetHistLineWidth(1);
0018 gStyle->SetHistLineColor(1);
0019 gStyle->SetTitleXOffset(1.11);
0020 gStyle->SetTitleYOffset(0.95);
0021 gStyle->SetOptStat(1110);
0022 gStyle->SetOptStat(kFALSE);
0023 gStyle->SetOptFit(0111);
0024 gStyle->SetStatH(0.1); 
0025 
0026 TCanvas *Canv = new TCanvas("c1","c1",129,17,926,703);
0027 Canv->SetBorderSize(2);
0028 Canv->SetFrameFillColor(0);
0029 Canv->SetLogy(1);
0030 Canv->SetGrid(1,1);
0031 Canv->cd(); 
0032 
0033 
0034 TFile f0("ValidationMisalignedTracker_singlemu100_merged.root");
0035 TTree *MyTree=EffTracks;
0036 
0037 TFile f1("../../SurveyLAS/singlemu/Misalignment_SurveyLASOnlyScenario_refitter_singlemu.root");
0038 TTree *MyTree2=Tracks;
0039 
0040 TFile f2("Misalignment_SurveyLASOnlyScenario_refitter_zmumu_singlemuSurveyLASCosmics.root");
0041 TTree *MyTree3=Tracks;
0042 
0043 TFile f3("../../singlemu_310607/Misalignment10.root");
0044 TTree *MyTree4=Tracks;
0045 
0046 TFile f4("../../singlemu_310607/Misalignment100.root");
0047 TTree *MyTree5=Tracks;
0048 
0049 
0050 int nbin=25;
0051 float binwidth=2.5/nbin;
0052 float binstart=0.,binstop=0.;
0053 char cutname[128];
0054 float mean[nbin],sigma[nbin],cost[nbin],entry[nbin],meanorig[nbin],etabin[nbin],erretabin[nbin],chiq[nbin],ndf[nbin],rms[nbin],errsigma[nbin];
0055 
0056 for (int i=0;i<nbin;i++){
0057   meanorig[i]=0.;
0058   mean[i]=0.;
0059   sigma[i]=0.;
0060   cost[i]=0.;
0061   entry[i]=0.;
0062   etabin[i]=0.;
0063   chiq[i]=0.;
0064   ndf[i]=0.;
0065   rms[i]=0.;
0066   errsigma[i]=0.;
0067 }
0068 
0069 
0070 //cout << "binwidth is " << binwidth << endl; 
0071 
0072 
0073 // //////////////////////////////////////////////////////////////////
0074 // d0 resolution
0075 /////////////////////////////////////////////////////////////////////
0076 
0077 
0078 for (int i=1;i<=nbin;i++){
0079   binstart=0.1*(i-1);
0080   binstop = 0.1*i;
0081   etabin[i-1]= (binstop-binstart)/2.+binstart;
0082   erretabin[i-1]=(binstop-binstart)/2.;
0083   cout << "binstart=" << binstart << " binstop is=" << binstop << " eta is " << etabin[i-1] << endl;
0084   sprintf(cutname,"abs(eta)>=%f && abs(eta)<%f && eff==1 && TrackID==13",binstart, binstop);
0085   cout << "cutname is " << cutname <<endl;
0086   TH1F *resd0= new TH1F("d0","d0",500,-0.004,0.004);   
0087   MyTree->Project("d0","(rescottheta)",cutname);
0088   resd0->Fit("gaus");
0089   meanorig[i-1]=1.*resd0->GetMean();
0090   rms[i-1]=1.*resd0->GetRMS();
0091   cost[i-1]=gaus->GetParameter(0);
0092   mean[i-1]=1*gaus->GetParameter(1);
0093   sigma[i-1]=1*gaus->GetParameter(2);
0094   errsigma[i-1]=1*gaus->GetParError(2);
0095   entry[i-1]=resd0->GetEntries();
0096   //chiq[i-1]=(gaus->GetChisquare()) /(gaus->GetNDF());
0097 //  cout << "mean is= " << mean[i-1] << " sigma is= " << sigma[i-1]/(sqrt(entry[i-1])) << " Entries= " << entry[i-1] << endl;
0098   delete resd0;
0099 }
0100 
0101 for (int i=0;i<nbin;i++){
0102   binstart=0.1*(i);
0103   binstop = 0.1*(i+1);
0104   cout << "binstart= " << binstart << " binstop= " << binstop << endl;
0105   cout << " etabin=" << etabin[i] << " Vector mean/sigma are "<< mean[i] << " +/- " << sigma[i] << endl;
0106   cout << " ErrOnSigma =" << errsigma[i] << " Mean/RMS orig =" << meanorig[i] << " +/-" << rms[i] << endl;
0107 }
0108 
0109 hframe = new TH2F("hframe","Rescottheta_gaus",25,0.,2.5,100,0.00015,0.01);
0110 hframe->SetTitle("#sigma(cot#theta) vs #eta, p_{T} = 100 GeV/c");
0111 hframe->SetXTitle("#eta");
0112 hframe->SetYTitle("#sigma(cot#theta)");
0113 hframe->Draw();
0114 gr = new TGraphErrors(25,etabin,sigma,erretabin,errsigma);
0115 gr->SetMarkerColor(2);
0116 gr->SetMarkerStyle(20);
0117 gr->Draw("P");
0118 Canv->Update();
0119 //Canv->SaveAs("Rescottheta_gaus_scen0.eps");
0120 //Canv->WaitPrimitive();
0121 
0122 // //////////////////////////////////////////////////////////////////
0123 // d0 resolution scen1
0124 /////////////////////////////////////////////////////////////////////
0125 for (int i=1;i<=nbin;i++){
0126   binstart=0.1*(i-1);
0127   binstop = 0.1*i;
0128   etabin[i-1]= (binstop-binstart)/2.+binstart;
0129   erretabin[i-1]=(binstop-binstart)/2.;
0130   cout << "binstart=" << binstart << " binstop is=" << binstop << " eta is " << etabin[i-1] << endl;
0131   sprintf(cutname,"abs(eta)>=%f && abs(eta)<%f && eff==1 && TrackID==13",binstart, binstop);
0132   cout << "cutname is " << cutname <<endl;
0133   TH1F *resd0= new TH1F("d0","d0",250,-0.004,0.004);   
0134   MyTree2->Project("d0","(rescottheta)",cutname);
0135   resd0->Fit("gaus");
0136   meanorig[i-1]=1.*resd0->GetMean();
0137   rms[i-1]=1.*resd0->GetRMS();
0138   cost[i-1]=gaus->GetParameter(0);
0139   mean[i-1]=1*gaus->GetParameter(1);
0140   sigma[i-1]=1*gaus->GetParameter(2);
0141   errsigma[i-1]=1*gaus->GetParError(2);
0142   entry[i-1]=resd0->GetEntries();
0143   //chiq[i-1]=(gaus->GetChisquare()) /(gaus->GetNDF());
0144 //  cout << "mean is= " << mean[i-1] << " sigma is= " << sigma[i-1]/(sqrt(entry[i-1])) << " Entries= " << entry[i-1] << endl;
0145   delete resd0;
0146 }
0147 
0148 for (int i=0;i<nbin;i++){
0149   binstart=0.1*(i);
0150   binstop = 0.1*(i+1);
0151   cout << "binstart= " << binstart << " binstop= " << binstop << endl;
0152   cout << " etabin=" << etabin[i] << " Vector mean/sigma are "<< mean[i] << " +/- " << sigma[i] << endl;
0153   cout << " ErrOnSigma =" << errsigma[i] << " Mean/RMS orig =" << meanorig[i] << " +/-" << rms[i] << endl;
0154 }
0155 
0156 hframe_scen1 = new TH2F("hframe_scen1","Rescottheta_gaus_scen1",25,0.,2.5,100,0.00015,0.01);
0157 hframe_scen1->SetTitle("#sigma(cot#theta) vs #eta, p_{T} = 100 GeV/c");
0158 hframe_scen1->SetXTitle("#eta");
0159 hframe_scen1->SetYTitle("#sigma(cot#theta)");
0160 hframe_scen1->Draw();
0161 gr_scen1 = new TGraphErrors(25,etabin,sigma,erretabin,errsigma);
0162 gr_scen1->SetMarkerColor(3);
0163 gr_scen1->SetMarkerStyle(21);
0164 gr_scen1->Draw("P");
0165 Canv->Update();
0166 //Canv->SaveAs("Rescottheta_gaus_scen1.eps");
0167 //Canv->WaitPrimitive();
0168 
0169 // //////////////////////////////////////////////////////////////////
0170 // d0 resolution scen2
0171 /////////////////////////////////////////////////////////////////////
0172 for (int i=1;i<=nbin;i++){
0173   binstart=0.1*(i-1);
0174   binstop = 0.1*i;
0175   etabin[i-1]= (binstop-binstart)/2.+binstart;
0176   erretabin[i-1]=(binstop-binstart)/2.;
0177   cout << "binstart=" << binstart << " binstop is=" << binstop << " eta is " << etabin[i-1] << endl;
0178   sprintf(cutname,"abs(eta)>=%f && abs(eta)<%f && eff==1 && TrackID==13",binstart, binstop);
0179   cout << "cutname is " << cutname <<endl;
0180   TH1F *resd0= new TH1F("d0","d0",250,-0.004,0.004);   
0181   MyTree3->Project("d0","(rescottheta)",cutname);
0182   resd0->Fit("gaus");
0183   meanorig[i-1]=1.*resd0->GetMean();
0184   rms[i-1]=1.*resd0->GetRMS();
0185   cost[i-1]=gaus->GetParameter(0);
0186   mean[i-1]=1*gaus->GetParameter(1);
0187   sigma[i-1]=1*gaus->GetParameter(2);
0188   errsigma[i-1]=1*gaus->GetParError(2);
0189   entry[i-1]=resd0->GetEntries();
0190   //chiq[i-1]=(gaus->GetChisquare()) /(gaus->GetNDF());
0191 //  cout << "mean is= " << mean[i-1] << " sigma is= " << sigma[i-1]/(sqrt(entry[i-1])) << " Entries= " << entry[i-1] << endl;
0192   delete resd0;
0193 }
0194 
0195 for (int i=0;i<nbin;i++){
0196   binstart=0.1*(i);
0197   binstop = 0.1*(i+1);
0198   cout << "binstart= " << binstart << " binstop= " << binstop << endl;
0199   cout << " etabin=" << etabin[i] << " Vector mean/sigma are "<< mean[i] << " +/- " << sigma[i] << endl;
0200   cout << " ErrOnSigma =" << errsigma[i] << " Mean/RMS orig =" << meanorig[i] << " +/-" << rms[i] << endl;
0201 }
0202 
0203 hframe_scen2 = new TH2F("hframe_scen2","Rescottheta_gaus_scen2",25,0.,2.5,100,0.00015,0.01);
0204 hframe_scen2->SetTitle("#sigma(cot#theta) vs #eta, p_{T} = 100 GeV/c");
0205 hframe_scen2->SetXTitle("#eta");
0206 hframe_scen2->SetYTitle("#sigma(cot#theta)");
0207 hframe_scen2->Draw();
0208 gr_scen2 = new TGraphErrors(25,etabin,sigma,erretabin,errsigma);
0209 gr_scen2->SetMarkerColor(4);
0210 gr_scen2->SetMarkerStyle(22);
0211 gr_scen2->Draw("P");
0212 Canv->Update();
0213 //Canv->SaveAs("Rescottheta_gaus_scen2.eps");
0214 //Canv->WaitPrimitive();
0215 
0216 // //////////////////////////////////////////////////////////////////
0217 // d0 resolution scen3
0218 /////////////////////////////////////////////////////////////////////
0219 for (int i=1;i<=nbin;i++){
0220   binstart=0.1*(i-1);
0221   binstop = 0.1*i;
0222   etabin[i-1]= (binstop-binstart)/2.+binstart;
0223   erretabin[i-1]=(binstop-binstart)/2.;
0224   cout << "binstart=" << binstart << " binstop is=" << binstop << " eta is " << etabin[i-1] << endl;
0225   sprintf(cutname,"abs(eta)>=%f && abs(eta)<%f && eff==1 && TrackID==13",binstart, binstop);
0226   cout << "cutname is " << cutname <<endl;
0227   TH1F *resd0= new TH1F("d0","d0",500,-0.004,0.004);   
0228   MyTree4->Project("d0","(rescottheta)",cutname);
0229   resd0->Fit("gaus");
0230   meanorig[i-1]=1.*resd0->GetMean();
0231   rms[i-1]=1.*resd0->GetRMS();
0232   cost[i-1]=gaus->GetParameter(0);
0233   mean[i-1]=1*gaus->GetParameter(1);
0234   sigma[i-1]=1*gaus->GetParameter(2);
0235   errsigma[i-1]=1*gaus->GetParError(2);
0236   entry[i-1]=resd0->GetEntries();
0237   //chiq[i-1]=(gaus->GetChisquare()) /(gaus->GetNDF());
0238 //  cout << "mean is= " << mean[i-1] << " sigma is= " << sigma[i-1]/(sqrt(entry[i-1])) << " Entries= " << entry[i-1] << endl;
0239   delete resd0;
0240 }
0241 
0242 for (int i=0;i<nbin;i++){
0243   binstart=0.1*(i);
0244   binstop = 0.1*(i+1);
0245   cout << "binstart= " << binstart << " binstop= " << binstop << endl;
0246   cout << " etabin=" << etabin[i] << " Vector mean/sigma are "<< mean[i] << " +/- " << sigma[i] << endl;
0247   cout << " ErrOnSigma =" << errsigma[i] << " Mean/RMS orig =" << meanorig[i] << " +/-" << rms[i] << endl;
0248 }
0249 
0250 hframe_scen3 = new TH2F("hframe_scen3","Rescottheta_gaus_scen3",25,0.,2.5,100,0.00015,0.01);
0251 hframe_scen3->SetTitle("#sigma(cot#theta) vs #eta, p_{T} = 100 GeV/c");
0252 hframe_scen3->SetXTitle("#eta");
0253 hframe_scen3->SetYTitle("#sigma(cot#theta)");
0254 hframe_scen3->Draw();
0255 gr_scen3 = new TGraphErrors(25,etabin,sigma,erretabin,errsigma);
0256 gr_scen3->SetMarkerColor(5);
0257 gr_scen3->SetMarkerStyle(23);
0258 gr_scen3->Draw("P");
0259 Canv->Update();
0260 //Canv->SaveAs("Rescottheta_gaus_scen3.eps");
0261 //Canv->WaitPrimitive();
0262 
0263 /////////////////////////////////////////////////////////////////////
0264 // d0 resolution scen4
0265 /////////////////////////////////////////////////////////////////////
0266 for (int i=1;i<=nbin;i++){
0267   binstart=0.1*(i-1);
0268   binstop = 0.1*i;
0269   etabin[i-1]= (binstop-binstart)/2.+binstart;
0270   erretabin[i-1]=(binstop-binstart)/2.;
0271   cout << "binstart=" << binstart << " binstop is=" << binstop << " eta is " << etabin[i-1] << endl;
0272   sprintf(cutname,"abs(eta)>=%f && abs(eta)<%f && eff==1 && TrackID==13",binstart, binstop);
0273   cout << "cutname is " << cutname <<endl;
0274   TH1F *resd0= new TH1F("d0","d0",500,-0.004,0.004);   
0275   MyTree5->Project("d0","(rescottheta)",cutname);
0276   resd0->Fit("gaus");
0277   meanorig[i-1]=1.*resd0->GetMean();
0278   rms[i-1]=1.*resd0->GetRMS();
0279   cost[i-1]=gaus->GetParameter(0);
0280   mean[i-1]=1*gaus->GetParameter(1);
0281   sigma[i-1]=1*gaus->GetParameter(2);
0282   errsigma[i-1]=1*gaus->GetParError(2);
0283   entry[i-1]=resd0->GetEntries();
0284   //chiq[i-1]=(gaus->GetChisquare()) /(gaus->GetNDF());
0285 //  cout << "mean is= " << mean[i-1] << " sigma is= " << sigma[i-1]/(sqrt(entry[i-1])) << " Entries= " << entry[i-1] << endl;
0286   delete resd0;
0287 }
0288 
0289 for (int i=0;i<nbin;i++){
0290   binstart=0.1*(i);
0291   binstop = 0.1*(i+1);
0292   cout << "binstart= " << binstart << " binstop= " << binstop << endl;
0293   cout << " etabin=" << etabin[i] << " Vector mean/sigma are "<< mean[i] << " +/- " << sigma[i] << endl;
0294   cout << " ErrOnSigma =" << errsigma[i] << " Mean/RMS orig =" << meanorig[i] << " +/-" << rms[i] << endl;
0295 }
0296 
0297 hframe_scen4 = new TH2F("hframe_scen4","Rescottheta_gaus_scen3",25,0.,2.5,100,0.00015,0.01);
0298 hframe_scen4->SetTitle("#sigma(cot#theta) vs #eta, p_{T} = 100 GeV/c");
0299 hframe_scen4->SetXTitle("#eta");
0300 hframe_scen4->SetYTitle("#sigma(cot#theta)");
0301 hframe_scen4->Draw();
0302 gr_scen4 = new TGraphErrors(25,etabin,sigma,erretabin,errsigma);
0303 gr_scen4->SetMarkerColor(6);
0304 gr_scen4->SetMarkerStyle(24);
0305 gr_scen4->Draw("P");
0306 Canv->Update();
0307 //Canv->SaveAs("Rescottheta_gaus_scen3.eps");
0308 //Canv->WaitPrimitive()
0309 
0310 
0311   
0312 hframe = new TH2F("hframe","#sigma(cot#theta) vs #eta, p_{T} = 100 GeV/c",25,0.,2.5,100,0.0002,0.007);
0313 hframe->SetYTitle("#sigma(cot#theta)");
0314 hframe->SetXTitle("#eta");
0315 hframe->Draw();
0316   
0317 gr->Draw("Psame");
0318 gr_scen1->Draw("Psame");
0319 gr_scen2->Draw("Psame");
0320 gr_scen3->Draw("Psame");
0321 gr_scen4->Draw("Psame");
0322 
0323 
0324 
0325 TLegend *leg1 = new TLegend(0.105,0.68,0.455,0.895);
0326 leg1->SetTextAlign(32);
0327 leg1->SetTextColor(1);
0328 leg1->SetTextSize(0.033);
0329 leg1->SetFillColor(0);
0330  
0331 leg1->AddEntry(gr,"perfect", "P");
0332 leg1->AddEntry(gr_scen1,"SurveyLAS", "P");
0333 leg1->AddEntry(gr_scen2,"SurveyLASCosmics", "P");
0334 leg1->AddEntry(gr_scen3,"10 pb^{-1}", "P");
0335 leg1->AddEntry(gr_scen4,"100 pb^{-1}", "P");
0336 
0337 leg1->Draw();
0338 
0339 Canv->Update();
0340 Canv->SaveAs("Rescottheta_eta_gaus_CMSSW.eps");
0341 Canv->SaveAs("Rescottheta_eta_gaus_CMSSW.gif");
0342 
0343 delete Canv;
0344 gROOT->Reset();
0345 gROOT->Clear();
0346 
0347 
0348 }
0349