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