I have a TTree with a branch variable which is an array of floats called fPosition_mm. The length of this array varies from event-to-event and there is a branch variable which specifies that length in each event called iRecordSize.

I would like to draw a histogram of the max element of fPosition_mm using TTree::Draw(), however, the following does not work:

I think Draw does not support arguments like this. You could use a Proxy (see TTree::MakeProxy() and the h1analysisProxy example), but it may be simpler to just make your own histogram and fill it by looping over the tree; something like (in mymacro.C):

double maxval(int n, int* x) {
return TMath::MaxElement(n,x);
}
void mymacro() {
TFile *f = new TFile("myfile.root");
TTree *T = (TTree*)f->Get("T");
int n, x[3]; // here all have size 3; use n if saved in the tree
T->SetBranchAddress("x",x);
// T->SetBranchAddress("n",&n); // array sizes, if given in the tree
TH1D *h = new TH1D("h","h",12,0,12); // use your own values
T->Scan("x");
double v = 0;
for (int i=0; i<T->GetEntries(); ++i) {
T->GetEvent(i);
v = maxval(3,x); // (n,x); alternatively: v = TMath::MaxElement(3,x);
cout << v << endl;
h->Fill(v);
}
h->Draw();
}