Branches w/ different number of events

From: Hovhannes Khandanyan <khandan_at_cern.ch>
Date: Wed, 1 Sep 2010 21:42:14 +0200

    Dear ROOTers,

I want to create a root tree with 2 branches corresponding to 2 different analysis i.e. having different number of entries per branch. Is this possible? The test macro below creates the required TTree structure, without filling the leaves though. What am I doing wrong?

Thanks for any help,
Hovhannes

int test(){

   TFile* file = new TFile("myfile.root","recreate");    TTree* tree = new TTree("T", "T");

   double var1, var2;

   tree->Branch("Ana1", &var1, "var1/F");    tree->Branch("Ana2", &var2, "var2/F");

   for (int i = 10; i < 25; i++){

     var1 = i*2.45;
     TBranch* br1 = tree->GetBranch("Ana2");
     br1->Fill();

}

   for (int i = 0; i < 5; i++){

     var2 = i*1.17;
     TBranch* br2 = tree->GetBranch("Ana2");
     br2->Fill();

}

   tree->Write();
   file->Close();

   return 0;
} Received on Wed Sep 01 2010 - 21:42:43 CEST

This archive was generated by hypermail 2.2.0 : Wed Sep 01 2010 - 23:50:02 CEST