BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
histgen/draw_check_curve.cxx File Reference
#include "TCanvas.h"
#include "TFile.h"
#include "TTree.h"
#include "TH1F.h"
#include <sstream>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include "TGraph.h"
#include "curve.h"

Go to the source code of this file.

Functions

void draw_check_curve ()
 

Variables

const float masses [5] = { 0.00051100, 0.10566, 0.13957, 0.4937, 0.93827 }
 
const bool m_debug = false
 

Function Documentation

◆ draw_check_curve()

void draw_check_curve ( )

Definition at line 20 of file histgen/draw_check_curve.cxx.

20 {
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]
const bool m_debug
const float masses[5]

Variable Documentation

◆ m_debug

const bool m_debug = false

Definition at line 19 of file histgen/draw_check_curve.cxx.

Referenced by draw_check_curve().

◆ masses

const float masses[5] = { 0.00051100, 0.10566, 0.13957, 0.4937, 0.93827 }

Definition at line 17 of file histgen/draw_check_curve.cxx.

Referenced by draw_check_curve().