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