BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
check/curve/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;
20//int main(){
22 TFile *f = new TFile("DedxSampleHists.root");
23 TTree *t = (TTree*)f->Get("bin");
24 int num, total;
25 t->SetBranchAddress("betagammaBounds",&num);
26 t->SetBranchAddress("totalNum",&total);
27 t->GetEntry(0);
28 double *pre_x = new double[num];
29 t->SetBranchAddress("betagamma", pre_x);
30 t->GetEntry(0);
31
32 double *x = new double[total];
33 double *y = new double[total];
34 ReadCurPara(0);
35 double mean_exp[5];
36 double sigma_exp[5];
37 const double theta(1), Nohit(15), t0(1200);
38
39 double *curve_y = new double[total];
40 for(int i=0; i<total; i++){
41 TH1F *h = (TH1F*)f->Get(Form("h%d",i));
42 y[i] = h->GetMean();
43 x[i] = pre_x[i/10];
44 dedx_pid_exp(x[i]*masses[2], theta, Nohit, t0, mean_exp, sigma_exp);
45 curve_y[i] = mean_exp[2];
46 if(m_debug) cout << "i= " << i << " x= " << x[i] << " y= " << y[i] << endl;
47 }
48
49 TCanvas *c1 = new TCanvas("c1","curve",10,10,800,642);
50 gPad->SetLogx(1);
51 TGraph *g = new TGraph(total, x, y);
52 g->Draw("a*");
53 TGraph *curve_g = new TGraph(total, x, curve_y);
54 curve_g->SetLineColor(2);
55 curve_g->Draw("c,same");
56
57 c1->SaveAs("figs/official_curve.eps");
58 TFile *save_file = new TFile("figs/new_curve.root","recreate");
59 c1->Write();
60 save_file->Close();
61}
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)
void draw_check_curve()
const bool m_debug
const float masses[5]
double y[1000]