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 = "../RungEangle/DedxConst_test.root"
 

Function Documentation

◆ DedxCalibRunConst()

void DedxCalibRunConst ( )

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

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

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

Referenced by DedxCalibRunConst().