File indexing completed on 2025-09-17 09:23:23
0001
0002
0003
0004 void Compare_Svtx(TString name="x"){
0005
0006 gStyle->SetPalette(kRainBow);
0007 gStyle->SetTitleSize(0.045,"XY");
0008 gStyle->SetTitleSize(0.04,"XY");
0009 gStyle->SetLabelSize(0.04,"XY");
0010 gStyle->SetTitleOffset(1.0,"XY");
0011 gStyle->SetOptStat(1);
0012 gStyle->SetOptFit(1);
0013 gStyle->SetOptTitle(0);
0014 gStyle->SetGridColor(kBlack);
0015 gStyle->SetGridWidth(2);
0016 gStyle->SetGridStyle(2);
0017
0018
0019 TFile *f = TFile::Open("test.root");
0020
0021 const int nplots = 1;
0022
0023 TCanvas *c[nplots];
0024 for (int i=0; i<nplots; ++i){
0025 c[i]= new TCanvas(Form("c%d",i),Form("c%d",i),0,52,1400,1000);
0026 c[i]->SetGrid();
0027 c[i]->SetMargin(0.10, 0.03 ,0.12,0.07);
0028 }
0029
0030 c[0]->cd();
0031 TH1D *hvtx_x_fit = (TH1D*)f->Get(Form("hRes_SV%s_Helixfit",name.Data()));
0032 TH1D *hvtx_x_centre = (TH1D*)f->Get(Form("hRes_SV%s_HelixCalculation",name.Data()));
0033
0034 hvtx_x_fit->SetLineColor(kRed);
0035 hvtx_x_fit->SetLineStyle(10);
0036 hvtx_x_fit->SetMaximum(hvtx_x_fit->GetMaximum()*1.20);
0037 hvtx_x_fit->SetLineWidth(2);
0038 hvtx_x_fit->Draw("hist");
0039 c[0]->Modified(); c[0]->Update();
0040 TPaveStats *stats = (TPaveStats*) hvtx_x_fit->FindObject("stats");
0041 stats->SetTextColor(kRed);
0042 stats->SetY2NDC(stats->GetY2NDC());
0043 stats->SetY1NDC(stats->GetY2NDC()-0.15);
0044 double y1 = stats->GetY1NDC();
0045
0046 hvtx_x_centre->SetLineColor(kBlue);
0047 hvtx_x_centre->SetLineStyle(9);
0048 hvtx_x_centre->SetLineWidth(2);
0049 hvtx_x_centre->Draw("sames");
0050 c[0]->Modified(); c[0]->Update();
0051 stats = (TPaveStats*) hvtx_x_centre->FindObject("stats");
0052 stats->SetTextColor(kBlue);
0053 stats->SetY2NDC(y1);
0054 stats->SetY1NDC(y1-0.15);
0055 y1 = stats->GetY1NDC();
0056 c[0]->Modified();
0057 c[0]->Update();
0058
0059
0060 TLegend *lhit = new TLegend(0.15,0.70,0.35,0.92);
0061 lhit->SetHeader("Secondary Vertex (D^{0})","C");
0062 lhit->SetTextSize(0.035);
0063 lhit->SetBorderSize(0);
0064 lhit->AddEntry(hvtx_x_fit,"Chi2 Minimization");
0065 lhit->AddEntry(hvtx_x_centre,"Mid Point (Analytical)");
0066 lhit->Draw();
0067 c[0]->SaveAs(Form("cmp_secondary_vertex_%s_D0.png",name.Data()));
0068
0069 }
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088