BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
DedxCalibRunConst.cxx File Reference

Go to the source code of this file.

Functions

void DedxCalibRunConst ()
 

Variables

TString str_old = "../WireGain/DedxConst_test.root"
 

Function Documentation

◆ DedxCalibRunConst()

void DedxCalibRunConst ( )

Definition at line 5 of file DocaEangle/DedxCalibRunConst.cxx.

5 {
6// Int_t runno;
7 Int_t runno, evtfrom, evtto;
8 Double_t runmean, rungain, runresol;
9
10 TFile fdedx("DedxConst_test.root","recreate"); // output
11 TTree* runbyrun = new TTree("runcalib", "runcalib");
12 runbyrun -> Branch("runno", &runno, "runno/I");
13 runbyrun -> Branch("runmean", &runmean, "runmean/D");
14 runbyrun -> Branch("rungain", &rungain, "rungain/D");
15 runbyrun -> Branch("runresol", &runresol, "runresol/D");
16 runbyrun -> Branch("evtfrom", &evtfrom, "evtfrom/I");
17 runbyrun -> Branch("evtto", &evtto, "evtto/I");
18
19 // run gain
20 TFile fconst0(str_old);
21 TTree *tree_rung = (TTree*)fconst0.Get("runcalib");
22 tree_rung -> SetBranchAddress("rungain", &rungain);
23 tree_rung -> SetBranchAddress("runmean", &runmean);
24 tree_rung -> SetBranchAddress("runno", &runno);
25 tree_rung -> SetBranchAddress("runresol", &runresol);
26 tree_rung -> SetBranchAddress("evtfrom", &evtfrom);
27 tree_rung -> SetBranchAddress("evtto", &evtto);
28
29 long NRUN = tree_rung -> GetEntries();
30 cout<<"Run Number == "<<NRUN<<endl;
31 for(long runid =0; runid<NRUN; runid++){
32 tree_rung->GetEntry(runid);
33 runbyrun ->Fill();
34 }
35
36 TTree *tree_resg = (TTree*)fconst0.Get("resolcalib");
37 Double_t resolpar[1];
38 tree_resg -> SetBranchAddress("resol", resolpar);
39 tree_resg -> GetEntry(0);
40
41 TTree *tree_gaing = (TTree*)fconst0.Get("gaincalib");
42 Double_t gainpar[1];
43 tree_gaing -> SetBranchAddress("gain", gainpar);
44 tree_gaing -> GetEntry(0);
45
46 fconst0.Close();
47 cout<<"runbyrun const OK!!!"<<endl;
48
49 // wire gain const
50 TFile fconst1(str_old); //for adding runs in 11414-14604 only
51 Double_t gwire[6796];
52 TTree *tree_wireg = (TTree*)fconst1.Get("wiregcalib");
53 tree_wireg -> SetBranchAddress("wireg", gwire);
54 tree_wireg -> GetEntry(0);
55 fconst1.Close();
56 cout<<"wiregcalib const OK!!!"<<endl;
57
58 // satuaration const
59 TFile fconst2(str_old);
60 Double_t ggs0[43], ggs1[43], ggs2[43], ggs3[43];
61 TTree *tree_ggs = (TTree*)fconst2.Get("ggscalib");
62 tree_ggs -> SetBranchAddress("ggs0", ggs0);
63 tree_ggs -> SetBranchAddress("ggs1", ggs1);
64 tree_ggs -> SetBranchAddress("ggs2", ggs2);
65 tree_ggs -> SetBranchAddress("ggs3", ggs3);
66 tree_ggs->GetEntry(0);
67 fconst2.Close();
68 cout<<"ggscalib const OK!!!"<<endl;
69
70 // driftdist const
71 TFile fconst3(str_old);
72 Double_t ddg0[43], ddg1[43], ddg2[43], ddg3[43];
73 TTree *tree_ddg = (TTree*)fconst3.Get("ddgcalib");
74 tree_ddg -> SetBranchAddress("ddg0", ddg0);
75 tree_ddg -> SetBranchAddress("ddg1", ddg1);
76 tree_ddg -> SetBranchAddress("ddg2", ddg2);
77 tree_ddg -> SetBranchAddress("ddg3", ddg3);
78 tree_ddg -> GetEntry(0);
79 fconst3.Close();
80 cout<<"ddgcalib const OK!!!"<<endl;
81
82 // entrance angle const
83 TFile fconst4(str_old);
84 Double_t entra0[43], entra1[43], entra2[43], entra3[43];
85 TTree *tree_entra = (TTree*)fconst4.Get("entracalib");
86 tree_entra -> SetBranchAddress("entra0", entra0);
87 tree_entra -> SetBranchAddress("entra1", entra1);
88 tree_entra -> SetBranchAddress("entra2", entra2);
89 tree_entra -> SetBranchAddress("entra3", entra3);
90
91 //int entry[1]; double denangle[100];
92 //tree_entra -> SetBranchAddress("1denangle_entry", entry);
93 //tree_entra -> SetBranchAddress("1denangle", denangle);
94 tree_entra->GetEntry(0);
95 fconst4.Close();
96
97 // TFile fconst4_1("/ihepbatch/besd26/anff/655/Calib/root_file/Eangle/total_655/EAngle_20448-23454_new_noTrunc_1dfitNorm.root");
98 // 1D entrance angle
99 TFile fconst4_1(str_old);
100 int entry[1]; double denangle[100];
101 TTree *tree_entra1 = (TTree*)fconst4_1.Get("entracalib");
102 tree_entra1 -> SetBranchAddress("1denangle_entry", entry);
103 tree_entra1 -> SetBranchAddress("1denangle", denangle);
104 tree_entra1 ->GetEntry(0);
105 fconst4_1.Close();
106 cout<<"entrance angle const OK!!!"<<endl;
107
108 // zhit const
109 TFile fconst5(str_old);
110 Double_t zdep0[43], zdep1[43], zdep2[43], zdep3[43];
111 TTree *tree_zdep = (TTree*)fconst5.Get("zdepcalib");
112 tree_zdep -> SetBranchAddress("zdep0", zdep0);
113 tree_zdep -> SetBranchAddress("zdep1", zdep1);
114 tree_zdep -> SetBranchAddress("zdep2", zdep2);
115 tree_zdep -> SetBranchAddress("zdep3", zdep3);
116 tree_zdep->GetEntry(0);
117 fconst5.Close();
118 cout<<"zdepcalib const OK!!!"<<endl;
119
120 // layer gain const
121 TFile fconst6(str_old);
122 Double_t glayer[43];
123 TTree *tree_layerg = (TTree*)fconst6.Get("layergcalib");
124 tree_layerg -> SetBranchAddress("layerg", glayer);
125 tree_layerg->GetEntry(0);
126 fconst6.Close();
127 cout<<"layergcalib const OK!!!"<<endl;
128
129 // costhetacalib const
130 // TFile fconst7("/ihepbatch/besd26/anff/655/Calib/root_file/Costheta/total_655/CosthetaRoot_20448-23454_new.root");
131 // TTree *tree_costheta = (TTree*)fconst7.Get("costhetacalib");
132 TFile fconst7(str_old);
133 TTree *tree_costheta = (TTree*)fconst7.Get("ggscalib");
134 double gcostheta[80];
135 tree_costheta ->SetBranchAddress("costheta",gcostheta);
136 tree_costheta->GetEntry(0);
137 fconst7.Close();
138 cout<<"costhetacalib const OK!!!"<<endl;
139
140 // t0calib const
141 TFile fconst8(str_old);
142 TTree *tree_t0=(TTree*)fconst8.Get("gaincalib");
143 // double t0, dedx;
144 double gt0[35];
145 double gdedx[35];
146 tree_t0->SetBranchAddress("t0",gt0);
147 tree_t0->SetBranchAddress("dedx",gdedx);
148 for(int i=0; i<tree_t0->GetEntries(); i++)
149 {
150 tree_t0->GetEntry(i);
151 // gt0[i] = t0;
152 // gdedx[i] = dedx;
153 }
154 fconst8.Close();
155 cout<<"t0calib const OK!!!"<<endl;
156
157 // docaeangle const
158 //TFile fconst9("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/6.5.4/DedxConst_after_docaeangle.root");
159 TFile fconst9("docaeangle.root");
160 const int n = 1600;
161 double Iner_gain[n], Iner_chi[n], Iner_hits[n];
162 double Out_gain[n], Out_chi[n], Out_hits[n];
163 double Id_doca[n], Ip_eangle[n];
164
165 TTree *tree_docasin = (TTree*)fconst9.Get("ddgcalib");
166 tree_docasin -> SetBranchAddress("Iner_gain", Iner_gain);
167 tree_docasin -> SetBranchAddress("Iner_chi", Iner_chi);
168 tree_docasin -> SetBranchAddress("Iner_hits", Iner_hits);
169 tree_docasin -> SetBranchAddress("Out_gain", Out_gain);
170 tree_docasin -> SetBranchAddress("Out_chi", Out_chi);
171 tree_docasin -> SetBranchAddress("Out_hits", Out_hits);
172 tree_docasin -> SetBranchAddress("Id_doca", Id_doca);
173 tree_docasin -> SetBranchAddress("Ip_eangle", Ip_eangle);
174 tree_docasin -> GetEntry(0);
175 fconst9.Close();
176
177 cout<<"ddgcalib const OK!!!"<<endl;
178
179 TFile fconst10(str_old);
180 // TFile fconst10("/ihepbatch/besd26/anff/655/Calib/root_file/Hadron/total_655/Hadron_20448-23454.root");
181 // TFile fconst10("/panfs/panfs.ihep.ac.cn/home/data/anff/dEdxCal/662_cal/Hadron/constfile/Hadron_20333-23454.root");
182 int hadronNo;
183 double ghadron[5];
184 TTree *tree_hadron = (TTree*)fconst10.Get("ggscalib");
185 tree_hadron -> SetBranchAddress("hadron", ghadron);
186 tree_hadron -> SetBranchAddress("hadronNo",&hadronNo);
187 tree_hadron->GetEntry(0);
188 fconst10.Close();
189 cout<<"hadron const OK!!!"<<endl;
190
191 //output of const file
192 fdedx.cd();
193 TTree* gain = new TTree("gaincalib", "gaincalib");
194 gain -> Branch("gain", gainpar, "gain[1]/D");
195 gain -> Branch("t0", gt0, "t0[35]/D");
196 gain -> Branch("dedx", gdedx, "dedx[35]/D");
197
198 TTree* resol = new TTree("resolcalib", "resolcalib");
199 resol -> Branch("resol", resolpar, "resol[1]/D");
200
201 TTree* wireg = new TTree("wiregcalib", "wiregcalib");
202 wireg -> Branch("wireg", gwire, "wireg[6796]/D");
203 wireg-> SetBasketSize("wireg",2000000); //not need in 661,but have to be done in 655
204
205 TTree* ggs = new TTree("ggscalib", "ggscalib");
206 ggs -> Branch("ggs0", ggs0, "ggs[43]/D");
207 ggs -> Branch("ggs1", ggs1, "ggs[43]/D");
208 ggs -> Branch("ggs2", ggs2, "ggs[43]/D");
209 ggs -> Branch("ggs3", ggs3, "ggs[43]/D");
210 ggs -> Branch("costheta", gcostheta, "costheta[80]/D");
211 ggs -> Branch("hadron",ghadron,"hadron[5]/D");
212 ggs -> Branch("hadronNo",&hadronNo,"hadronNo/I");
213
214 TTree* ddg = new TTree("ddgcalib", "ddgcalib");
215 ddg -> Branch("ddg0", ddg0, "ddg[43]/D");
216 ddg -> Branch("ddg1", ddg1, "ddg[43]/D");
217 ddg -> Branch("ddg2", ddg2, "ddg[43]/D");
218 ddg -> Branch("ddg3", ddg3, "ddg[43]/D");
219 ddg -> Branch("Iner_gain", Iner_gain, "Iner_gain[1600]/D");
220 ddg -> Branch("Out_gain", Out_gain, "Out_gain[1600]/D");
221 ddg -> Branch("Iner_chi", Iner_chi, "Iner_chi[1600]/D");
222 ddg -> Branch("Out_chi", Out_chi, "Out_chi[1600]/D");
223 ddg -> Branch("Iner_hits", Iner_hits, "Iner_hits[1600]/D");
224 ddg -> Branch("Out_hits", Out_hits, "Out_hits[1600]/D");
225 ddg -> Branch("Id_doca", Id_doca, "Id_doca[1600]/D");
226 ddg -> Branch("Ip_eangle", Ip_eangle, "Ip_eangle[1600]/D");
227
228 TTree* entra = new TTree("entracalib", "entracalib");
229 entra -> Branch("entra0", entra0, "entra[43]/D");
230 entra -> Branch("entra1", entra1, "entra[43]/D");
231 entra -> Branch("entra2", entra2, "entra[43]/D");
232 entra -> Branch("entra3", entra3, "entra[43]/D");
233 entra -> Branch("1denangle_entry", entry, "1denangle_entry[1]/I");
234 entra -> Branch("1denangle", denangle, "1denangle[100]/D");
235
236 TTree* zdep = new TTree("zdepcalib", "zdepcalib");
237 zdep -> Branch("zdep0", zdep0, "zdep[43]/D");
238 zdep -> Branch("zdep1", zdep1, "zdep[43]/D");
239 zdep -> Branch("zdep2", zdep2, "zdep[43]/D");
240 zdep -> Branch("zdep3", zdep3, "zdep[43]/D");
241
242 TTree* layerg = new TTree("layergcalib", "layergcalib");
243 layerg -> Branch("layerg", glayer, "layerg[43]/D");
244
245 //Fill constroot file!!!
246 gain->Fill();
247 resol->Fill();
248 wireg -> Fill();
249 ggs -> Fill();
250 ddg -> Fill();
251 entra -> Fill();
252 zdep -> Fill();
253 layerg -> Fill();
254 ///////////////////////////////////////////////////
255 //wireg->Write();
256 //ggs->Write();
257 //ddg->Write();
258 //entra->Write();
259 //zdep->Write();
260 //layerg->Write();
261 //gain->Write();
262 //resol->Write();
263 //runbyrun ->Write();
264 fdedx.Write();
265 fdedx.Close();
266 cout<<"All const OK!!!"<<endl;
267}
curve Branch("CurveSize",&CurveSize,"CurveSize/I")
curve Fill()
const Int_t n
data GetEntry(0)
data SetBranchAddress("time",&time)

Variable Documentation

◆ str_old

TString str_old = "../WireGain/DedxConst_test.root"

Definition at line 2 of file DocaEangle/DedxCalibRunConst.cxx.

Referenced by DedxCalibRunConst(), and main().