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