25int main(
int argc,
char *argv[]){
27 cout <<
"plase append the old calibration const root file, Ex. insert_run_calib.exe old.root [runlist.txt]" << endl;
30 TString str_old = argv[1];
31 TString str_runlist =
"runlist.txt";
32 if(argc>=3) str_runlist = argv[2];
33 cout <<
"old file: " << str_old <<
" runlist file: " << str_runlist << endl;
35 TFile f_new(
"new.root",
"recreate");
37 ifstream in(str_runlist);
39 cout <<
"cannot open runlist.txt" << endl;
45 Double_t runmean, rungain, runresol;
48 sscanf(str ,
"%d", &in_runno);
49 if(!in_runno)
continue;
50 arr_tree[0]->SetBranchAddress(
"runno", &runno );
51 arr_tree[0]->SetBranchAddress(
"runmean", &runmean);
52 arr_tree[0]->SetBranchAddress(
"rungain", &rungain);
53 arr_tree[0]->SetBranchAddress(
"runresol", &runresol);
55 double temp_runmean(0), temp_rungain(0), temp_runresol(0);
56 for(Long64_t i=0; i<
arr_tree[0]->GetEntries(); i++){
58 if(
abs(runno-in_runno)<min_diff){
59 min_diff =
abs(runno-in_runno);
60 temp_runmean = runmean;
61 temp_rungain = rungain;
62 temp_runresol = runresol;
66 runmean = temp_runmean;
67 rungain = temp_rungain;
68 runresol = temp_runresol;
69 cout <<
"runno " << runno << endl;
double abs(const EvtComplex &c)
TString str_name_list[num_item]
TTree * arr_tree[num_item]