I’m wondering if this is possible: I have a few different histograms for different backgrounds and would like to plot something, say dE/dx, for each of the separate backgrounds.
I would like to do something like this (just an example with two backgrounds but obviously becomes more useful with more):
TH1F* dEdx_bg[2];
dEdx_bg[0] = new TH1F("dEdx_2212","",100,0,10);
dEdx_bg[1] = new TH1F("dEdx_321","",100,0,10);
tree->Draw("TrackdEdx>>dEdx_+TMath::Abs(TrackPDG)");
However, I can’t seem to make this work. I’m wondering if root just can’t evaluate elements of the tree after the >>. Or, if this should work, what the correct syntax should be?
Ok but all I get with a such construct is errors … I tried to mimic it with:
root [0] ntuple->Draw( "Form(\"px>>h%d\",1)" );
Error in <TTreeFormula::Compile>: ')' is expected
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {Form("px,}
May be I did an obvious mistake … but I do not see it right now.