The confusion of using ACLiC

I recently ran my code. It worked well when I did’t use ACLiC. My code is as follow.

[code] sprintf(runfilename,“data/tree/%s_output_tree.root”,runname.Data());
cout<<"Open Tree file: “<<runfilename<<endl;
TFile ftreeout(runfilename,“UPDATE”);
sprintf(cname,“Setup%03d_output”,isetup);
if(!ftreeout.IsOpen() ||ftreeout.IsZombie()){
cerr<<“Error open file “”<<runfilename<<”” - skip setup “<<isetup<<endl;
if(blogfile){
logfile<<“Error open file “”<<runfilename<<”” - skip setup "<<isetup<<endl;
}
isetup++;
continue;

}
tree_runoutput =0;
tree_runoutput = (TTree*) ftreeout.Get(cname); 

if(tree_runoutput){

/* define run input data tree */
cout<<"Update file \""<<runfilename<<"\" - add date to Tree "<<cname<<endl;
logfile<<"Update file \""<<runfilename<<"\" - add date to Tree "<<cname<<endl;

tree_runoutput->SetBranchAddress("SW_Rev",&sw_rev);
tree_runoutput->SetBranchAddress("Setup",&isetup);
tree_runoutput->SetBranchAddress("Run",&iprun);
tree_runoutput->SetBranchAddress("Runmode",&isweepmode);
tree_runoutput->SetBranchAddress("Stat",&istat);
tree_runoutput->SetBranchAddress("Transvers",&btrans);
tree_runoutput->SetBranchAddress("MonCav",&cav_look_mcav);
tree_runoutput->SetBranchAddress("MonMod",&cav_look_mod);


if(btrans){
   tree_runoutput->SetBranchAddress("dxout",&R_dx[sections-1][0]);
   tree_runoutput->SetBranchAddress("dxout_sig",&R_dx[sections-1][1]);
   tree_runoutput->SetBranchAddress("dxpout",&R_dxp[sections-1][0]);
   tree_runoutput->SetBranchAddress("dxpout_sig",&R_dxp[sections-1][1]);
  if(sections>1){
   tree_runoutput->SetBranchAddress("dxtr",&R_dx[sections-2][0]);
   tree_runoutput->SetBranchAddress("dxtr_sig",&R_dx[sections-2][1]);
   tree_runoutput->SetBranchAddress("dxptr",&R_dxp[sections-2][0]);
   tree_runoutput->SetBranchAddress("dxptr_sig",&R_dxp[sections-2][1]);
 }
}else{
   tree_runoutput->SetBranchAddress("dEout",&R_dE[sections-1][0]);
   tree_runoutput->SetBranchAddress("dEout_sig",&R_dE[sections-1][1]);
   tree_runoutput->SetBranchAddress("dPhiout_sig",&R_dPhi[sections-1][1]);
   tree_runoutput->SetBranchAddress("dPhiout",&R_dPhi[sections-1][0]);
    if(sections>1){
   tree_runoutput->SetBranchAddress("dEtr",&R_dE[sections-2][0]);
   tree_runoutput->SetBranchAddress("dEtr_sig",&R_dE[sections-2][1]);
   tree_runoutput->SetBranchAddress("dPhitr",&R_dPhi[sections-2][0]);
   tree_runoutput->SetBranchAddress("dPhitr_sig",&R_dPhi[sections-2][1]);
  }
}

if(sections>1){
tree_runoutput->SetBranchAddress("Vh_m",&R_Vh[sections-2][0]);
  tree_runoutput->SetBranchAddress("Vh_sig_m",&R_Vh[sections-2][1]);
tree_runoutput->SetBranchAddress("Vh_max_m",&R_Vh[sections-2][2]);
tree_runoutput->SetBranchAddress("BunchPasstr",&R_Bunchpass[sections-2]);
tree_runoutput->SetBranchAddress("Emittr",&R_EmiL[sections-2]);
}
tree_runoutput->SetBranchAddress("Vh_h",&R_Vh[sections-1][0]);
tree_runoutput->SetBranchAddress("Vh_sig_h",&R_Vh[sections-1][1]);
  tree_runoutput->SetBranchAddress("Vh_max_h",&R_Vh[sections-1][2]);
tree_runoutput->SetBranchAddress("BunchPassout",&R_Bunchpass[sections-1]);
tree_runoutput->SetBranchAddress("Emitout",&R_EmiL[sections-1]);

}else{

  cout<<"Created file \""<<runfilename<<"\" - init Tree "<<cname<<endl;
  logfile<<"Created file \""<<runfilename<<"\" - init Tree "<<cname<<endl;


tree_runoutput = new TTree(cname, "Run output data collection");   
tree_runoutput->Branch("SW_Rev",&sw_rev);
tree_runoutput->Branch("Setup",&isetup);
tree_runoutput->Branch("Run",&iprun);
tree_runoutput->Branch("Runmode",&isweepmode);
tree_runoutput->Branch("Stat",&istat);
tree_runoutput->Branch("Transvers",&btrans);
tree_runoutput->Branch("MonCav",&cav_look_mcav);
tree_runoutput->Branch("MonMod",&cav_look_mod);





if(btrans){
   tree_runoutput->Branch("dxout",&R_dx[sections-1][0]);
   tree_runoutput->Branch("dxout_sig",&R_dx[sections-1][1]);
   tree_runoutput->Branch("dxpout",&R_dxp[sections-1][0]);
   tree_runoutput->Branch("dxpout_sig",&R_dxp[sections-1][1]);
  if(sections>1){
   tree_runoutput->Branch("dxtr",&R_dx[sections-2][0]);
   tree_runoutput->Branch("dxtr_sig",&R_dx[sections-2][1]);
   tree_runoutput->Branch("dxptr",&R_dxp[sections-2][0]);
   tree_runoutput->Branch("dxptr_sig",&R_dxp[sections-2][1]);	
 }
}else{
   tree_runoutput->Branch("dEout",&R_dE[sections-1][0]);
   tree_runoutput->Branch("dEout_sig",&R_dE[sections-1][1]);
   tree_runoutput->Branch("dPhiout_sig",&R_dPhi[sections-1][1]);
   tree_runoutput->Branch("dPhiout",&R_dPhi[sections-1][0]);
  if(sections>1){
   tree_runoutput->Branch("dEtr",&R_dE[sections-2][0]);
   tree_runoutput->Branch("dEtr_sig",&R_dE[sections-2][1]);
   tree_runoutput->Branch("dPhitr",&R_dPhi[sections-2][0]);
   tree_runoutput->Branch("dPhitr_sig",&R_dPhi[sections-2][1]);
  }
}

if(sections>1){
tree_runoutput->Branch("Vh_m",&R_Vh[sections-2][0]);
  tree_runoutput->Branch("Vh_sig_m",&R_Vh[sections-2][1]);
tree_runoutput->Branch("Vh_max_m",&R_Vh[sections-2][2]);
tree_runoutput->Branch("BunchPasstr",&R_Bunchpass[sections-2]);
tree_runoutput->Branch("Emittr",&R_EmiL[sections-2]);
}
tree_runoutput->Branch("Vh_h",&R_Vh[sections-1][0]);
tree_runoutput->Branch("Vh_sig_h",&R_Vh[sections-1][1]);
  tree_runoutput->Branch("Vh_max_h",&R_Vh[sections-1][2]);
tree_runoutput->Branch("BunchPassout",&R_Bunchpass[sections-1]);
tree_runoutput->Branch("Emitout",&R_EmiL[sections-1]);

}[/code]
But there comes some errors when I use the ACLiC. The error is shown below:

Open Tree file file: data/tree/homSweepBigNGSMWS_output_tree.root SysError in <TFile::TFile>: file data/tree/homSweepBigNGSMWS_output_tree.root can not be opened(No such file or directory) Error open file "data/tree/homSweepBigNGSMWS_output_tree.root" -skip setup
I am confused. Is there something wrong with my code?

The code you provided obviously is not a valid C++ program.
But anyway, I assume your real code is different. And if you can open your file from the interpreted macro, you can also open it using compiled macro - there is no difference for TFile (whose member functions are compiled and binary in a shared library). So either provide the minimal code sample + root file reproducing the problem, or just check you have the file etc.

[quote=“tpochep”]The code you provided obviously is not a valid C++ program.
But anyway, I assume your real code is different. And if you can open your file from the interpreted macro, you can also open it using compiled macro - there is no difference for TFile (whose member functions are compiled and binary in a shared library). So either provide the minimal code sample + root file reproducing the problem, or just check you have the file etc.[/quote]

I have figured out the reason and now my codes work well. Thanks.