3{
4 Int_t runno;
5 Double_t runmean, rungain, runresol;
6
7 TFile fdedx("DedxConst_test.root","recreate");
8 TTree* runbyrun = new TTree("runcalib", "runcalib");
9 runbyrun ->
Branch(
"runno", &runno,
"runno/I");
10 runbyrun ->
Branch(
"runmean", &runmean,
"runmean/D");
11 runbyrun ->
Branch(
"rungain", &rungain,
"rungain/D");
12 runbyrun ->
Branch(
"runresol", &runresol,
"runresol/D");
13
15 TTree *tree_rung = (TTree*)fconst0.Get("runcalib");
20
21 long NRUN = tree_rung -> GetEntries();
22 cout<<"Run Number == "<<NRUN<<endl;
23 for(long runid =0; runid<NRUN; runid++)
24 {
25 tree_rung->GetEntry(runid);
26 runbyrun ->Fill();
27 }
28
29 TTree *tree_resg = (TTree*)fconst0.Get("resolcalib");
30 Double_t resolpar[1];
33
34 TTree *tree_gaing = (TTree*)fconst0.Get("gaincalib");
35 Double_t gainpar[1];
38
39 fconst0.Close();
40 cout<<"runbyrun const OK!!!"<<endl;
41
42
44
45
46
47 Double_t gwire[6796];
48 TTree *tree_wireg = (TTree*)fconst1.Get("wiregcalib");
51 fconst1.Close();
52 cout<<"wiregcalib const OK!!!"<<endl;
53
54
56 Double_t ggs0[43], ggs1[43], ggs2[43], ggs3[43];
57 TTree *tree_ggs = (TTree*)fconst2.Get("ggscalib");
62 tree_ggs->GetEntry(0);
63 fconst2.Close();
64 cout<<"ggscalib const OK!!!"<<endl;
65
66
68 Double_t ddg0[43], ddg1[43], ddg2[43], ddg3[43];
69 TTree *tree_ddg = (TTree*)fconst3.Get("ddgcalib");
75 fconst3.Close();
76 cout<<"ddgcalib const OK!!!"<<endl;
77
78
80 Double_t entra0[43], entra1[43], entra2[43], entra3[43];
81 TTree *tree_entra = (TTree*)fconst4.Get("entracalib");
86
87
88
89
90 tree_entra->GetEntry(0);
91 fconst4.Close();
92
93
94
96 int entry[1]; double denangle[100];
97 TTree *tree_entra1 = (TTree*)fconst4_1.Get("entracalib");
100 tree_entra1 ->GetEntry(0);
101 fconst4_1.Close();
102 cout<<"entrance angle const OK!!!"<<endl;
103
104
106 Double_t zdep0[43], zdep1[43], zdep2[43], zdep3[43];
107 TTree *tree_zdep = (TTree*)fconst5.Get("zdepcalib");
112 tree_zdep->GetEntry(0);
113 fconst5.Close();
114 cout<<"zdepcalib const OK!!!"<<endl;
115
116
118 Double_t glayer[43];
119 TTree *tree_layerg = (TTree*)fconst6.Get("layergcalib");
121 tree_layerg->GetEntry(0);
122 fconst6.Close();
123 cout<<"layergcalib const OK!!!"<<endl;
124
125
126
128 TTree *tree_costheta = (TTree*)fconst7.Get("ggscalib");
129
130 double gcostheta[80];
131 tree_costheta ->SetBranchAddress("costheta",gcostheta);
132 tree_costheta->GetEntry(0);
133 fconst7.Close();
134 cout<<"costhetacalib const OK!!!"<<endl;
135
136
137 TFile fconst8("t0.root");
138
139 TTree *tree_t0=(TTree*)fconst8.Get("gaincalib");
140 double gt0[35];
141 double gdedx[35];
142 tree_t0->SetBranchAddress("t0",gt0);
143 tree_t0->SetBranchAddress("dedx",gdedx);
144 for(int i=0; i<tree_t0->GetEntries(); i++) tree_t0->GetEntry(i);
145 fconst8.Close();
146 cout<<"t0calib const OK!!!"<<endl;
147
148
149
152 double Iner_gain[
n], Iner_chi[
n], Iner_hits[
n];
153 double Out_gain[
n], Out_chi[
n], Out_hits[
n];
154 double Id_doca[
n], Ip_eangle[
n];
155
156 TTree *tree_docasin = (TTree*)fconst9.Get("ddgcalib");
166 fconst9.Close();
167
168 cout<<"ddgcalib const OK!!!"<<endl;
169
171
172
173 int hadronNo;
174 double ghadron[5];
175 TTree *tree_hadron = (TTree*)fconst10.Get("ggscalib");
178 tree_hadron->GetEntry(0);
179 fconst10.Close();
180 cout<<"hadron const OK!!!"<<endl;
181
182
183 fdedx.cd();
184 TTree* gain = new TTree("gaincalib", "gaincalib");
185 gain ->
Branch(
"gain", gainpar,
"gain[1]/D");
186 gain ->
Branch(
"t0", gt0,
"t0[35]/D");
187 gain ->
Branch(
"dedx", gdedx,
"dedx[35]/D");
188
189 TTree* resol = new TTree("resolcalib", "resolcalib");
190 resol ->
Branch(
"resol", resolpar,
"resol[1]/D");
191
192 TTree* wireg = new TTree("wiregcalib", "wiregcalib");
193 wireg ->
Branch(
"wireg", gwire,
"wireg[6796]/D");
194 wireg-> SetBasketSize("wireg",2000000);
195
196 TTree* ggs = new TTree("ggscalib", "ggscalib");
197 ggs ->
Branch(
"ggs0", ggs0,
"ggs[43]/D");
198 ggs ->
Branch(
"ggs1", ggs1,
"ggs[43]/D");
199 ggs ->
Branch(
"ggs2", ggs2,
"ggs[43]/D");
200 ggs ->
Branch(
"ggs3", ggs3,
"ggs[43]/D");
201 ggs ->
Branch(
"costheta", gcostheta,
"costheta[80]/D");
202 ggs ->
Branch(
"hadron",ghadron,
"hadron[5]/D");
203 ggs ->
Branch(
"hadronNo",&hadronNo,
"hadronNo/I");
204
205 TTree* ddg = new TTree("ddgcalib", "ddgcalib");
206 ddg ->
Branch(
"ddg0", ddg0,
"ddg[43]/D");
207 ddg ->
Branch(
"ddg1", ddg1,
"ddg[43]/D");
208 ddg ->
Branch(
"ddg2", ddg2,
"ddg[43]/D");
209 ddg ->
Branch(
"ddg3", ddg3,
"ddg[43]/D");
210 ddg ->
Branch(
"Iner_gain", Iner_gain,
"Iner_gain[1600]/D");
211 ddg ->
Branch(
"Out_gain", Out_gain,
"Out_gain[1600]/D");
212 ddg ->
Branch(
"Iner_chi", Iner_chi,
"Iner_chi[1600]/D");
213 ddg ->
Branch(
"Out_chi", Out_chi,
"Out_chi[1600]/D");
214 ddg ->
Branch(
"Iner_hits", Iner_hits,
"Iner_hits[1600]/D");
215 ddg ->
Branch(
"Out_hits", Out_hits,
"Out_hits[1600]/D");
216 ddg ->
Branch(
"Id_doca", Id_doca,
"Id_doca[1600]/D");
217 ddg ->
Branch(
"Ip_eangle", Ip_eangle,
"Ip_eangle[1600]/D");
218
219 TTree* entra = new TTree("entracalib", "entracalib");
220 entra ->
Branch(
"entra0", entra0,
"entra[43]/D");
221 entra ->
Branch(
"entra1", entra1,
"entra[43]/D");
222 entra ->
Branch(
"entra2", entra2,
"entra[43]/D");
223 entra ->
Branch(
"entra3", entra3,
"entra[43]/D");
224 entra ->
Branch(
"1denangle_entry", entry,
"1denangle_entry[1]/I");
225 entra ->
Branch(
"1denangle", denangle,
"1denangle[100]/D");
226
227 TTree* zdep = new TTree("zdepcalib", "zdepcalib");
228 zdep ->
Branch(
"zdep0", zdep0,
"zdep[43]/D");
229 zdep ->
Branch(
"zdep1", zdep1,
"zdep[43]/D");
230 zdep ->
Branch(
"zdep2", zdep2,
"zdep[43]/D");
231 zdep ->
Branch(
"zdep3", zdep3,
"zdep[43]/D");
232
233 TTree* layerg = new TTree("layergcalib", "layergcalib");
234 layerg ->
Branch(
"layerg", glayer,
"layerg[43]/D");
235
236
237 gain->Fill();
238 resol->Fill();
245
246
247
248
249
250
251
252
253
254
255 fdedx.Write();
256 fdedx.Close();
257 cout<<"All const OK!!!"<<endl;
258}
curve Branch("CurveSize",&CurveSize,"CurveSize/I")
data SetBranchAddress("time",&time)