Hi, in the attached macro, I open a root file, then I save plots in an existing directory (Currently the directory is D:/). Given that I have a lot of root file (si-500408, si-500330, si-500407 etc etc) and for each files I’ve to study energies in all the subdetectors, I wrote a code so that I just write the root file number (for example 500408) by defining
int ifile=500408;
and the subdetecors numbers
int a=8; //First subdetector name to analyze. To change each time
int b=9; // Second subdetector name to analyze. To change each time
then the macro generates files by using this numbers for example:
Currently the folder in wich to save plots must exist, otherwise, the macro can’t save them; I’d like to write a function so that if, for example, the root file number is 500407 and the detector numbers are 8 and 9, ROOT create the folder D:/si-500407/sub_8-9/ in which to save the files, so that I don’t have to create subidretories by hand; should it be possible?
Thanks
ROOT saves the plot in the ROOT main folder instead of in my D:/si-%d/sub_%d-%d/
Then I think that I’ve to set the folder where to save plots
then I wrote
gSystem->mkdir(TString::Format("%ssi-%d/", dirout,ifile), kTRUE);
gSystem->mkdir(TString::Format("%ssi-%d/sub_%d-%d/",dirout,ifile, a, b), kTRUE);
TString outfolder=TString::Format("%ssi-%d/sub_%d-%d/",dirout,ifile, a, b);
TString myplotdeltatimeout = TString::Format("%ssi-%d_deltatime%d-%d.pdf",outfolder,ifile,a,b);
I used the %s for the variable TString outfolder variable (as for the char variables), but it doen’t work. I think that the problem is that %s just works for char variables. What is the similiar command of %s for a TString variable?