I have a problem that has kept me busy for days. I would appreciate if you can help me.
I have a tree stored in a root file with lots of branches one of which is called triggerbits. this branch stores the trigger names for each event in the form of vectors of strings (std::vectorstd::string). When I look at the tree in a TBrowser (double click on the branch) I can see a histogram of all trigger names and their frequency. I would like to recreate this histogram since it would allow me to study different events associated with different triggers. There are hundreds of triggers and not all events come with the same triggers. My problem is that I don’t know how to make a histogram from these trigger names(strings).
I have attached the root file and the branch I am trying to make a histogram from is in a sub-directory called triggerlist and the leaf name is data().
Thanks in advance,
PeriodA.root (622.1 KB)
outputtree->Draw("triggerlist"); // triggerlist : vector<string>
Thanks a lot!
I tried it and it worked perfectly recreating the histogram. But how can I save it as a histogram. I tried “GetPrimitive()” to save it fron the canvas to a histogram but it did not work.
Thanks a lot again,
TH1 *h = (TH1*)gPad->GetPrimitive("htemp")->Clone("h_triggerlist");
Sorry for the long delay. Thank you very much. That worked perfectly.