Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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