BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
CheckRung/check/dEdxVsCosNP.cxx File Reference
#include <vector>
#include <string>
#include "TStyle.h"
#include "TString.h"

Go to the source code of this file.

Functions

void pushNo ()
 
void dEdxVsCosNP ()
 

Variables

vector< string > file
 
const int no = 5
 
const int nbins = 80
 
const double cosMin = -1.0
 
const double cosMax = 1.0
 
const double chiMin = -30
 
const double chiMax = 30
 
const double chiSigmaMin = 0.5
 
const double chiSigmaMax = 6.5
 
const double fitMeanMin = 30
 
const double fitMeanMax = 2585
 
const double fitSigmaMin = 20
 
const double fitSigmaMax = 50
 
const double slopeMin = 0.8
 
const double slopeMax = 1.2
 

Function Documentation

◆ dEdxVsCosNP()

void dEdxVsCosNP ( )

Definition at line 34 of file CheckRung/check/dEdxVsCosNP.cxx.

35{
36 pushNo();
37 const int FileNo = file.size();
38 string branchheader[FileNo] = {"pos_","neg_"};
39 string str_names[FileNo] = {"positron","electron"};
40 TH2F** h = new TH2F*[no];
41 TCanvas** c = new TCanvas*[no];
42 TLegend** lgd = new TLegend*[no];
43 TGraphErrors*** gr = new TGraphErrors[no][FileNo];
44 for(int i =0;i<no;i++) gr[i] = new TGraphErrors*[FileNo];
45 gStyle->SetOptStat(0);
46 gStyle->SetCanvasColor(10);
47
48 TFile* f;
49 TTree* tree;
50
51 double chimean[FileNo][nbins],chimeanerr[FileNo][nbins],chisigma[FileNo][nbins];
52 double fitmean[FileNo][nbins],fitmeanerr[FileNo][nbins],fitsigma[FileNo][nbins];
53 double cosBin[FileNo][nbins], slope[FileNo][nbins];
54
55 stringstream ss;
56 stringstream branch;
57 for(int i=0;i<FileNo;i++)
58 {
59 ss.str("");
60 ss<<file[i];
61 f = new TFile(ss.str().c_str());
62 tree = (TTree*) f->Get("costhetacalib");
63 branch.str("");
64 branch<<branchheader[i]<<"chimean";
65 tree -> SetBranchAddress(branch.str().c_str(),chimean[i]);
66 branch.str("");
67 branch<<branchheader[i]<<"chimeanerr";
68 tree -> SetBranchAddress(branch.str().c_str(),chimeanerr[i]);
69 branch.str("");
70 branch<<branchheader[i]<<"chisigma";
71 tree -> SetBranchAddress(branch.str().c_str(),chisigma[i]);
72 branch.str("");
73 branch<<branchheader[i]<<"fitmean";
74 tree -> SetBranchAddress(branch.str().c_str(),fitmean[i]);
75 branch.str("");
76 branch<<branchheader[i]<<"fitmeanerr";
77 tree -> SetBranchAddress(branch.str().c_str(),fitmeanerr[i]);
78 branch.str("");
79 branch<<branchheader[i]<<"fitsigma";
80 tree -> SetBranchAddress(branch.str().c_str(),fitsigma[i]);
81 branch.str("");
82 branch<<"cosBin";
83 tree -> SetBranchAddress(branch.str().c_str(),cosBin[i]);
84 tree -> GetEntry(0);
85 }
86
87 //--------------------- chimean ------------------------------//
88 c[0] = new TCanvas("chimean","chimean",800,600);
89 c[0] -> SetGridx();
90 c[0] -> SetGridy();
91 h[0] = new TH2F("chimean","chimean",100,cosMin,cosMax,100,chiMin,chiMax);
92 h[0] -> GetYaxis()->SetTitle("#chi_{mean}");
93 //h[0] -> GetYaxis()->SetTitleOffset(.9);
94 h[0] -> GetXaxis()->SetTitle("cos(#theta)");
95 h[0] -> Draw();
96 lgd[0] = new TLegend(.65, .75, .89, .89);
97 lgd[0]->SetFillColor(10);
98 lgd[0]->SetBorderSize(1);
99
100 for(int i=0;i<FileNo;i++)
101 {
102 gr[0][i] = new TGraphErrors(nbins,cosBin[i],chimean[i],0,chimeanerr[i]);
103 gr[0][i] -> SetMarkerStyle(20+i);
104 gr[0][i] -> SetMarkerColor(i+1);
105 gr[0][i] -> Draw("Psame");
106 lgd[0] -> AddEntry(gr[0][i], str_names[i].c_str() , "p");
107 }
108 lgd[0] -> Draw();
109
110 //--------------------- chisigma -----------------------------//
111 c[1] = new TCanvas("chisigma","chisigma",800,600);
112 c[1] -> SetGridx();
113 c[1] -> SetGridy();
114 h[1] = new TH2F("chisigma","chisigma",100,cosMin,cosMax,100,chiSigmaMin,chiSigmaMax);
115 h[1] -> GetYaxis()->SetTitle("#chi_{#sigma}");
116 //h[1] -> GetYaxis()->SetTitleOffset(.9);
117 h[1] -> GetXaxis()->SetTitle("cos(#theta)");
118 h[1] -> Draw();
119 lgd[1] = new TLegend(.65, .75, .89, .89);
120 lgd[1]->SetFillColor(10);
121 lgd[1]->SetBorderSize(1);
122
123 for(int i=0;i<FileNo;i++)
124 {
125 gr[1][i] = new TGraphErrors(nbins,cosBin[i],chisigma[i],0,0);
126 gr[1][i] -> SetMarkerStyle(20+i);
127 gr[1][i] -> SetMarkerColor(i+1);
128 gr[1][i] -> Draw("Psame");
129 lgd[1] -> AddEntry(gr[1][i], str_names[i].c_str() , "p");
130 }
131 lgd[1] -> Draw();
132
133 //--------------------- fitmean -----------------------------//
134 c[2] = new TCanvas("fitmean","fitmean",800,600);
135 c[2] -> SetGridx();
136 c[2] -> SetGridy();
137 h[2] = new TH2F("fitmean","fitmean",100,cosMin,cosMax,100,fitMeanMin,fitMeanMax);
138 h[2] -> GetYaxis()->SetTitle("fitmean");
139 //h[2] -> GetYaxis()->SetTitleOffset(.9);
140 h[2] -> GetXaxis()->SetTitle("cos(#theta)");
141 h[2] -> Draw();
142 lgd[2] = new TLegend(.65, .75, .89, .89);
143 lgd[2]->SetFillColor(10);
144 lgd[2]->SetBorderSize(1);
145
146 for(int i=0;i<FileNo;i++){
147 gr[2][i] = new TGraphErrors(nbins,cosBin[i],fitmean[i],0,0);
148 gr[2][i] -> SetMarkerStyle(20+i);
149 gr[2][i] -> SetMarkerColor(i+1);
150 gr[2][i] -> Draw("Psame");
151 lgd[2] -> AddEntry(gr[2][i], str_names[i].c_str() , "p");
152 }
153 lgd[2] -> Draw();
154
155 //--------------------- fitsigma -----------------------------//
156 c[3] = new TCanvas("fitsigma","fitsigma",800,600);
157 c[3] -> SetGridx();
158 c[3] -> SetGridy();
159 h[3] = new TH2F("fitsigma","fitsigma",100,cosMin,cosMax,100,fitSigmaMin,fitSigmaMax);
160 h[3] -> GetYaxis()->SetTitle("fitsigma");
161 //h[3] -> GetYaxis()->SetTitleOffset(.9);
162 h[3] -> GetXaxis()->SetTitle("cos(#theta)");
163 h[3] -> Draw();
164 lgd[3] = new TLegend(.65, .75, .89, .89);
165 lgd[3]->SetFillColor(10);
166 lgd[3]->SetBorderSize(1);
167
168 for(int i=0;i<FileNo;i++)
169 {
170 gr[3][i] = new TGraphErrors(nbins,cosBin[i],fitsigma[i],0,0);
171 gr[3][i] -> SetMarkerStyle(20+i);
172 gr[3][i] -> SetMarkerColor(i+1);
173 gr[3][i] -> Draw("Psame");
174 lgd[3] -> AddEntry(gr[3][i], str_names[i].c_str() , "p");
175 }
176 lgd[3] -> Draw();
177
178 //--------------------- slope -----------------------------//
179 c[4] = new TCanvas("slope","slope",800,600);
180 c[4] -> SetGridx();
181 c[4] -> SetGridy();
182 h[4] = new TH2F("slope","slope",100,cosMin,cosMax,100,slopeMin,slopeMax);
183 h[4] -> GetYaxis()->SetTitle("slope");
184 //h[4] -> GetYaxis()->SetTitleOffset(.9);
185 h[4] -> GetXaxis()->SetTitle("cos(#theta)");
186 h[4] -> Draw();
187 lgd[4] = new TLegend(.65, .75, .89, .89);
188 lgd[4]->SetFillColor(10);
189 lgd[4]->SetBorderSize(1);
190
191
192 for(int j=0; j<FileNo; j++){
193 for(int k=0; k<nbins; k++){
194 if(fitmean[j][k]) slope[j][k] = fitmean[j][k]/fitmean[j][nbins-k-1];
195 else slope[j][k] = 0;
196 }
197 }
198
199 for(int i=0;i<FileNo;i++)
200 {
201 gr[4][i] = new TGraphErrors(nbins/2,cosBin[i],slope[i],0,0);
202 gr[4][i] -> SetMarkerStyle(20+i);
203 gr[4][i] -> SetMarkerColor(i+1);
204 gr[4][i] -> Draw("Psame");
205 lgd[4] -> AddEntry(gr[4][i], str_names[i].c_str() , "p");
206 }
207 lgd[4] -> Draw();
208
209 // output file
210 TFile* g = new TFile("dEdxVsCosNP.root","recreate");
211 for(int i=0;i<no;i++)
212 {
213 c[i]->Write();
214 }
215 g->Close();
216}
const double chiSigmaMin
const double cosMax
const double cosMin
vector< string > file
const double chiSigmaMax
const int nbins
const double fitMeanMax
const double fitSigmaMin
const double chiMin
const double chiMax
const double slopeMax
const int no
const double fitMeanMin
const double fitSigmaMax
const double slopeMin
legend Draw()
mg GetYaxis() -> SetRangeUser(0.8, 1.02)
mg GetXaxis() -> SetRangeUser(0.5, 1.9)
gr1 SetMarkerStyle(8)
legend AddEntry(gr3,"e+ Data oldPat","p")
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
gr1 SetMarkerColor(1)
data GetEntry(0)
data SetBranchAddress("time",&time)
TGraph * gr
char * c_str(Index i)
Definition: EvtCyclic3.cc:252
void slope()
Definition: slope.cxx:12

◆ pushNo()

void pushNo ( )

Definition at line 11 of file CheckRung/check/dEdxVsCosNP.cxx.

12{
13 file.push_back("costheta.root");
14 file.push_back("costheta.root");
15}

Referenced by dEdxVsCosNP().

Variable Documentation

◆ chiMax

const double chiMax = 30

Definition at line 22 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ chiMin

const double chiMin = -30

Definition at line 21 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ chiSigmaMax

const double chiSigmaMax = 6.5

Definition at line 24 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ chiSigmaMin

const double chiSigmaMin = 0.5

Definition at line 23 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ cosMax

const double cosMax = 1.0

Definition at line 20 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ cosMin

const double cosMin = -1.0

Definition at line 19 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ file

vector<string> file

Definition at line 10 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP(), and pushNo().

◆ fitMeanMax

const double fitMeanMax = 2585

Definition at line 28 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ fitMeanMin

const double fitMeanMin = 30

Definition at line 27 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ fitSigmaMax

const double fitSigmaMax = 50

Definition at line 30 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ fitSigmaMin

const double fitSigmaMin = 20

Definition at line 29 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ nbins

const int nbins = 80

Definition at line 18 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ no

const int no = 5

Definition at line 17 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ slopeMax

const double slopeMax = 1.2

Definition at line 32 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().

◆ slopeMin

const double slopeMin = 0.8

Definition at line 31 of file CheckRung/check/dEdxVsCosNP.cxx.

Referenced by dEdxVsCosNP().