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

Go to the source code of this file.

Functions

void DedxCalibRunConst ()
 

Variables

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

Function Documentation

◆ DedxCalibRunConst()

void DedxCalibRunConst ( )

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

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

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

Referenced by DedxCalibRunConst().