Home | News | Documentation | Download

Creating more histos in a for cycle

ROOT Version: 6.18/02

Hi, I would like to create more histograms in a “for” cycle and numbering them sequentially. Since they are a lot I would like to use a TString::Form() to change their name inside the cycle. How can I do that? Or is it better to use an std::map?

Thank you in advance,
Davide Minieri

Hi Davide,

I’d use a map unless you want to store them to a TFile - then different names certainly help. TString::Format is the best way for this. But consider using different directories, if your loop has multiple “dimensions” (e.g. pT bins, data / MC samples, etc)

Cheers, Axel.