BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
Eangle1DSec/DedxCalibRunConst.cxx File Reference

Go to the source code of this file.

Functions

void DedxCalibRunConst ()
 

Variables

TString old_str = "../Costheta/DedxConst_test.root"
 

Function Documentation

◆ DedxCalibRunConst()

void DedxCalibRunConst ( )

Definition at line 3 of file Eangle1DSec/DedxCalibRunConst.cxx.

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

Variable Documentation

◆ old_str

TString old_str = "../Costheta/DedxConst_test.root"

Definition at line 1 of file Eangle1DSec/DedxCalibRunConst.cxx.

Referenced by DedxCalibRunConst().