EnergyDir->cd();
for (int k = 0; k<Nadc; k++) h_EBGO[k]->Write();
EnergyADCDir->cd();
for (int k = 0; k<Nadc; k++) h_EBGO_ADC[k]->Write();
RateDir->cd();
for (int k = 0; k < Nadc; k++) h_rate[k]->Write();
but opening the root file, I don’t see the directories.
Last question please. If I’m in a directory, how to come back to the file? is it enough
f_out->cd
Yes. This is the most explicit way.
Another alternative is :
{ // Start an explicit C++ scope to control object lifetime; this could also be a function for example
TDirectory::TContext ctxt; // Record the current directory.
subdir->cd();
... do some stuff ...
} // The end of the scope means `ctxt` is destructed and it reset the current directory to what it was
// before the start of the scope.