Adding a vector to a tree

From: Bin Guo <Bin.Guo_at_cern.ch>
Date: Thu, 18 Oct 2007 14:43:13 -0400


Hi Rooters,

I want to add a vector to a root tree, and make it a branch of that tree. I found the example of adding an array to a tree like below:

{

    TFile *f = new TFile("peter.root", "recreate");     Int_t nPhot;
    Float_t E[500];
    TTree * t1 = new TTree("nEmcPhotons", "EMC Photons");     t1->Branch("nPhot", &nPhot, "nPhot/I");     t1->Branch("E", E, "E[nPhot]/F");
}

Now if I want to change E[500] array above to a vector: "vector<float> E", how do I change the t1->Branch("E", E, "E[nPhot]/F") line ?

Namely, how do I write the 3rd argument of the "Branch()" method for a vector?

Thanks for the help!

Best,
Bin Received on Thu Oct 18 2007 - 20:43:33 CEST

This archive was generated by hypermail 2.2.0 : Thu Oct 18 2007 - 23:50:01 CEST