Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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