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