Re: Branches w/ different number of events

From: Hovhannes Khandanyan <khandan_at_cern.ch>
Date: Thu, 2 Sep 2010 09:26:23 +0200

   Hi Eduard,

Good catch thanks. Nonetheless, the problem with empty branches/ leaves persists.

Cheers,
Hovhannes

On Sep 1, 2010, at 10:41 PM, Eduard Avetisyan wrote:

>
> Hi Hovhannes,
>
> Your script has a typo, it fills the Ana2 branch both times, if you
> change
> it to Ana1 in the first loop you should get both branches filled (yet
> uncorrelated).
>
> Cheers
> Eduard
>
> On Wed, 1 Sep 2010, Hovhannes Khandanyan wrote:
>
>> 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 Thu Sep 02 2010 - 09:26:47 CEST

This archive was generated by hypermail 2.2.0 : Thu Sep 02 2010 - 11:50:01 CEST