Is there any convenient way to draw a vector in Tree

Dear all,
I have a root file with vector branch such as

root [3] P ->Show(0)
======> EVENT:0
 Peak            = 0.198009
 ORI             = (vector<float>*)0x600002205260
 FIL             = (vector<float>*)0x600002205220

I want to draw the vector of one entry but not a histogram. Besides create a TGraph like

{
        TFile *f = TFile::Open("test.root","READ");
        TTree *t ; f->GetObject("P",t);
        std::vector<float> *ORI,IDX;
        t->SetBranchAddress("ORI",&ORI);
        t->GetEntry(122);
        Int_t n = t->Draw("ORI","Entry$ == 122");
        cout<<n<<endl;
        for (int i=0;i<n;i++){
                IDX.push_back(i);
        }
        TGraph *g = new TGraph(n,&IDX[0], &(ORI->at(0)));
        g->Draw();
}

Is there any other way to do this?
BTW, where could I find command line to interact with tree such as Show(), Scan(), Print(), Draw()…


ROOT Version: 6-26-06
Platform: MAC OS
Compiler: Apple clang version 14.0.0


t->Draw("ORI") will produce a histogram of the ORI variable.
To produce a such graph you will need an extra variable and do:

t->Draw("ORI:idx","","L");

Scan, Print, Show

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.