I have a macro which allowed for me to save 2D cuts when I was using root 5. I recently installed root 6 on my Debian machine, but the macro does not work in root 6. I am a bit new to root so if there is an easier way to do this I would be happy to know. Here is the code.
void
save_all_cuts(const char* filename)
{
FILE* f = fopen(filename,"w");
fprintf(f,"{\n\n");
int np = gROOT->GetListOfSpecials()->GetSize();
for(int i(0); i<np; ++i) {
TCutG* ccc = (TCutG*)gROOT->GetListOfSpecials()->At(i);
ccc->write(f);
fprintf(f, "\n//--------------------------\n\n);
}
fprintf(f,"}");
fclose(f);
};
I make a 2D gate from the toolbar option “Graphical Cut” which I believe gets temporarily stored in gROOT. When I load this macro in root 6, an error occurs that says "no matching member function for call to ‘Write.’ Another error says that in TObject.h: note: candidate function not viable: no known conversion from ‘FILE *’ (aka ‘IO_FILE *’) to ‘const char *’ for 1st argument. Here are the full errors:
In file included from input_line_79:1:
/home/e12001/root_12001/n2analysis/utils_Jason.C:77:10: error: no matching
member function for call to 'Write'
ccc->Write(f);
~~~~~^~~~~
/home/pauldeyoung/cern-root6-builddir/include/TObject.h:140:24: note: candidate
function not viable: no known conversion from 'FILE *' (aka '_IO_FILE *')
to 'const char *' for 1st argument
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t b...
^
/home/pauldeyoung/cern-root6-builddir/include/TObject.h:141:24: note: candidate
function not viable: no known conversion from 'FILE *' (aka '_IO_FILE *')
to 'const char *' for 1st argument
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t b...
Thank you for your help.