When using the Draw() function, how do I write to an array of histograms?
I declare my histograms in a loop:
TH1F *TwoDHistArray[5][20];
for (blah; blah; blah) {
sprintf(name, “TwoDHist_%d_%d”,i,j);
TwoDHistArray[i][j]=new TH1F(name,name,256,0,4096);
}
Now, I have TTree open and I want to use the Operator >> in the first argument in order to fill the Histogram (I’m doing it this way because I can’t seem to loop over the events of a chain of TTree’s with multiple branches… look at my other post for a description) :
for (blah;blah;blah) {
myTree->Draw("this>>"+TwoDHistArray[i][j],myTCut1+myTCut2);
}
So, what type of argument can be put into this statement to make it work? Declaring a TString doesn’t work, char[256] doesn’t work, the code above doesn’t work… Using a TString before the operator is just fine, but what can I use for the Histogram?
eugene