00041 {
00042 log<<MSG::INFO<<"DedxCalibRunConst::WriteHists( )..."<<endreq;
00043
00044
00045 Int_t runno;
00046 Double_t runmean, rungain, runresol;
00047
00048 TTree* runbyrun = new TTree("runcalib", "runcalib");
00049 runbyrun -> Branch("runno", &runno, "runno/I");
00050 runbyrun -> Branch("runmean", &runmean, "runmean/D");
00051 runbyrun -> Branch("rungain", &rungain, "rungain/D");
00052 runbyrun -> Branch("runresol", &runresol, "runresol/D");
00053
00054 TFile fconst0("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/6.5.5/DedxConst_20448-20669.root");
00055 TTree *tree_rung = (TTree*)fconst0.Get("runcalib");
00056 tree_rung -> SetBranchAddress("rungain", &rungain);
00057 tree_rung -> SetBranchAddress("runmean", &runmean);
00058 tree_rung -> SetBranchAddress("runno", &runno);
00059 tree_rung -> SetBranchAddress("runresol", &runresol);
00060
00061
00062 int NRUN = tree_rung -> GetEntries();
00063 cout<<"Run Number == "<<NRUN<<endl;
00064 for(int runid =0; runid<NRUN; runid++) {
00065 tree_rung->GetEntry(runid);
00066 runbyrun ->Fill();
00067 }
00068
00069 TTree *tree_resg = (TTree*)fconst0.Get("resolcalib");
00070 Double_t resolpar[1];
00071 tree_resg -> SetBranchAddress("resol", resolpar);
00072 tree_resg -> GetEntry(0);
00073
00074 TTree *tree_gaing = (TTree*)fconst0.Get("gaincalib");
00075 Double_t gainpar[1];
00076 tree_gaing -> SetBranchAddress("gain", gainpar);
00077 tree_gaing -> GetEntry(0);
00078
00079 fconst0.Close();
00080 cout<<"runbyrun const OK!!!"<<endl;
00081
00082
00083
00084 TFile fconst1("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/6.5.5/DedxConst_11414-14604.root");
00085 Double_t gwire[6796];
00086 TTree *tree_wireg = (TTree*)fconst1.Get("wiregcalib");
00087 tree_wireg -> SetBranchAddress("wireg", gwire);
00088 tree_wireg -> GetEntry(0);
00089 fconst1.Close();
00090 cout<<"wiregcalib const OK!!!"<<endl;
00091
00092
00093 TFile fconst2("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/bak_tree/ggscalib.root");
00094 Double_t ggs0[43], ggs1[43], ggs2[43], ggs3[43];
00095 TTree *tree_ggs = (TTree*)fconst2.Get("ggscalib");
00096 tree_ggs -> SetBranchAddress("ggs0", ggs0);
00097 tree_ggs -> SetBranchAddress("ggs1", ggs1);
00098 tree_ggs -> SetBranchAddress("ggs2", ggs2);
00099 tree_ggs -> SetBranchAddress("ggs3", ggs3);
00100 tree_ggs->GetEntry(0);
00101 fconst2.Close();
00102 cout<<"ggscalib const OK!!!"<<endl;
00103
00104
00105 TFile fconst3("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/bak_tree/ddgcalib.root");
00106 Double_t ddg0[43], ddg1[43], ddg2[43], ddg3[43];
00107 TTree *tree_ddg = (TTree*)fconst3.Get("ddgcalib");
00108 tree_ddg -> SetBranchAddress("ddg0", ddg0);
00109 tree_ddg -> SetBranchAddress("ddg1", ddg1);
00110 tree_ddg -> SetBranchAddress("ddg2", ddg2);
00111 tree_ddg -> SetBranchAddress("ddg3", ddg3);
00112 tree_ddg -> GetEntry(0);
00113 fconst3.Close();
00114 cout<<"ddgcalib const OK!!!"<<endl;
00115
00116
00117 TFile fconst4("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/6.5.5/DedxConst_11414-14604.root");
00118 Double_t entra0[43], entra1[43], entra2[43], entra3[43];
00119 TTree *tree_entra = (TTree*)fconst4.Get("entracalib");
00120 tree_entra -> SetBranchAddress("entra0", entra0);
00121 tree_entra -> SetBranchAddress("entra1", entra1);
00122 tree_entra -> SetBranchAddress("entra2", entra2);
00123 tree_entra -> SetBranchAddress("entra3", entra3);
00124
00125 int entry[1]; double denangle[100];
00126 tree_entra -> SetBranchAddress("1denangle_entry", entry);
00127 tree_entra -> SetBranchAddress("1denangle", denangle);
00128 tree_entra->GetEntry(0);
00129 fconst4.Close();
00130 cout<<"entrance angle const OK!!!"<<endl;
00131
00132
00133 TFile fconst5("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/bak_tree/zdepcalib.root");
00134 Double_t zdep0[43], zdep1[43], zdep2[43], zdep3[43];
00135 TTree *tree_zdep = (TTree*)fconst5.Get("zdepcalib");
00136 tree_zdep -> SetBranchAddress("zdep0", zdep0);
00137 tree_zdep -> SetBranchAddress("zdep1", zdep1);
00138 tree_zdep -> SetBranchAddress("zdep2", zdep2);
00139 tree_zdep -> SetBranchAddress("zdep3", zdep3);
00140 tree_zdep->GetEntry(0);
00141 fconst5.Close();
00142 cout<<"zdepcalib const OK!!!"<<endl;
00143
00144
00145 TFile fconst6("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/bak_tree/layergcalib.root");
00146 Double_t glayer[43];
00147 TTree *tree_layerg = (TTree*)fconst6.Get("layergcalib");
00148 tree_layerg -> SetBranchAddress("layerg", glayer);
00149 tree_layerg->GetEntry(0);
00150 fconst6.Close();
00151 cout<<"layergcalib const OK!!!"<<endl;
00152
00153
00154 TFile fconst7("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/6.5.5/DedxConst_11414-14604.root");
00155 TTree *tree_costheta = (TTree*)fconst7.Get("ggscalib");
00156 double gcostheta[80];
00157 tree_costheta ->SetBranchAddress("costheta",gcostheta);
00158 tree_costheta->GetEntry(0);
00159 fconst7.Close();
00160 cout<<"costhetacalib const OK!!!"<<endl;
00161
00162
00163 TFile fconst8("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/6.5.3/Jpsi/t0calib.root");
00164 TTree *tree_t0=(TTree*)fconst8.Get("t0calib");
00165 double t0, dedx;
00166 double gt0[35];
00167 double gdedx[35];
00168 tree_t0->SetBranchAddress("t0",&t0);
00169 tree_t0->SetBranchAddress("dedx",&dedx);
00170 for(int i=0; i<tree_t0->GetEntries(); i++){
00171 tree_t0->GetEntry(i);
00172 gt0[i] = t0;
00173 gdedx[i] = dedx;
00174 }
00175 fconst8.Close();
00176 cout<<"t0calib const OK!!!"<<endl;
00177
00178
00179 TFile fconst9("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/6.5.4/DedxConst_after_docaeangle.root");
00180 const int n = 1600;
00181 double Iner_gain[n], Iner_chi[n], Iner_hits[n];
00182 double Out_gain[n], Out_chi[n], Out_hits[n];
00183 double Id_doca[n], Ip_eangle[n];
00184
00185 TTree *tree_docasin = (TTree*)fconst9.Get("ddgcalib");
00186 tree_docasin -> SetBranchAddress("Iner_gain", Iner_gain);
00187 tree_docasin -> SetBranchAddress("Iner_chi", Iner_chi);
00188 tree_docasin -> SetBranchAddress("Iner_hits", Iner_hits);
00189 tree_docasin -> SetBranchAddress("Out_gain", Out_gain);
00190 tree_docasin -> SetBranchAddress("Out_chi", Out_chi);
00191 tree_docasin -> SetBranchAddress("Out_hits", Out_hits);
00192 tree_docasin -> SetBranchAddress("Id_doca", Id_doca);
00193 tree_docasin -> SetBranchAddress("Ip_eangle", Ip_eangle);
00194 tree_docasin -> GetEntry(0);
00195 fconst9.Close();
00196
00197 cout<<"ddgcalib const OK!!!"<<endl;
00198
00199 TFile fconst10("/afs/ihep.ac.cn/bes3/offline/CalibConst/dedx/6.5.5/DedxConst_11414-14604.root");
00200 int hadronNo;
00201 double ghadron[5];
00202 TTree *tree_hadron = (TTree*)fconst10.Get("ggscalib");
00203 tree_hadron -> SetBranchAddress("hadron", ghadron);
00204 tree_hadron -> SetBranchAddress("hadronNo",&hadronNo);
00205 tree_hadron->GetEntry(0);
00206 fconst10.Close();
00207 cout<<"hadron const OK!!!"<<endl;
00208
00209
00210
00211 TTree* gain = new TTree("gaincalib", "gaincalib");
00212 gain -> Branch("gain", gainpar, "gain[1]/D");
00213 gain -> Branch("t0", gt0, "t0[35]/D");
00214 gain -> Branch("dedx", gdedx, "dedx[35]/D");
00215
00216 TTree* resol = new TTree("resolcalib", "resolcalib");
00217 resol -> Branch("resol", resolpar, "resol[1]/D");
00218
00219 TTree* wireg = new TTree("wiregcalib", "wiregcalib");
00220 wireg -> Branch("wireg", gwire, "wireg[6796]/D");
00221
00222 TTree* ggs = new TTree("ggscalib", "ggscalib");
00223 ggs -> Branch("ggs0", ggs0, "ggs[43]/D");
00224 ggs -> Branch("ggs1", ggs1, "ggs[43]/D");
00225 ggs -> Branch("ggs2", ggs2, "ggs[43]/D");
00226 ggs -> Branch("ggs3", ggs3, "ggs[43]/D");
00227 ggs -> Branch("costheta", gcostheta, "costheta[80]/D");
00228 ggs -> Branch("hadron",ghadron,"hadron[5]/D");
00229 ggs -> Branch("hadronNo",&hadronNo,"hadronNo/I");
00230
00231 TTree* ddg = new TTree("ddgcalib", "ddgcalib");
00232 ddg -> Branch("ddg0", ddg0, "ddg[43]/D");
00233 ddg -> Branch("ddg1", ddg1, "ddg[43]/D");
00234 ddg -> Branch("ddg2", ddg2, "ddg[43]/D");
00235 ddg -> Branch("ddg3", ddg3, "ddg[43]/D");
00236 ddg -> Branch("Iner_gain", Iner_gain, "Iner_gain[1600]/D");
00237 ddg -> Branch("Out_gain", Out_gain, "Out_gain[1600]/D");
00238 ddg -> Branch("Iner_chi", Iner_chi, "Iner_chi[1600]/D");
00239 ddg -> Branch("Out_chi", Out_chi, "Out_chi[1600]/D");
00240 ddg -> Branch("Iner_hits", Iner_hits, "Iner_hits[1600]/D");
00241 ddg -> Branch("Out_hits", Out_hits, "Out_hits[1600]/D");
00242 ddg -> Branch("Id_doca", Id_doca, "Id_doca[1600]/D");
00243 ddg -> Branch("Ip_eangle", Ip_eangle, "Ip_eangle[1600]/D");
00244
00245 TTree* entra = new TTree("entracalib", "entracalib");
00246 entra -> Branch("entra0", entra0, "entra[43]/D");
00247 entra -> Branch("entra1", entra1, "entra[43]/D");
00248 entra -> Branch("entra2", entra2, "entra[43]/D");
00249 entra -> Branch("entra3", entra3, "entra[43]/D");
00250 entra -> Branch("1denangle_entry", entry, "1denangle_entry[1]/I");
00251 entra -> Branch("1denangle", denangle, "1denangle[100]/D");
00252
00253 TTree* zdep = new TTree("zdepcalib", "zdepcalib");
00254 zdep -> Branch("zdep0", zdep0, "zdep[43]/D");
00255 zdep -> Branch("zdep1", zdep1, "zdep[43]/D");
00256 zdep -> Branch("zdep2", zdep2, "zdep[43]/D");
00257 zdep -> Branch("zdep3", zdep3, "zdep[43]/D");
00258
00259 TTree* layerg = new TTree("layergcalib", "layergcalib");
00260 layerg -> Branch("layerg", &glayer, "layerg[43]/D");
00261
00262
00263 TFile fdedx(m_constrootfile.c_str(),"recreate");
00264 gain->Fill();
00265 resol->Fill();
00266 wireg -> Fill();
00267 ggs -> Fill();
00268 ddg -> Fill();
00269 entra -> Fill();
00270 zdep -> Fill();
00271 layerg -> Fill();
00273 wireg->Write();
00274 ggs->Write();
00275 ddg->Write();
00276 entra->Write();
00277 zdep->Write();
00278 layerg->Write();
00279 gain->Write();
00280 resol->Write();
00281 runbyrun ->Write();
00282 fdedx.Close();
00283 cout<<"All const OK!!!"<<endl;
00284 }