9{
10 Int_t runno;
11 Double_t runmean, rungain, runresol;
12
13 TFile fdedx("DedxConst_before.root","recreate");
14
15 TTree* runbyrun = new TTree("runcalib", "runcalib");
16 runbyrun ->
Branch(
"runno", &runno,
"runno/I");
17 runbyrun ->
Branch(
"runmean", &runmean,
"runmean/D");
18 runbyrun ->
Branch(
"rungain", &rungain,
"rungain/D");
19 runbyrun ->
Branch(
"runresol", &runresol,
"runresol/D");
20
21 TFile fconst0("rungain.root");
22 TTree *tree_rung = (TTree*)fconst0.Get("runcalib");
27
28 long NRUN = tree_rung -> GetEntries();
29 cout<<"Run Number == "<<NRUN<<endl;
30 for(long runid =0; runid<NRUN; runid++)
31 {
32 tree_rung->GetEntry(runid);
33 if(runno<12739) runbyrun ->Fill();
34 }
35
36 TTree *tree_resg = (TTree*)fconst0.Get("resolcalib");
37 Double_t resolpar[1];
40
41 TTree *tree_gaing = (TTree*)fconst0.Get("gaincalib");
42 Double_t gainpar[1];
45
46 fconst0.Close();
47 cout<<"runbyrun const OK!!!"<<endl;
48
49
50 TFile fconst1("/ihepbatch/besd26/anff/662/Calib/const_file/WireGain/wiregain_before_new.root");
51
52
53
54 Double_t gwire[6796];
55 TTree *tree_wireg = (TTree*)fconst1.Get("wiregcalib");
58 fconst1.Close();
59 cout<<"wiregcalib const OK!!!"<<endl;
60
61
62 TFile fconst2("../Eangle1D/DedxConst_test.root");
63 Double_t ggs0[43], ggs1[43], ggs2[43], ggs3[43];
64 TTree *tree_ggs = (TTree*)fconst2.Get("ggscalib");
69 tree_ggs->GetEntry(0);
70 fconst2.Close();
71 cout<<"ggscalib const OK!!!"<<endl;
72
73
74 TFile fconst3("../Eangle1D/DedxConst_test.root");
75 Double_t ddg0[43], ddg1[43], ddg2[43], ddg3[43];
76 TTree *tree_ddg = (TTree*)fconst3.Get("ddgcalib");
82 fconst3.Close();
83 cout<<"ddgcalib const OK!!!"<<endl;
84
85
86 TFile fconst4("../Eangle1D/DedxConst_test.root");
87 Double_t entra0[43], entra1[43], entra2[43], entra3[43];
88 TTree *tree_entra = (TTree*)fconst4.Get("entracalib");
93
94
95
96
97 tree_entra->GetEntry(0);
98 fconst4.Close();
99
100 TFile fconst4_1("/ihepbatch/besd26/anff/662/Calib/draw/calib/eangle/EAngle.root");
101
102 int entry[1]; double denangle[100];
103 TTree *tree_entra1 = (TTree*)fconst4_1.Get("entracalib");
106 tree_entra1 ->GetEntry(0);
107 fconst4_1.Close();
108 cout<<"entrance angle const OK!!!"<<endl;
109
110
111 TFile fconst5("../Eangle1D/DedxConst_test.root");
112 Double_t zdep0[43], zdep1[43], zdep2[43], zdep3[43];
113 TTree *tree_zdep = (TTree*)fconst5.Get("zdepcalib");
118 tree_zdep->GetEntry(0);
119 fconst5.Close();
120 cout<<"zdepcalib const OK!!!"<<endl;
121
122
123 TFile fconst6("../Eangle1D/DedxConst_test.root");
124 Double_t glayer[43];
125 TTree *tree_layerg = (TTree*)fconst6.Get("layergcalib");
127 tree_layerg->GetEntry(0);
128 fconst6.Close();
129 cout<<"layergcalib const OK!!!"<<endl;
130
131
132
133
134 TFile fconst7("/ihepbatch/besd26/anff/662/Calib/const_file/Costheta/costheta_new.root");
135 TTree *tree_costheta = (TTree*)fconst7.Get("costhetacalib");
136 double gcostheta[80];
137 tree_costheta ->SetBranchAddress("costheta",gcostheta);
138 tree_costheta->GetEntry(0);
139 fconst7.Close();
140 cout<<"costhetacalib const OK!!!"<<endl;
141
142
143 TFile fconst8("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/6.5.3/Jpsi/t0calib.root");
144
145 TTree *tree_t0=(TTree*)fconst8.Get("t0calib");
146 double t0, dedx;
147 double gt0[35];
148 double gdedx[35];
149 tree_t0->SetBranchAddress("t0",&t0);
150 tree_t0->SetBranchAddress("dedx",&dedx);
151 for(int i=0; i<tree_t0->GetEntries(); i++)
152 {
153 tree_t0->GetEntry(i);
154 gt0[i] = t0;
155 gdedx[i] = dedx;
156 }
157 fconst8.Close();
158 cout<<"t0calib const OK!!!"<<endl;
159
160
161
162 TFile fconst9("/ihepbatch/besd26/anff/662/Calib/const_file/DocaEAngle/docaeangle_new.root");
164 double Iner_gain[
n], Iner_chi[
n], Iner_hits[
n];
165 double Out_gain[
n], Out_chi[
n], Out_hits[
n];
166 double Id_doca[
n], Ip_eangle[
n];
167
168 TTree *tree_docasin = (TTree*)fconst9.Get("ddgcalib");
178 fconst9.Close();
179
180 cout<<"ddgcalib const OK!!!"<<endl;
181
182 TFile fconst10("/panfs/panfs.ihep.ac.cn/home/data/anff/dEdxCal/662_cal/Hadron/constfile/Hadron_11414-14604.root");
183
184
185 int hadronNo;
186 double ghadron[5];
187 TTree *tree_hadron = (TTree*)fconst10.Get("ggscalib");
190 tree_hadron->GetEntry(0);
191 fconst10.Close();
192 cout<<"hadron const OK!!!"<<endl;
193
194
195 fdedx.cd();
196 TTree* gain = new TTree("gaincalib", "gaincalib");
197 gain ->
Branch(
"gain", gainpar,
"gain[1]/D");
198 gain ->
Branch(
"t0", gt0,
"t0[35]/D");
199 gain ->
Branch(
"dedx", gdedx,
"dedx[35]/D");
200
201 TTree* resol = new TTree("resolcalib", "resolcalib");
202 resol ->
Branch(
"resol", resolpar,
"resol[1]/D");
203
204 TTree* wireg = new TTree("wiregcalib", "wiregcalib");
205 wireg ->
Branch(
"wireg", gwire,
"wireg[6796]/D");
206 wireg-> SetBasketSize("wireg",2000000);
207
208 TTree* ggs = new TTree("ggscalib", "ggscalib");
209 ggs ->
Branch(
"ggs0", ggs0,
"ggs[43]/D");
210 ggs ->
Branch(
"ggs1", ggs1,
"ggs[43]/D");
211 ggs ->
Branch(
"ggs2", ggs2,
"ggs[43]/D");
212 ggs ->
Branch(
"ggs3", ggs3,
"ggs[43]/D");
213 ggs ->
Branch(
"costheta", gcostheta,
"costheta[80]/D");
214 ggs ->
Branch(
"hadron",ghadron,
"hadron[5]/D");
215 ggs ->
Branch(
"hadronNo",&hadronNo,
"hadronNo/I");
216
217 TTree* ddg = new TTree("ddgcalib", "ddgcalib");
218 ddg ->
Branch(
"ddg0", ddg0,
"ddg[43]/D");
219 ddg ->
Branch(
"ddg1", ddg1,
"ddg[43]/D");
220 ddg ->
Branch(
"ddg2", ddg2,
"ddg[43]/D");
221 ddg ->
Branch(
"ddg3", ddg3,
"ddg[43]/D");
222 ddg ->
Branch(
"Iner_gain", Iner_gain,
"Iner_gain[1600]/D");
223 ddg ->
Branch(
"Out_gain", Out_gain,
"Out_gain[1600]/D");
224 ddg ->
Branch(
"Iner_chi", Iner_chi,
"Iner_chi[1600]/D");
225 ddg ->
Branch(
"Out_chi", Out_chi,
"Out_chi[1600]/D");
226 ddg ->
Branch(
"Iner_hits", Iner_hits,
"Iner_hits[1600]/D");
227 ddg ->
Branch(
"Out_hits", Out_hits,
"Out_hits[1600]/D");
228 ddg ->
Branch(
"Id_doca", Id_doca,
"Id_doca[1600]/D");
229 ddg ->
Branch(
"Ip_eangle", Ip_eangle,
"Ip_eangle[1600]/D");
230
231 TTree* entra = new TTree("entracalib", "entracalib");
232 entra ->
Branch(
"entra0", entra0,
"entra[43]/D");
233 entra ->
Branch(
"entra1", entra1,
"entra[43]/D");
234 entra ->
Branch(
"entra2", entra2,
"entra[43]/D");
235 entra ->
Branch(
"entra3", entra3,
"entra[43]/D");
236 entra ->
Branch(
"1denangle_entry", entry,
"1denangle_entry[1]/I");
237 entra ->
Branch(
"1denangle", denangle,
"1denangle[100]/D");
238
239 TTree* zdep = new TTree("zdepcalib", "zdepcalib");
240 zdep ->
Branch(
"zdep0", zdep0,
"zdep[43]/D");
241 zdep ->
Branch(
"zdep1", zdep1,
"zdep[43]/D");
242 zdep ->
Branch(
"zdep2", zdep2,
"zdep[43]/D");
243 zdep ->
Branch(
"zdep3", zdep3,
"zdep[43]/D");
244
245 TTree* layerg = new TTree("layergcalib", "layergcalib");
246 layerg ->
Branch(
"layerg", glayer,
"layerg[43]/D");
247
248
249 gain->Fill();
250 resol->Fill();
257
258
259
260
261
262
263
264
265
266
267 fdedx.Write();
268 fdedx.Close();
269 cout<<"All const OK!!!"<<endl;
270}
curve Branch("CurveSize",&CurveSize,"CurveSize/I")
data SetBranchAddress("time",&time)