BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
histgen/draw_check_curve.cxx
Go to the documentation of this file.
1#include "TCanvas.h"
2#include "TFile.h"
3//#include "TKey.h"
4#include "TTree.h"
5#include "TH1F.h"
6//#include <TROOT.h>
7#include <sstream>
8#include <iostream>
9#include <string>
10#include <cstring>
11#include <vector>
12#include <cmath>
13#include "TGraph.h"
14
15#include "curve.h"
16using namespace std;
17const float masses[5] = { 0.00051100, 0.10566, 0.13957, 0.4937, 0.93827 };
18
19const bool m_debug = false;
21 TFile *f = new TFile("DedxSampleHists.root");
22 TTree *t = (TTree*)f->Get("bin");
23 int num, total;
24 t->SetBranchAddress("betagammaBounds",&num);
25 t->SetBranchAddress("totalNum",&total);
26 t->GetEntry(0);
27 double *pre_x = new double[num];
28 t->SetBranchAddress("betagamma", pre_x);
29 t->GetEntry(0);
30
31 double *x = new double[total];
32 double *y = new double[total];
33 ReadCurPara(0);
34 double mean_exp[5];
35 double sigma_exp[5];
36 const double theta(1), Nohit(15), t0(1200);
37
38 double *curve_y = new double[total];
39 for(int i=0; i<total; i++){
40 TH1F *h = (TH1F*)f->Get(Form("h%d",i));
41 y[i] = h->GetMean();
42 x[i] = pre_x[i/10];
43 dedx_pid_exp(x[i]*masses[2], theta, Nohit, t0, mean_exp, sigma_exp);
44 curve_y[i] = mean_exp[2];
45 if(m_debug) cout << "i= " << i << " x= " << x[i] << " y= " << y[i] << endl;
46 }
47
48 TCanvas *c1 = new TCanvas("c1","curve",10,10,800,642);
49 gPad->SetLogx(1);
50 TGraph *g = new TGraph(total, x, y);
51 g->Draw("a*");
52 TGraph *curve_g = new TGraph(total, x, curve_y);
53 curve_g->SetLineColor(2);
54 curve_g->Draw("c,same");
55
56 c1->SaveAs("figs/curve.eps");
57 TFile *save_file = new TFile("figs/curve.root","recreate");
58 c1->Write();
59 save_file->Close();
60}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
Double_t x[10]
void dedx_pid_exp(int vflag[3], float dedx, int trkalg, int Nohit, float mom, float theta, float t0, float lsamp, double dedx_exp[5], double ex_sigma[5], double pid_prob[5], double chi_dedx[5], std::vector< double > &par, std::vector< double > &sig_par)
TTree * t
Definition: binning.cxx:23
void ReadCurPara(int index)
double y[1000]
void draw_check_curve()
const bool m_debug
const float masses[5]