Problem with GetListOfKeys() in TSelector

From a tree I created a TSelector calss to run over it.
There I create a file with histograms, then I want to loop over them.
Using the code as suggested here: … dir.C.html
It doesn’t work!
I traced it down to

The GetListOfKeys() is not working

histoFile->GetListOfKeys() -> Print(); gives printout: Collection name='THashList', class='THashList', size=0

Any suggestions?

Sorry, never mind, I figured that out.
The histoFile needs to be written first!