Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:14

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.043,"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.);
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 TFile f0("../../Z/MisalignmentIdeal.root");  
0034 TTree *MyTree=Tracks;
0035 
0036 TFile f1("../../SurveyLAS/zmumu/Misalignment_SurveyLASOnlyScenario_refitter_zmumu.root");
0037 TTree *MyTree2=Tracks;
0038 
0039 TFile f2("Misalignment_SurveyLASOnlyScenario_refitter_zmumu_allmuSurveyLASCosmics.root");
0040 TTree *MyTree3=Tracks;
0041 
0042 TFile f3("../../Z/Misalignment10.root");
0043 TTree *MyTree4=Tracks;
0044 
0045 TFile f4("../../Z/Misalignment100.root");
0046 TTree *MyTree5=Tracks;
0047 
0048 
0049 int nbin=20;
0050 float binwidth=100./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=binwidth*(i-1);
0079   binstop = binwidth*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(pt)>=%f && abs(pt)<%f && eff==1 && TrackID==13",binstart, binstop);
0084   cout << "cutname is " << cutname <<endl;
0085   TH1F *resd0= new TH1F("d0","d0",500,-0.015,0.015);  
0086   MyTree->Project("d0","resd0",cutname);
0087   resd0->Fit("gaus");
0088   meanorig[i-1]=10000.*resd0->GetMean();
0089   rms[i-1]=10000.*resd0->GetRMS();
0090   mean[i-1]=10000.*gaus->GetParameter(1);
0091   sigma[i-1]=10000.*gaus->GetParameter(2);
0092   errsigma[i-1]=10000.*gaus->GetParError(2);
0093   entry[i-1]=resd0->GetEntries();
0094   // Canv->WaitPrimitive();
0095   delete resd0;
0096 }
0097 
0098 for (int i=0;i<nbin;i++){
0099   binstart=binwidth*(i);
0100   binstop = binwidth*(i+1);
0101   cout << "binstart= " << binstart << " binstop= " << binstop << endl;
0102   cout << " etabin=" << etabin[i] << " Vector mean/sigma are "<< mean[i] << " +/- " << sigma[i] << endl;
0103   cout << " ErrOnSigma =" << errsigma[i] << " Mean/RMS orig =" << meanorig[i] << " +/-" << rms[i] << endl;
0104 }
0105 
0106 hframe = new TH2F("hframe","SigmapT/pT_gaus",25,0.,100.,100,7.,3000.);
0107 hframe->SetTitle("#sigma(d_{0}) vs p_{T} #mu from CSA06 Z->#mu#mu ");
0108 hframe->SetXTitle("p_{T} [GeV/c]");
0109 hframe->SetYTitle("#sigma(d_{0})");
0110 hframe->Draw();
0111 gr = new TGraphErrors(25,etabin,sigma,erretabin,errsigma);
0112 gr->SetMarkerColor(2);
0113 gr->SetMarkerStyle(20);
0114 gr->Draw("P");
0115 Canv->Update();
0116 //Canv->SaveAs("SigmapT_pT_gaus_scen0.eps");
0117 //Canv->WaitPrimitive();
0118 
0119 // //////////////////////////////////////////////////////////////////
0120 // d0 resolution scen1
0121 /////////////////////////////////////////////////////////////////////
0122 for (int i=1;i<=nbin;i++){
0123   binstart=binwidth*(i-1);
0124   binstop = binwidth*i;
0125   etabin[i-1]= (binstop-binstart)/2.+binstart;
0126   erretabin[i-1]=(binstop-binstart)/2.;
0127   cout << "binstart=" << binstart << " binstop is=" << binstop << " eta is " << etabin[i-1] << endl;
0128   sprintf(cutname,"abs(pt)>=%f && abs(pt)<%f && eff==1 && TrackID==13",binstart, binstop);
0129   cout << "cutname is " << cutname <<endl;
0130   TH1F *resd0= new TH1F("d0","d0",500,-0.03,0.03);  
0131   MyTree2->Project("d0","(resd0)",cutname);
0132   resd0->Fit("gaus");
0133   meanorig[i-1]=10000.*resd0->GetMean();
0134   rms[i-1]=10000.*resd0->GetRMS();
0135   mean[i-1]=10000.*gaus->GetParameter(1);
0136   sigma[i-1]=10000.*gaus->GetParameter(2);
0137   errsigma[i-1]=10000.*gaus->GetParError(2);
0138   entry[i-1]=resd0->GetEntries();
0139   //Canv->WaitPrimitive();
0140   delete resd0;
0141 }
0142 
0143 for (int i=0;i<nbin;i++){
0144   binstart=binwidth*(i);
0145   binstop = binwidth*(i+1);
0146   cout << "binstart= " << binstart << " binstop= " << binstop << endl;
0147   cout << " etabin=" << etabin[i] << " Vector mean/sigma are "<< mean[i] << " +/- " << sigma[i] << endl;
0148   cout << " ErrOnSigma =" << errsigma[i] << " Mean/RMS orig =" << meanorig[i] << " +/-" << rms[i] << endl;
0149 }
0150 
0151 hframe_scen1 = new TH2F("hframe","SigmapT/pT_gaus_scen1",25,0.,100.,100,7.,3000.);
0152 hframe_scen1->SetTitle("#sigma(d_{0}) vs p_{T} #mu from CSA06 Z->#mu#mu ");
0153 hframe_scen1->SetXTitle("p_{T} [GeV/c]");
0154 hframe_scen1->SetYTitle("#sigma(d_{0})");
0155 hframe_scen1->Draw();
0156 gr_scen1 = new TGraphErrors(25,etabin,sigma,erretabin,errsigma);
0157 gr_scen1->SetMarkerColor(3);
0158 gr_scen1->SetMarkerStyle(21);
0159 gr_scen1->Draw("P");
0160 Canv->Update();
0161 //Canv->SaveAs("SigmapT_pT_gaus_scen1.eps");
0162 //Canv->WaitPrimitive();
0163 
0164 // //////////////////////////////////////////////////////////////////
0165 // d0 resolution scen2
0166 /////////////////////////////////////////////////////////////////////
0167 for (int i=1;i<=nbin;i++){
0168   binstart=binwidth*(i-1);
0169   binstop = binwidth*i;
0170   etabin[i-1]= (binstop-binstart)/2.+binstart;
0171   erretabin[i-1]=(binstop-binstart)/2.;
0172   cout << "binstart=" << binstart << " binstop is=" << binstop << " eta is " << etabin[i-1] << endl;
0173   sprintf(cutname,"abs(pt)>=%f && abs(pt)<%f && eff==1 && TrackID==13",binstart, binstop);
0174   cout << "cutname is " << cutname <<endl;
0175   TH1F *resd0= new TH1F("d0","d0",500,-0.03,0.03);  
0176   MyTree3->Project("d0","(resd0)",cutname);
0177   resd0->Fit("gaus");
0178   meanorig[i-1]=10000.*resd0->GetMean();
0179   rms[i-1]=10000.*resd0->GetRMS();
0180   cost[i-1]=gaus->GetParameter(0);
0181   mean[i-1]=10000.*gaus->GetParameter(1);
0182   sigma[i-1]=10000.*gaus->GetParameter(2);
0183   errsigma[i-1]=10000.*gaus->GetParError(2);
0184   entry[i-1]=resd0->GetEntries();
0185   //Canv->WaitPrimitive();
0186   delete resd0;
0187 }
0188 
0189 for (int i=0;i<nbin;i++){
0190   binstart=binwidth*(i);
0191   binstop = binwidth*(i+1);
0192   cout << "binstart= " << binstart << " binstop= " << binstop << endl;
0193   cout << " etabin=" << etabin[i] << " Vector mean/sigma are "<< mean[i] << " +/- " << sigma[i] << endl;
0194   cout << " ErrOnSigma =" << errsigma[i] << " Mean/RMS orig =" << meanorig[i] << " +/-" << rms[i] << endl;
0195 }
0196 
0197 hframe_scen2 = new TH2F("hframe_scen2","SigmapT/pT_gaus_scen2",25,0.,100.,100,7.,3000.);
0198 hframe_scen2->SetTitle("#sigma(d_{0}) vs p_{T} for #mu from Z->#mu#mu ");
0199 hframe_scen2->SetXTitle("p_{T} [GeV/c]");
0200 hframe_scen2->SetYTitle("#sigma(d_{0})");
0201 hframe_scen2->Draw();
0202 gr_scen2 = new TGraphErrors(25,etabin,sigma,erretabin,errsigma);
0203 gr_scen2->SetMarkerColor(4);
0204 gr_scen2->SetMarkerStyle(22);
0205 gr_scen2->Draw("P");
0206 Canv->Update();
0207 //Canv->SaveAs("SigmapT_pT_gaus_scen2.eps");
0208 //Canv->WaitPrimitive();
0209 
0210 // //////////////////////////////////////////////////////////////////
0211 // d0 resolution scen3
0212 /////////////////////////////////////////////////////////////////////
0213 for (int i=1;i<=nbin;i++){
0214   binstart=binwidth*(i-1);
0215   binstop = binwidth*i;
0216   etabin[i-1]= (binstop-binstart)/2.+binstart;
0217   erretabin[i-1]=(binstop-binstart)/2.;
0218   cout << "binstart=" << binstart << " binstop is=" << binstop << " eta is " << etabin[i-1] << endl;
0219   sprintf(cutname,"abs(pt)>=%f && abs(pt)<%f && eff==1 && TrackID==13",binstart, binstop);
0220   cout << "cutname is " << cutname <<endl;
0221   TH1F *resd0= new TH1F("d0","d0",500,-0.015,0.015);  
0222   MyTree4->Project("d0","(resd0)",cutname);
0223   resd0->Fit("gaus");
0224   meanorig[i-1]=10000.*resd0->GetMean();
0225   rms[i-1]=10000.*resd0->GetRMS();
0226   cost[i-1]=gaus->GetParameter(0);
0227   mean[i-1]=10000.*gaus->GetParameter(1);
0228   sigma[i-1]=10000.*gaus->GetParameter(2);
0229   errsigma[i-1]=10000.*gaus->GetParError(2);
0230   entry[i-1]=resd0->GetEntries();
0231   //Canv->WaitPrimitive();
0232   delete resd0;
0233 }
0234 
0235 for (int i=0;i<nbin;i++){
0236   binstart=binwidth*(i);
0237   binstop = binwidth*(i+1);
0238   cout << "binstart= " << binstart << " binstop= " << binstop << endl;
0239   cout << " etabin=" << etabin[i] << " Vector mean/sigma are "<< mean[i] << " +/- " << sigma[i] << endl;
0240   cout << " ErrOnSigma =" << errsigma[i] << " Mean/RMS orig =" << meanorig[i] << " +/-" << rms[i] << endl;
0241 }
0242 
0243 hframe_scen3 = new TH2F("hframe_scen3","SigmapT/pT_gaus_scen3",25,0.,100.,100,7.,3000.);
0244 hframe_scen3->SetTitle("#sigma(d_{0}) vs p_{T} for #mu from Z->#mu#mu ");
0245 hframe_scen3->SetXTitle("p_{T} [GeV/c]");
0246 hframe_scen3->SetYTitle("#sigma(d_{0})");
0247 hframe_scen3->Draw();
0248 gr_scen3 = new TGraphErrors(25,etabin,sigma,erretabin,errsigma);
0249 gr_scen3->SetMarkerColor(5);
0250 gr_scen3->SetMarkerStyle(23);
0251 gr_scen3->Draw("P");
0252 Canv->Update();
0253 //Canv->SaveAs("SigmapT_pT_gaus_scen3.eps");
0254 //Canv->WaitPrimitive();
0255 
0256 
0257 //////////////////////////////////////////
0258 // d0 resolution scen3
0259 /////////////////////////////////////////////////////////////////////
0260 for (int i=1;i<=nbin;i++){
0261   binstart=binwidth*(i-1);
0262   binstop = binwidth*i;
0263   etabin[i-1]= (binstop-binstart)/2.+binstart;
0264   erretabin[i-1]=(binstop-binstart)/2.;
0265   cout << "binstart=" << binstart << " binstop is=" << binstop << " eta is " << etabin[i-1] << endl;
0266   sprintf(cutname,"abs(pt)>=%f && abs(pt)<%f && eff==1 && TrackID==13",binstart, binstop);
0267   cout << "cutname is " << cutname <<endl;
0268   TH1F *resd0= new TH1F("d0","d0",500,-0.015,0.015);  
0269   MyTree5->Project("d0","(resd0)",cutname);
0270   resd0->Fit("gaus");
0271   meanorig[i-1]=10000.*resd0->GetMean();
0272   rms[i-1]=10000.*resd0->GetRMS();
0273   cost[i-1]=gaus->GetParameter(0);
0274   mean[i-1]=10000.*gaus->GetParameter(1);
0275   sigma[i-1]=10000.*gaus->GetParameter(2);
0276   errsigma[i-1]=10000.*gaus->GetParError(2);
0277   entry[i-1]=resd0->GetEntries();
0278   //Canv->WaitPrimitive();
0279   delete resd0;
0280 }
0281 
0282 for (int i=0;i<nbin;i++){
0283   binstart=binwidth*(i);
0284   binstop = binwidth*(i+1);
0285   cout << "binstart= " << binstart << " binstop= " << binstop << endl;
0286   cout << " etabin=" << etabin[i] << " Vector mean/sigma are "<< mean[i] << " +/- " << sigma[i] << endl;
0287   cout << " ErrOnSigma =" << errsigma[i] << " Mean/RMS orig =" << meanorig[i] << " +/-" << rms[i] << endl;
0288 }
0289 
0290 hframe_scen4 = new TH2F("hframe_scen4","SigmapT/pT_gaus_scen3",25,0.,100.,100,7.,7000.);
0291 hframe_scen4->SetTitle("#sigma(d_{0}) vs p_{T} for #mu from Z->#mu#mu ");
0292 hframe_scen4->SetXTitle("p_{T} [GeV/c]");
0293 hframe_scen4->SetYTitle("#sigma(d_{0}) [#mum]");
0294 hframe_scen4->Draw();
0295 gr_scen4 = new TGraphErrors(25,etabin,sigma,erretabin,errsigma);
0296 gr_scen4->SetMarkerColor(6);
0297 gr_scen4->SetMarkerStyle(24);
0298 //gr_scen4->Draw("P");
0299 Canv->Update();
0300 //Canv->SaveAs("SigmapT_pT_gaus_scen3.eps");
0301 //Canv->WaitPrimitive();
0302 
0303 gr->Draw("P");
0304 gr_scen1->Draw("Psame");
0305 gr_scen2->Draw("Psame");
0306 gr_scen3->Draw("Psame");
0307 gr_scen4->Draw("Psame");
0308 
0309 TLegend *leg1 = new TLegend(0.105,0.68,0.455,0.895);
0310 leg1->SetTextAlign(32);   
0311 leg1->SetTextColor(1);   
0312 leg1->SetTextSize(0.033);     
0313 leg1->SetFillColor(0);
0314    
0315 leg1->AddEntry(gr,"perfect", "P");
0316 leg1->AddEntry(gr_scen1,"SurveyLAS", "P");
0317 leg1->AddEntry(gr_scen2,"SurveyLASCosmics", "P");
0318 leg1->AddEntry(gr_scen3,"10 pb^{-1}", "P");
0319 leg1->AddEntry(gr_scen4,"100 pb^{-1}", "P");
0320 
0321 leg1->Draw();
0322 
0323 Canv->Update();
0324 Canv->SaveAs("Sigmad0_pT_gaus.gif");
0325 Canv->SaveAs("Sigmad0_pT_gaus.eps");
0326 
0327 delete Canv;
0328 gROOT->Reset();
0329 gROOT->Clear();
0330 
0331 
0332 }
0333