Is there a simple way to specify line color when drawing ttree branches? In particular, I am drawing ttree branches on the same plot and would like them to be different colors:
tree->Draw(“A”,"","");
tree->Draw(“B”,"",“same”);
Since these aren’t histograms, I can’t set their colors individually with TH1::SetLineColor()
tree->Draw("A", "", "");
// gPad->GetListOfPrimitives()->At(0) ... is a TFrame
((TH1F*)(gPad->GetListOfPrimitives()->At(1)))->SetLineColor(1); // the first "htemp"
// gPad->GetListOfPrimitives()->At(2) ... is a TPaveText (the "title")
tree->Draw("B", "", "same");
((TH1F*)(gPad->GetListOfPrimitives()->At(3)))->SetLineColor(3); // the second "htemp"
tree->Draw("C", "", "same");
((TH1F*)(gPad->GetListOfPrimitives()->At(4)))->SetLineColor(4); // the third "htemp"
tree->Draw("D", "", "same");
((TH1F*)(gPad->GetListOfPrimitives()->At(5)))->SetLineColor(5); // the fourth "htemp"
gPad->Modified(); gPad->Update(); // make sure the pad is redrawn
gPad->GetListOfPrimitives()->Print(); // print what's available