Analysis of Branch

Now I got a branch in a tree, branch->Scan() looks like
root [90] root->Scan()


  • Row * Instance * electron1 *

  •    0 *        0 * 7.471e-06 *
    
  •    0 *        1 * 5.923e-07 *
    
  •    0 *        2 * 618037985 *
    
  •    0 *        3 * 2.472e+09 *
    
  •    0 *        4 * 3.214e+10 *
    
  •    0 *        5 *         1 *
    
  •    0 *        6 * 7.489e-06 *
    
  •    0 *        7 * 6.375e-07 *
    
  •    0 *        8 * 618037985 *
    
  •    0 *        9 * 2.472e+09 *
    
  •    0 *       10 * 3.219e+10 *
    
  •    0 *       11 *         1 *
    
  •    0 *       12 * 7.505e-06 *
    
  •    0 *       13 * -4.78e-07 *
    
  •    0 *       14 * 618037985 *
    
  •    0 *       15 * 2.472e+09 *
    
  •    0 *       16 * 3.061e+10 *
    
  •    0 *       17 *         1 *
    
  •    0 *       18 * 7.505e-06 *
    
  •    0 *       19 * -9.13e-08 *
    
  •    0 *       20 * 618037985 *
    
  •    0 *       21 * 2.472e+09 *
    
  •    0 *       22 * 3.095e+10 *
    
  •    0 *       23 *         1 *
    
  •    0 *       24 * 7.519e-06 *
    

Type to continue or q to quit ==>
but now I want to put all the data into a vector ,How should I do that? or, split this branch into three other branches according to the instance number?
Thanks!

Try:
MyTree->Print();
to see what branches are made of.

Thanks for your replay, I did that ,the result are below:

root [0] TFile f(“electron1_15.root”)
root [1] root->Print()


*Tree :root : DataSets in root group *
*Entries : 1 : Total = 114925472 bytes File Size = 114892995 *

  •    :          : Tree compression factor =   1.00                                     *
    

*Br 0 :electron1 : electron1[2393594][6]/D *
*Entries : 1 : Total Size= 114925110 bytes File Size = 114892588 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 *
… .

[code]#include “TFile.h”
#include “TTree.h”

#include

Double_t electron1[2393594][6]; // warning: it’s 109.6 MB long

// returns 0 in case of “success”, otherwise returns various "error codes"
Int_t fill_electron1(const char *filename = “electron1_15.root”,
const char *treename = “root”,
const Long64_t entrynumber = 0)
{
// static Double_t electron1[2393594][6]; // warning: it’s 109.6 MB long

if (!filename || !(*filename)) return -1; // empty "filename"
if (!treename || !(*treename)) return -2; // empty “treename”

// fill the “electron1” table from TTree “treename” from TFile “filename"
TFile *f = TFile::Open(filename, “READ”);
if (!f) return -3; // TFile “filename” does not exist
TTree t; f->GetObject(treename, t);
// TTree “treename” or TBranch “electron1” not found, or wrong “entrynumber"
if ( !t || t->SetBranchAddress(“electron1”, electron1) ||
(entrynumber < 0) || (entrynumber >= t->GetEntries()) )
{ delete f; return -4; } // note: it automatically deletes “t” TTree, too
// t->SetBranchStatus(”
”, 0); t->SetBranchStatus(“electron1”, 1);
t->GetEntry(entrynumber); // fill the “electron1” table from “entrynumber”
// t->ResetBranchAddresses(); // disconnect the “electron1” table from "t"
delete f; // no longer needed (note: it automatically deletes “t” TTree, too)

#if 1 /* 0 or 1 /
// dump the beginning of the “electron1” table
for (Int_t i = 0; i < 4; i++) {
for (Int_t j = 0; j < 6; j++) {
std::cout << i << " " << j << " " << electron1[i][j] << std::endl;
}
}
#endif /
0 or 1 */

return 0; // everything was fine
}[/code]

Wile E. Coyote is right ,Thanks very much