Macros: persistance of graphs and erasing variables

(root6/ macOs 10.10)

I am running macros in root which use external libs (also build with root).
Everything works fines, but I would like to understand two small issues.
.x Analysis_1.C (see code below)

  1. Why graphs disappear suddenly after having been created?
    (I realized but I am not sure of the reason that if in my macros I let space before the first “{”, this situations appears.)

  2. As I am loading many times for test the same macro, I need to erase the variables. In fact I have error of re-declarations.

Maybe I am wrong in my way to use macros… :question:

If the file starts here. The line below is the extra space I mentioned in the text. If I remove it the graph stays.

// trying to make the plots stays
char List_files[]=“”;
char Name_channel[]=“L1:GDS-CALIB_STRAIN”;

int Rate = 16384;
CWB::frame ifr(List_files, Name_channel,“READ”);
int nb_files=ifr.getNfiles();
waveSegment range=ifr.getFrRange();
int file_duration=(range.stop-range.start)/nb_files;
cout<<"Times: starting “<<range.start<<”\t stop “<<range.stop<<endl;
cout<<“Reading " << nb_files <<” files”<< endl;
cout<<"Reading the channel "<< ifr.getChName()<<endl;
cout<<"File duration "<<file_duration<<endl;

int N = Rate*(range.stop-range.start );
wavearray x(N);
ifr >> x;

watplot pl;
// // pl.plot(x,const_cast<char*>(“APL”),1,2.,510.,false,0.,0.,true,1.); //const char is compulsary now
pl.plot(x,const_cast<char*>(“APL”),1,x.start()+1., x.stop()-1,true,1.,2000.,true,1.);
return pl.canvas; // used by THtml doc


First, I would advise to use a named macro, and then, I cannot reproduce the problem with ROOT 6 (master) on Linux (I cannot test on Mac). So maybe this has already been fixed…

Cheers, Bertrand.