BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
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 21 of file check/curve/draw_check_curve.cxx.

21 {
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)
const bool m_debug
const float masses[5]
double y[1000]

Variable Documentation

◆ m_debug

const bool m_debug = false

Definition at line 19 of file check/curve/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 check/curve/draw_check_curve.cxx.

17{ 0.00051100, 0.10566, 0.13957, 0.4937, 0.93827 };

Referenced by draw_check_curve(), and EvtDecayBase::findMasses().