CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
vtxFit.cxx File Reference

Go to the source code of this file.

Functions

void vtxFit ()
 

Function Documentation

◆ vtxFit()

void vtxFit ( )

Definition at line 1 of file vtxFit.cxx.

1 {
2
3 Double_t chik, kvx, kvy, kvz, ndofk, probk;
4 TChain* t = new TChain("kalvtx");
5 t->Add("run_0009903_dst_pvtx2.root");
6 t->Add("run_0009903_dst_pvtx3.root");
7 t->SetBranchAddress("chik", &chik );
8 t->SetBranchAddress("kvx", &kvx );
9 t->SetBranchAddress("kvy", &kvy );
10 t->SetBranchAddress("kvz", &kvz );
11 t->SetBranchAddress("ndofk", &ndofk );
12 t->SetBranchAddress("probk", &probk );
13
14 Int_t nentries = (Int_t) t->GetEntries();
15
16 TH1D* m_vertex_x_kal = new TH1D("x of vertex in kal", "x of vertex in kal", 60, -0.6, 0.6);
17 TH1D* m_vertex_y_kal = new TH1D("y of vertex in kal", "y of vertex in kal", 60, -0.6, 0.1);
18 TH1D* m_vertex_z_kal = new TH1D("z of vertex in kal", "z of vertex in kal", 60, -6, 6);
19
20 for( Int_t i=0; i<nentries; i++ ) {
21 t->GetEntry(i);
22 m_vertex_x_kal->Fill(kvx);
23 m_vertex_y_kal->Fill(kvy);
24 m_vertex_z_kal->Fill(kvz);
25 }
26
27
28 TCanvas *myC = new TCanvas("myC", "myC", 1200, 400);
29 TPad *background = (TPad*)gPad;
30 background->SetFillColor(10);
31 myC->Divide(3,1);
32 myC->cd(1);
33
34 TF1 *func = new TF1("func", "gaus", -0.6, 0.6);
35 m_vertex_x_kal->Fit("func", "R+");
36 Double_t MeanXKal = func->GetParameter(1);
37 Double_t SigmaXKal = func->GetParameter(2);
38 Double_t ErrMeanXKal = func->GetParError(1);
39 Double_t ErrSigmaXKal = func->GetParError(2);
40
41 myC->cd(2);
42 TF1 *funcY = new TF1("funcY", "gaus", -0.6, 0.1);
43 m_vertex_y_kal->Fit("funcY", "R+");
44 Double_t MeanYKal = funcY->GetParameter(1);
45 Double_t SigmaYKal = funcY->GetParameter(2);
46 Double_t ErrMeanYKal = funcY->GetParError(1);
47 Double_t ErrSigmaYKal = funcY->GetParError(2);
48
49 myC->cd(3);
50 TF1 *funcZ = new TF1("funcZ", "gaus", -6, 6);
51 m_vertex_z_kal->Fit("funcZ", "R+");
52 Double_t MeanZKal = funcZ->GetParameter(1);
53 Double_t SigmaZKal = funcZ->GetParameter(2);
54 Double_t ErrMeanZKal = funcZ->GetParError(1);
55 Double_t ErrSigmaZKal = funcZ->GetParError(2);
56
57 cout << "Kal: Mean X, Y, Z = "<<MeanXKal << " " << MeanYKal << " " << MeanZKal << endl;
58 cout << "Kal: Sigma X, Y, Z = "<<SigmaXKal<<" " <<SigmaYKal <<" " << SigmaZKal << endl;
59
60 figs_name = "figs.ps";
61 myC->SaveAs(figs_name);
62
63 //ofstream file(file_name);
64
65 cout << MeanXKal << " "<< MeanYKal << " "<< MeanZKal << " "<< SigmaXKal << " " << SigmaYKal << " " << SigmaZKal << endl;
66 cout << ErrMeanXKal << " " << ErrMeanYKal<< " " << ErrMeanZKal << " " << ErrSigmaXKal << " " << ErrSigmaYKal << " " << ErrSigmaZKal << endl;
67
68
69 return;
70
71}
Int_t nentries
int t()
Definition: t.c:1