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