Re: TTree as a database

William J Deninger (deninger@uiuc.edu)
Thu, 16 Apr 1998 16:15:55 -0500


Rene,

Sorry, but that "=" was an email typing mistake. Given the preexisting
tree:

TTree tree
TBranch raw
Int_t run_number
TClonesArray wires of TMpxEvent
TMpxEvent
Int_t time
Int_t index
T3DPoint location

I would like to append data associated with each of the TMpxEvents in the
TClonesArray. Ideally, I wish one could append the preexisting tree in the
following manner.

case (A):

TTree tree
TBranch raw
Int_t run_number
TClonesArray wires("TMpxEvent",n)
TMpxEvent (1)
Int_t time
Int_t index
T3DPoint location

Bool_t ambiguity
Float_t drift_distance
Float_t drift_error
...
TMpxEvent (n)
Int_t time
Int_t index
T3DPoint location

Bool_t ambiguity
Float_t drift_distance
Float_t drift_error

Unfortunately, the only way of adding to a tree is by adding TBranches which
(I believe) can not be correlated to the preexisting members in the
TClonesArray wires.

case (B):

TTree tree
TBranch raw
Int_t run_number
TClonesArray wires("TMpxEvent",n)
TMpxEvent (1)
Int_t time
Int_t index
T3DPoint location
...
TMpxEvent (n)
Int_t time
Int_t index
T3DPoint location

TBranch corralate to wires TClonesArray
TClonesArray wires("TMpxAppendingObject",n)
TMpxAppendingObject (1)
Bool_t ambiguity
Float_t drift_distance
Float_t drift_error
...
TMpxAppendingObject (n)
Bool_t ambiguity
Float_t drift_distance
Float_t drift_error

For each time entry there is one drift_distance.
tree->Draw("wires.drift_distance","time<100") doesn't correctly histogram
drift_distance according to its given time. How might one add to the tree
in order to get the behavior found in case (A)?

William

-----Original Message-----
From: Rene Brun <Rene.Brun@cern.ch>
To: William J Deninger <deninger@uiuc.edu>
Cc: roottalk <roottalk@hpsalo.cern.ch>
Date: Thursday, April 16, 1998 9:47 AM
Subject: Re: TTree as a database
>
>No, you can execute commands like:
>
> tree->Draw("wires.distance","wires.time == xxx && wires.index == xxx");
> tree->Draw("wires.distance","run_number == yyy && fill_number == zzz");
>
>Note that in the test, you must have
> "wires.time == xxx
>and not
> "wires.time = xxx
>
>Rene Brun
>