Plot time series from TTree

From: Benjamin Bannier <bbannier_at_gmail.com>
Date: Mon, 18 Oct 2010 16:28:58 -0400


Dear ROOT experts,

I would like to plot the development of a TTree variable over time and was wondeing if there was a shortcut for that build into TTree::Draw.

I have a TTree `t` with one branch `x` and would essentially like to do something like

    t.Draw("x:MAGIC_DUMMY_VAR_FOR_ENTRY_NUM", "", "col");

where the resulting TH2 would have `x` averaged over some default "number-of-entries" bin.

What I do now is

    float x;
    t.SetBranchAddress("x", &x);
    std::vector<float> xv;
    std::vector<float> iv;
    const size_t n = t.GetEntries();
    for (int i=0; i<n; ++i) {

      t.GetEntry(i);
      xv.push_back(x);
      iv.push_back(i);

    }

    TGraph g(n, &iv[0], &xv[0]);
    // etc

but this makes it hard to see overall structure for large `n`.

Thanks,

Benjamin

Received on Mon Oct 18 2010 - 22:29:06 CEST

This archive was generated by hypermail 2.2.0 : Mon Oct 18 2010 - 23:50:01 CEST